idlefw/plugins/devicestatus/src/aioperatornamepublisher.cpp
branchRCL_3
changeset 118 8baec10861af
parent 114 a5a39a295112
equal deleted inserted replaced
114:a5a39a295112 118:8baec10861af
    31 #include "aioperatornamepublisher.h"
    31 #include "aioperatornamepublisher.h"
    32 #include "ainetworkinfolistener.h"
    32 #include "ainetworkinfolistener.h"
    33 #include "aiprioritizer.h"
    33 #include "aiprioritizer.h"
    34 #include "ainwidpriorities.h"
    34 #include "ainwidpriorities.h"
    35 #include "activeidle2domaincrkeys.h"
    35 #include "activeidle2domaincrkeys.h"
       
    36 #include "debug.h"
    36 
    37 
    37 //Delay used to animate
    38 //Delay used to animate
    38 const TInt KCleanOperationDelay = 2 * 1000000;
    39 const TInt KCleanOperationDelay = 2 * 1000000;
    39 
    40 
    40 
    41 
   130 void CAiOperatorNamePublisher::HandleNetworkInfoChange(
   131 void CAiOperatorNamePublisher::HandleNetworkInfoChange(
   131                 const MNWMessageObserver::TNWMessages& /*aMessage*/,
   132                 const MNWMessageObserver::TNWMessages& /*aMessage*/,
   132                 const TNWInfo& /*aInfo*/,
   133                 const TNWInfo& /*aInfo*/,
   133                 const TBool aShowOpInd )
   134                 const TBool aShowOpInd )
   134     {
   135     {
       
   136     __PRINTS("XAI: CAiOperatorNamePublisher::HandleNetworkInfoChange");    
   135     if ( iSuspended )
   137     if ( iSuspended )
   136         {
   138         {
       
   139         __PRINTS("XAI: suspended");
   137         return;
   140         return;
   138         }
   141         }
   139     
   142     
   140     if( aShowOpInd )
   143     if( aShowOpInd )
   141         {
   144         {
   172         }
   175         }
   173     }
   176     }
   174 
   177 
   175 void CAiOperatorNamePublisher::RefreshL( TBool aClean )
   178 void CAiOperatorNamePublisher::RefreshL( TBool aClean )
   176     {
   179     {
       
   180     __PRINTS("XAI: NamePublisher > RefreshL");
   177     iSuccess = EFalse;
   181     iSuccess = EFalse;
   178 
   182 
   179     if ( iSuspended )
   183     if ( iSuspended )
   180         {
   184         {
       
   185         __PRINTS("XAI: NamePublisher > RefreshL - iSuspended");
   181         return;
   186         return;
   182         }
   187         }
   183     
   188     
   184     if ( iProfileEngine->ActiveProfileId() == KOfflineProfileId )
   189     if ( iProfileEngine->ActiveProfileId() == KOfflineProfileId )
   185         {
   190         {
   186         MProfile* profile = iProfileEngine->ActiveProfileLC();
   191         MProfile* profile = iProfileEngine->ActiveProfileLC();
   187         const MProfileName& name = profile->ProfileName();
   192         const MProfileName& name = profile->ProfileName();
       
   193         iPriority = EAiOfflineProfile;
   188         iPrioritizer->TryToPublishL( *iBroadcaster,
   194         iPrioritizer->TryToPublishL( *iBroadcaster,
   189                                       EAiDeviceStatusContentNetworkIdentity,
   195                                       EAiDeviceStatusContentNetworkIdentity,
   190                                       name.Name(),
   196                                       name.Name(),
   191                                       iPriority );
   197                                       iPriority );
   192         iSuccess = ETrue;
   198         iSuccess = ETrue;
   193         CleanupStack::PopAndDestroy();//profile
   199         CleanupStack::PopAndDestroy();//profile
   194         return;
   200         return;
   195         }
   201         }
   196     
   202     else if ( iPriority == EAiOfflineProfile )
   197     if( aClean )
       
   198         {
   203         {
   199         iPrioritizer->TryToCleanL( *iBroadcaster,
   204         iPrioritizer->TryToCleanL( *iBroadcaster,
   200                                     EAiDeviceStatusContentNetworkIdentity,
   205                                     EAiDeviceStatusContentNetworkIdentity,
   201                                     iPriority );
   206                                     iPriority );
   202         }
   207         iPriority = EAiInvalidPriority;
   203 
   208         }
       
   209     else if( aClean )
       
   210         {
       
   211         iPrioritizer->TryToCleanL( *iBroadcaster,
       
   212                                     EAiDeviceStatusContentNetworkIdentity,
       
   213                                     iPriority );
       
   214         }
       
   215     
       
   216     __PRINT(__DBG_FORMAT("XAI: NamePublisher > RefreshL - iPriority = %d"), iPriority );
       
   217     
   204     const TNWInfo& nwInfo = iListener->NetworkInfo();
   218     const TNWInfo& nwInfo = iListener->NetworkInfo();
   205 
   219 
   206 #if defined(WINSCW) || defined(__WINS__)
   220 #if defined(WINSCW) || defined(__WINS__)
   207     // Show operator name in emulator
   221     // Show operator name in emulator
   208 #else
   222 #else
   228     const TBool isKeyLockEnabled = IsKeyLockEnabled();
   242     const TBool isKeyLockEnabled = IsKeyLockEnabled();
   229 
   243 
   230     //Check if PLMN  must be shown.
   244     //Check if PLMN  must be shown.
   231 
   245 
   232     const TBool showPLMN = nwInfo.iServiceProviderNameDisplayReq & ENWDisplayPLMNRequired;
   246     const TBool showPLMN = nwInfo.iServiceProviderNameDisplayReq & ENWDisplayPLMNRequired;
   233 
   247     __PRINT(__DBG_FORMAT("XAI: NamePublisher > RefreshL - showPLMN = %d"), showPLMN );
       
   248     
   234     TBool isInSPDI = EFalse;
   249     TBool isInSPDI = EFalse;
   235     TBool showSPN = EFalse;
   250     TBool showSPN = EFalse;
   236 
   251 
   237     //Check if we are in SPDI and SPN (Service Provider Name) must be shown.
   252     //Check if we are in SPDI and SPN (Service Provider Name) must be shown.
   238     CheckServiceProviderDisplayListStatus(  StrToInt( nwInfo.iCountryCode ),
   253     CheckServiceProviderDisplayListStatus(  StrToInt( nwInfo.iCountryCode ),
   243     //SPN must be shown if it is defined in PLMNField or if it is set in service provider name
   258     //SPN must be shown if it is defined in PLMNField or if it is set in service provider name
   244     //display requirements.
   259     //display requirements.
   245     showSPN =
   260     showSPN =
   246         showSPN ||
   261         showSPN ||
   247         ( nwInfo.iServiceProviderNameDisplayReq & ENWDisplaySPNRequired );
   262         ( nwInfo.iServiceProviderNameDisplayReq & ENWDisplaySPNRequired );
   248 
   263     
       
   264     __PRINT(__DBG_FORMAT("XAI: NamePublisher > RefreshL - showSPN  = %d"), showSPN );
   249     
   265     
   250 #if defined(WINSCW) || defined(__WINS__)
   266 #if defined(WINSCW) || defined(__WINS__)
   251     _LIT( KOperator, "Operator" );    
   267     _LIT( KOperator, "Operator" );    
   252     const TPtrC serviceProviderName( KOperator() );
   268     const TPtrC serviceProviderName( KOperator() );
   253 #else
   269 #else
   276             	//only plmn
   292             	//only plmn
   277         		ShowNetworkIdentityNameL( ETrue );
   293         		ShowNetworkIdentityNameL( ETrue );
   278             	}
   294             	}
   279             else
   295             else
   280             	{
   296             	{
   281 	            //spn & plmn (SPN.And.EONS.No)
   297                 __PRINTS("XAI: NamePublisher > RefreshL (showPLMN)- try publish and start delayed operation ");
   282 	            iPriority = EAiServiceProviderName;
   298                 //spn & plmn (SPN.And.EONS.No)
       
   299                 if ( !OperatorNamePriority( iPriority ) )
       
   300                     {                    
       
   301                     iPriority = EAiServiceProviderName;
       
   302                     }
       
   303 	            
       
   304 			    __PRINT(__DBG_FORMAT("XAI: NamePublisher > RefreshL - try publish with priority %d"), iPriority );
   283 	            iPrioritizer->TryToPublishL( *iBroadcaster,
   305 	            iPrioritizer->TryToPublishL( *iBroadcaster,
   284 	                                        	EAiDeviceStatusContentNetworkIdentity,
   306 	                                        	EAiDeviceStatusContentNetworkIdentity,
   285 	                                        	serviceProviderName,
   307 	                                        	serviceProviderName,
   286 	                                        	iPriority );
   308 	                                        	iPriority );
   287 	            StartDelayedPLMNOperation();//to publish PLMN name
   309 	            StartDelayedPLMNOperation();//to publish PLMN name
   320             	//only plmn
   342             	//only plmn
   321         		ShowNetworkIdentityNameL( ETrue );
   343         		ShowNetworkIdentityNameL( ETrue );
   322             	}
   344             	}
   323             else
   345             else
   324             	{
   346             	{
       
   347                 __PRINTS("XAI: NamePublisher > RefreshL (showSPN)- try publish and start delayed operation ");
   325 	            //spn & plmn (SPN.And.EONS.No)
   348 	            //spn & plmn (SPN.And.EONS.No)
   326 	            iPriority = EAiServiceProviderName;
   349                 if ( !OperatorNamePriority( iPriority ) )
       
   350                     {                    
       
   351                     iPriority = EAiServiceProviderName;
       
   352                     }
       
   353 
       
   354       		    __PRINT(__DBG_FORMAT("XAI: NamePublisher > RefreshL - try publish with priority %d"), iPriority );
   327 	            iPrioritizer->TryToPublishL( *iBroadcaster,
   355 	            iPrioritizer->TryToPublishL( *iBroadcaster,
   328 	                                        	EAiDeviceStatusContentNetworkIdentity,
   356 	                                        	EAiDeviceStatusContentNetworkIdentity,
   329 	                                        	serviceProviderName,
   357 	                                        	serviceProviderName,
   330 	                                        	iPriority );
   358 	                                        	iPriority );
   331 	            StartDelayedPLMNOperation();//to publish PLMN name
   359 	            StartDelayedPLMNOperation();//to publish PLMN name
   375 
   403 
   376 
   404 
   377 
   405 
   378 void CAiOperatorNamePublisher::ShowNetworkIdentityNameL( TBool aTryToPublish )
   406 void CAiOperatorNamePublisher::ShowNetworkIdentityNameL( TBool aTryToPublish )
   379 	{
   407 	{
       
   408     __PRINTS("XAI: NamePublisher > ShowNetworkIdentityNameL");
   380 	const TNWInfo& nwInfo = iListener->NetworkInfo();
   409 	const TNWInfo& nwInfo = iListener->NetworkInfo();
   381 
   410 
   382 	iNetworkIdentityName.Set( KNullDesC );
   411 	iNetworkIdentityName.Set( KNullDesC );
   383 
   412 
   384 	iPriority = EAiInvalidPriority;
   413 	iPriority = EAiInvalidPriority;
   386 	// *** Network operator name (CPHS-ONS) ***
   415 	// *** Network operator name (CPHS-ONS) ***
   387     if( nwInfo.iNPName.Length() > 0 &&
   416     if( nwInfo.iNPName.Length() > 0 &&
   388     		nwInfo.iOperatorNameInfo.iType != RMmCustomAPI::EOperatorNameFlexiblePlmn  &&
   417     		nwInfo.iOperatorNameInfo.iType != RMmCustomAPI::EOperatorNameFlexiblePlmn  &&
   389     			nwInfo.iRegistrationStatus == ENWRegisteredOnHomeNetwork )
   418     			nwInfo.iRegistrationStatus == ENWRegisteredOnHomeNetwork )
   390     	{
   419     	{
       
   420         __PRINTS("XAI: NamePublisher > ShowNetworkIdentityNameL - iNPName ");
       
   421         
   391     	//priority
   422     	//priority
   392     	iPriority = EAiNetworkOperatorName;
   423     	iPriority = EAiNetworkOperatorName;
   393     	//name
   424     	//name
   394     	iNetworkIdentityName.Set( nwInfo.iNPName );
   425     	iNetworkIdentityName.Set( nwInfo.iNPName );
   395     	//publish network identity name
   426     	//publish network identity name
   406     	}
   437     	}
   407 
   438 
   408     // *** Operator name ***
   439     // *** Operator name ***
   409     if( nwInfo.iOperatorNameInfo.iName.Length() > 0 )
   440     if( nwInfo.iOperatorNameInfo.iName.Length() > 0 )
   410     	{
   441     	{
       
   442         __PRINTS("XAI: NamePublisher > ShowNetworkIdentityNameL - iOperatorNameInfo.iName ");
       
   443         
   411     	//priority
   444     	//priority
   412     	OperatorNamePriority( iPriority );
   445     	OperatorNamePriority( iPriority );
   413     	//name
   446     	//name
   414     	iNetworkIdentityName.Set( nwInfo.iOperatorNameInfo.iName );
   447     	iNetworkIdentityName.Set( nwInfo.iOperatorNameInfo.iName );
   415     	//converted name
   448     	//converted name
   630     }
   663     }
   631 
   664 
   632 
   665 
   633 TInt CAiOperatorNamePublisher::CleanAndShowPLMNOperationCallback( TAny* aPtr )
   666 TInt CAiOperatorNamePublisher::CleanAndShowPLMNOperationCallback( TAny* aPtr )
   634     {
   667     {
       
   668     __PRINTS("XAI: NamePublisher > CleanAndShowPLMNOperationCallback ");
   635     CAiOperatorNamePublisher* self =
   669     CAiOperatorNamePublisher* self =
   636                     static_cast<CAiOperatorNamePublisher*>( aPtr );
   670                     static_cast<CAiOperatorNamePublisher*>( aPtr );
   637 
   671 
   638     if( self )
   672     if( self )
   639         {
   673         {
   655     }
   689     }
   656 
   690 
   657 
   691 
   658 void CAiOperatorNamePublisher::DoCleanOperationL()
   692 void CAiOperatorNamePublisher::DoCleanOperationL()
   659     {
   693     {
       
   694     __PRINTS("XAI: NamePublisher > DoCleanOperationL");
   660     iPrioritizer->TryToCleanL( *iBroadcaster,
   695     iPrioritizer->TryToCleanL( *iBroadcaster,
   661                                 EAiDeviceStatusContentNetworkIdentity,
   696                                 EAiDeviceStatusContentNetworkIdentity,
   662                                 EAiServiceProviderName );
   697                                 iPriority );
   663     }
   698     }
   664 
   699 
   665 
   700 
   666 TBool CAiOperatorNamePublisher::RefreshL( TInt aContentId, TBool aClean )
   701 TBool CAiOperatorNamePublisher::RefreshL( TInt aContentId, TBool aClean )
   667 	{
   702 	{
       
   703     __PRINTS("XAI: NamePublisher > RefreshL with content");
   668     if ( aContentId == EAiDeviceStatusContentNetworkIdentity )
   704     if ( aContentId == EAiDeviceStatusContentNetworkIdentity )
   669         {
   705         {
   670         iSuspended = EFalse;
   706         iSuspended = EFalse;
   671         
   707         
   672    	    RefreshL( aClean );
   708    	    RefreshL( aClean );
   680     return EFalse;
   716     return EFalse;
   681 	}
   717 	}
   682 
   718 
   683 TBool CAiOperatorNamePublisher::SuspendL( TInt aContentId, TBool /*aClean*/ )
   719 TBool CAiOperatorNamePublisher::SuspendL( TInt aContentId, TBool /*aClean*/ )
   684     {
   720     {
       
   721     __PRINTS("XAI: NamePublisher > SuspendL with content");
   685     if ( aContentId == EAiDeviceStatusContentNetworkIdentity )
   722     if ( aContentId == EAiDeviceStatusContentNetworkIdentity )
   686         {
   723         {
   687         iSuspended = ETrue;
   724         iSuspended = ETrue;
   688         iPeriodic->Cancel();
   725         iPeriodic->Cancel();
   689         return ETrue;
   726         return ETrue;
   694 
   731 
   695 TBool CAiOperatorNamePublisher::RefreshContentWithPriorityL(
   732 TBool CAiOperatorNamePublisher::RefreshContentWithPriorityL(
   696                                             TInt aContentId,
   733                                             TInt aContentId,
   697                                             TInt aPriority )
   734                                             TInt aPriority )
   698 	{
   735 	{
       
   736     __PRINTS("XAI: NamePublisher > RefreshContentWithPriorityL");
   699 	if( aContentId == EAiDeviceStatusContentNetworkIdentity && aPriority == EAiServiceProviderName )
   737 	if( aContentId == EAiDeviceStatusContentNetworkIdentity && aPriority == EAiServiceProviderName )
   700         {
   738         {
       
   739 	    __PRINTS("XAI: NamePublisher > identity and priority matched ");
   701 	    RefreshL( EFalse );
   740 	    RefreshL( EFalse );
   702 	    if( iSuccess )
   741 	    if( iSuccess )
   703    	        {
   742    	        {
   704    	        return ETrue;
   743    	        return ETrue;
   705    	        }
   744    	        }