mmsharing/mmshmanagersrv/src/musavailabilitypluginmanager.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 21 33a5d2bbf6fc
child 23 bc78a40cd63c
--- a/mmsharing/mmshmanagersrv/src/musavailabilitypluginmanager.cpp	Thu Aug 19 09:51:39 2010 +0300
+++ b/mmsharing/mmshmanagersrv/src/musavailabilitypluginmanager.cpp	Tue Aug 31 15:12:07 2010 +0300
@@ -33,6 +33,10 @@
 
 // CONSTANTS
 
+// Max number of digits in unsigned 32 bit integer (TInt32)
+const TUint KMaxInt32Length = 16;
+
+
 using namespace MultimediaSharing;
 
 // -----------------------------------------------------------------------------
@@ -175,6 +179,21 @@
 //
 // -----------------------------------------------------------------------------
 //
+void CMusAvailabilityPluginManager::PrepareForReceivedInviteL()
+    {
+    MUS_LOG( "mus: [MUSSRV]  -> CMusAvailabilityPluginManager::\
+                 PrepareForReceivedInviteL()" )
+                 
+    iPlugin->PrepareForReceivedInviteL();
+    
+    MUS_LOG( "mus: [MUSSRV]  <- CMusAvailabilityPluginManager::\
+                     PrepareForReceivedInviteL()" )
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void CMusAvailabilityPluginManager::InvitationReceivedL()
     {
     MUS_LOG( "mus: [MUSSRV]  -> CMusAvailabilityPluginManager::\
@@ -268,10 +287,34 @@
   	MMusAvaSettings& settings = iPlugin->Settings();
   	
     MUS_LOG( "mus: [MUSSRV]    Status available" )
-    
-    settings.SetManualActivation( MMusAvaSettings::EActivationAllowed );
-    iPlugin->StartL();
-
+    if( !iIndicator )
+        {
+        MUS_LOG( "mus: [MUSSRV]    Create indicator" )
+        iIndicator = CMusIndicatorApi::NewL( *this );
+        if( iIndicator->ConfirmationQueryL( CMusIndicatorApi::EVsRoamingActivationQuery ) )
+        	{
+        	settings.SetManualActivation( MMusAvaSettings::EActivationAllowed );
+        	iPlugin->StartL();
+        	}
+        else
+        	{
+        	settings.SetManualActivation( MMusAvaSettings::EActivationNotAllowed );
+        	}
+        delete iIndicator;
+        iIndicator = NULL;
+        }
+     else
+     	{
+     	if( iIndicator->ConfirmationQueryL( CMusIndicatorApi::EVsRoamingActivationQuery ) )
+        	{
+        	settings.SetManualActivation( MMusAvaSettings::EActivationAllowed );
+        	iPlugin->StartL();
+        	}
+        else
+        	{
+        	settings.SetManualActivation( MMusAvaSettings::EActivationNotAllowed );	
+        	}	
+     	}
     MUS_LOG( "mus: [MUSSRV]  <- CMusAvailabilityPluginManager::\
         ManualQueryL()" )  
     }
@@ -306,21 +349,6 @@
         AvailabilityChanged()" )	
     }
 
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
- void CMusAvailabilityPluginManager::AvailabilitiesAbleToShowIndicator()
-	{
-	    TInt err = 0;
-		TRAP( err, IndicateAvailabilityL() );
-		if ( err )
-			{
-			// Not sure about what to do. Very rare situation.
-			MUS_LOG1( "mus: [MUSSRV] AvailabilitiesAbleToShowIndicator() leave code: %d",err )
-			}
-	}
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -350,7 +378,7 @@
     }
 
 // -----------------------------------------------------------------------------
-//
+// From MMusAvaSettingsObserver
 // -----------------------------------------------------------------------------
 //
 MMusAvaSettingsObserver::TApplicationState CMusAvailabilityPluginManager::
@@ -374,7 +402,7 @@
     }
 
 // -----------------------------------------------------------------------------
-//
+// From MMusAvaSettingsObserver
 // -----------------------------------------------------------------------------
 //
 TBool CMusAvailabilityPluginManager::OptionAllowed()
@@ -389,13 +417,23 @@
     }
 
 // -----------------------------------------------------------------------------
+// From MMusAvaSettingsObserver
+// -----------------------------------------------------------------------------
+//
+void CMusAvailabilityPluginManager::StartApplicationL( 
+        MultimediaSharing::TMusUseCase aUseCase )
+    {
+    iObserver.StartSharingWithUseCaseL( aUseCase );        
+    }
+
+// -----------------------------------------------------------------------------
 // From MMusIndicatorObserver.
 // Starts live video sharing.
 // -----------------------------------------------------------------------------
 //
 void CMusAvailabilityPluginManager::StartLiveSharingL()
     {
-    iObserver.StartLiveSharingL();
+    iObserver.StartSharingWithUseCaseL( MultimediaSharing::EMusLiveVideo );
     }
 
 // -----------------------------------------------------------------------------
@@ -575,22 +613,17 @@
     // append sip address proposal
     iSessionParameters->AppendL( settings.SipAddressProposal() );
 
-    // Unsafe Magic number 16 is used but unsigned 32 bit integer (TInt32)
-    // can't go beyond 16 digits .
-    TBuf<16> contactIdBuf;
+    TBuf<KMaxInt32Length> contactIdBuf;
     contactIdBuf.Num( settings.ContactId() );
 
     // append contact id
     iSessionParameters->AppendL( contactIdBuf );
-    
     // append video codec
     HBufC* videoCodecs = VideoCodecsLC();
     iSessionParameters->AppendL( *videoCodecs );
     CleanupStack::PopAndDestroy( videoCodecs );
 
-    // Unsafe Magic number 16 is used but unsigned 32 bit integer (TInt32)
-    // can't go beyond 16 digits .
-    TBuf<16> sipProfileIdBuf;
+    TBuf<KMaxInt32Length> sipProfileIdBuf;
     sipProfileIdBuf.Num( settings.SipProfileId() );
 
     MUS_LOG1("iSessionParameters -> SIP Profile ID = %d ",
@@ -602,15 +635,15 @@
     HBufC* contactName = ContactNameLC();
     iSessionParameters->AppendL( *contactName );
     CleanupStack::PopAndDestroy( contactName );
+
+    TBuf<KMaxInt32Length> fastModeBuf;
+    fastModeBuf.Num( settings.FastMode() );
+    MUS_LOG1("iSessionParameters -> fast mode = %d ",
+        settings.FastMode() )
+
+    // append fast mode
+    iSessionParameters->AppendL( fastModeBuf );
     
-    // append call privacy indication
-    MUS_LOG1("iSessionParameters -> Call Privacy = %d ",
-            settings.CallPrivacy() )
-    TBuf<16> callPrivacy;
-    callPrivacy.Num( settings.CallPrivacy() );
-    iSessionParameters->AppendL( callPrivacy );
-
-
     MUS_LOG( "mus: [MUSSRV]  <- CMusAvailabilityPluginManager::\
              UpdateSessionParametersL()" )
     }
@@ -762,8 +795,8 @@
             {
             MUS_LOG( "mus: [MUSSRV]    Create indicator" )
             iIndicator = CMusIndicatorApi::NewL( *this );
+            iIndicator->IndicateAvailabilityL();
             }
-        iIndicator->IndicateAvailabilityL();
         iApplicationManager.SetIndicatorStatusL( ETrue );
         }
     else