mmsharing/mmshavailability/src/musavaregisteravailability.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *  Version     : %version: be1sipx1#42.1.4.1.4 % << Don't touch! Updated by Synergy at check-out.
     8 *
     9 *
     9 * Initial Contributors:
    10 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 * Nokia Corporation - initial contribution.
    11 *
    12 *
    12 * Contributors:
    13 * Contributors:
    92 //
    93 //
    93 void CMusAvaRegisterAvailability::ConstructL()
    94 void CMusAvaRegisterAvailability::ConstructL()
    94     {
    95     {
    95     iSharedObj = CMusAvaSharedObject::GetSingletonL();
    96     iSharedObj = CMusAvaSharedObject::GetSingletonL();
    96     iSharedObj->MusAvaSip().AddAdapterL( *this );
    97     iSharedObj->MusAvaSip().AddAdapterL( *this );
       
    98     iOperatorVariant = MultimediaSharingSettings::OperatorVariantSettingL();
    97     }
    99     }
    98 
   100 
    99 
   101 
   100 // -----------------------------------------------------------------------------
   102 // -----------------------------------------------------------------------------
   101 //  Constructor.
   103 //  Constructor.
   116 //
   118 //
   117 void CMusAvaRegisterAvailability::DoExecuteL()
   119 void CMusAvaRegisterAvailability::DoExecuteL()
   118     {
   120     {
   119     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::DoExecuteL " )
   121     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::DoExecuteL " )
   120     SetState( MMusAvaObserver::EMusAvaStatusInProgress );
   122     SetState( MMusAvaObserver::EMusAvaStatusInProgress );
   121     RegisterL();
   123     TRAPD( err, RegisterL() );
       
   124     if( err != KErrNone )
       
   125        {
       
   126    		SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
       
   127        }
   122     // TBD: SetState( MMusAvaObserver::EMusAvaNameRegistration );
   128     // TBD: SetState( MMusAvaObserver::EMusAvaNameRegistration );
   123 
   129 
   124     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::DoExecuteL " )
   130     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::DoExecuteL " )
   125     }
   131     }
   126 
   132 
   276 
   282 
   277             case MSIPProfileRegistryObserver::EProfileDeregistered:
   283             case MSIPProfileRegistryObserver::EProfileDeregistered:
   278                 {
   284                 {
   279                 MUS_LOG( "mus: [MUSAVA]     Profile is deregistered" )
   285                 MUS_LOG( "mus: [MUSAVA]     Profile is deregistered" )
   280                 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
   286                 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
       
   287                 iSharedObj->MusAvaSip().DeleteSIPConnection();
   281                 }
   288                 }
   282                 break;
   289                 break;
   283 
   290 
   284             case MSIPProfileRegistryObserver::EProfileDestroyed:
   291             case MSIPProfileRegistryObserver::EProfileDestroyed:
   285                 {
   292                 {
   308 // corresponding profile instantiated.
   315 // corresponding profile instantiated.
   309 // -----------------------------------------------------------------------------
   316 // -----------------------------------------------------------------------------
   310 //
   317 //
   311 void CMusAvaRegisterAvailability::ProfileRegistryErrorOccurred(
   318 void CMusAvaRegisterAvailability::ProfileRegistryErrorOccurred(
   312     TUint32 aProfileId,
   319     TUint32 aProfileId,
   313     TInt /* aError */ )
   320     TInt aError )
   314     {
   321     {
   315     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::\
   322     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::\
   316              ProfileRegistryErrorOccurred" )
   323              ProfileRegistryErrorOccurred" )
   317 
   324 
   318     CSIPProfile* profile = iSharedObj->MusAvaSip().Profile();
   325     CSIPProfile* profile = iSharedObj->MusAvaSip().Profile();
   325 
   332 
   326     profile->GetParameter( KSIPProfileId, profileId );
   333     profile->GetParameter( KSIPProfileId, profileId );
   327 
   334 
   328     if( profileId == aProfileId )
   335     if( profileId == aProfileId )
   329         {
   336         {
   330         SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
   337         if ( iOperatorVariant == MusSettingsKeys::EOperatorSpecific &&
       
   338                 aError == KErrGeneral )
       
   339             {
       
   340             MUS_LOG( "SIP profile is disabled by the user" )
       
   341             SetState( MMusAvaObserver::EMusActivationError );
       
   342             }
       
   343         else
       
   344             {
       
   345             MUS_LOG1("Error %d",aError )
       
   346             SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
       
   347             }
   331         }
   348         }
   332 
   349 
   333     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
   350     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
   334              ProfileRegistryErrorOccurred" )
   351              ProfileRegistryErrorOccurred" )
   335     }
   352     }
   484 void CMusAvaRegisterAvailability::EnableRegisterL()
   501 void CMusAvaRegisterAvailability::EnableRegisterL()
   485     {
   502     {
   486     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::EnableRegisterL " )		
   503     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::EnableRegisterL " )		
   487  	MUS_LOG( "mus: [MUSAVA]   Fetch SIP ProfileRegistry" )
   504  	MUS_LOG( "mus: [MUSAVA]   Fetch SIP ProfileRegistry" )
   488  	
   505  	
   489     CSIPProfileRegistry& registry = iSharedObj->MusAvaSip().ProfileRegistryL();
   506    CSIPProfileRegistry& registry = iSharedObj->MusAvaSip().ProfileRegistryL();
   490     MUS_LOG( "mus: [MUSAVA]   Profile status" )
   507     MUS_LOG( "mus: [MUSAVA]   Profile status" )
   491     if ( !registry.IsEnabled( *iSharedObj->MusAvaSip().Profile() ) )
   508     if ( !registry.IsEnabled( *iSharedObj->MusAvaSip().Profile() ) )
   492         {
   509        {
   493         MUS_LOG("mus: [MUSAVA]     Calling EnableL()" )
   510        MUS_LOG("mus: [MUSAVA]     Calling EnableL()" )
   494         registry.EnableL( *iSharedObj->MusAvaSip().Profile(), 
   511        registry.EnableL( *iSharedObj->MusAvaSip().Profile(), 
   495                         iSharedObj->MusAvaSip().ConnectionObserver() );
   512                        iSharedObj->MusAvaSip().ConnectionObserver() );
   496         }
   513        }
   497        
   514       
   498     // Try to write client information to CenRep of client resolver.
   515     // Try to write client information to CenRep of client resolver.
   499     // This functionality is needed in __VOIP enabled terminals.
   516     // This functionality is needed in __VOIP enabled terminals.
   500     // In __VOIP disabled builds this will fail because of a lack of needed 
   517     // In __VOIP disabled builds this will fail because of a lack of needed 
   501     // CenRep UID. To avoid branching, we just try to do this and let it fail 
   518     // CenRep UID. To avoid branching, we just try to do this and let it fail 
   502     // in normal build.
   519     // in normal build.
   503     CMusAvaClientResolverUtil* resolver = 
   520     CMusAvaClientResolverUtil* resolver = 
   504                                 iSharedObj->MusAvaSip().ClientResolverUtil();
   521                                iSharedObj->MusAvaSip().ClientResolverUtil();
   505     if ( resolver )
   522     if ( resolver )
   506         {
   523        {
   507         TRAP_IGNORE( resolver->RegisterClientWithUserL( 
   524        TRAP_IGNORE( resolver->RegisterClientWithUserL( 
   508                 *iSharedObj->MusAvaSip().Profile() ) )
   525                *iSharedObj->MusAvaSip().Profile() ) )
   509         }
   526        }
   510                     
   527                    
   511     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::EnableRegisterL " )		
   528     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::EnableRegisterL " )         
   512     }
   529     }
   513 
   530 
   514 
   531 
   515 // -----------------------------------------------------------------------------
   532 // -----------------------------------------------------------------------------
   516 // Update SIP Registration.
   533 // Update SIP Registration.
   582         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::RegistrationStatusL " )	
   599         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::RegistrationStatusL " )	
   583         return ETrue;
   600         return ETrue;
   584         }
   601         }
   585     }
   602     }
   586   
   603   
   587