coreapplicationuis/SysAp/Src/SysApPubSubObserver.cpp
changeset 0 2e3d3ce01487
child 15 312d2b433792
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  CSysApPubSubObserver implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <e32property.h>
       
    21 #include <sacls.h>
       
    22 #include <startupdomainpskeys.h>
       
    23 #include "CoreApplicationUIsPrivatePSKeys.h"
       
    24 #include <ctsydomainpskeys.h>
       
    25 #include <wlaninternalpskeys.h>
       
    26 #include <connect/sbdefs.h>
       
    27 #include <hwrmpowerstatesdkpskeys.h>
       
    28 #include "SysApPubSubObserver.h"
       
    29 #include "SysApSubscriber.h"
       
    30 #include "SysApAppUi.h"
       
    31 #include "SysApFeatureManager.h"
       
    32 #include <ir_sock.h>
       
    33 #include <NetworkHandlingDomainPSKeys.h>
       
    34 #include <hwrmdomainpskeys.h>
       
    35 #include <DataSyncInternalPSKeys.h>
       
    36 #include <hwrmfmtxdomainpskeys.h>
       
    37 #include <hwrmfmtx.h>
       
    38 #include "sysapremconobserver.h"
       
    39 #include <lbs/locationfwdomainpskeys.h>
       
    40 #include <smsuaddr.h>
       
    41 
       
    42 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    43   #include <ASShdAlarm.h>
       
    44 #else
       
    45   #include <asshddefs.h>
       
    46   #include <ASShdAlarmCal.h>
       
    47   #include <asshdalarm.h>
       
    48 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
    49 
       
    50 
       
    51 // CONSTANTS
       
    52 const TUint KCoreAppUIsMmcRemovedWithoutEjectCmdMask = 0xFFFF;
       
    53 const TUint KCoreAppUIsMmcRemovedWithoutEjectValShift = 16;
       
    54 
       
    55 // ============================ MEMBER FUNCTIONS ==============================
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CSysApPubSubObserver::NewL() 
       
    59 // ----------------------------------------------------------------------------
       
    60 CSysApPubSubObserver* CSysApPubSubObserver::NewL( CSysApAppUi& aSysApAppUi )
       
    61     {
       
    62     CSysApPubSubObserver* self = new(ELeave) CSysApPubSubObserver( aSysApAppUi );
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     CleanupStack::Pop();
       
    66     return self;
       
    67     }
       
    68 
       
    69 // ----------------------------------------------------------------------------
       
    70 // CSysApPubSubObserver::CSysApPubSubObserver() 
       
    71 // ----------------------------------------------------------------------------
       
    72 CSysApPubSubObserver::CSysApPubSubObserver( CSysApAppUi& aSysApAppUi ) :
       
    73   iSysApAppUi( aSysApAppUi ),
       
    74   iRestoreOngoing( EFalse )
       
    75     {
       
    76     }
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // CSysApPubSubObserver::ConstructL() 
       
    80 // ----------------------------------------------------------------------------
       
    81 void CSysApPubSubObserver::ConstructL()
       
    82     {    
       
    83     // Category KUidSystemCategory
       
    84     iBatteryBarsSubscriber = CSysApSubscriber::NewL( *this, KPSUidHWRMPowerState, KHWRMBatteryLevel );
       
    85     iBatteryBarsSubscriber->Subscribe();
       
    86     iBatteryCStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidHWRMPowerState, KHWRMBatteryStatus ); 
       
    87     iBatteryCStatusSubscriber->Subscribe();
       
    88     iChargerCStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidHWRMPowerState, KHWRMChargingStatus ); 
       
    89     iChargerCStatusSubscriber->Subscribe();
       
    90     iInboxStatusSubscriber = CSysApSubscriber::NewL( *this, KUidSystemCategory, KUidInboxStatusValue ); 
       
    91     iInboxStatusSubscriber->Subscribe();
       
    92     iOutboxStatusSubscriber = CSysApSubscriber::NewL( *this, KUidSystemCategory, KUidOutboxStatusValue ); 
       
    93     iOutboxStatusSubscriber->Subscribe();
       
    94     iIrdaStatusSubscriber = CSysApSubscriber::NewL( *this, KIrdaPropertyCategory, KIrdaStatus );
       
    95     iIrdaStatusSubscriber->Subscribe();
       
    96     iGprsStatusSubscriber = CSysApSubscriber::NewL( *this, KUidSystemCategory, KPSUidGprsStatusValue );
       
    97     iGprsStatusSubscriber->Subscribe();
       
    98     iWcdmaStatusSubscriber = CSysApSubscriber::NewL( *this, KUidSystemCategory, KPSUidWcdmaStatusValue ); 
       
    99     iWcdmaStatusSubscriber->Subscribe();
       
   100     iLocationGlobalPrivacySubscriber = CSysApSubscriber::NewL( *this, KUidSystemCategory, KPSUidLocationGlobalPrivacyValue );
       
   101     iLocationGlobalPrivacySubscriber->Subscribe();
       
   102     iRestoreBackupSubscriber = CSysApSubscriber::NewL( *this, KUidSystemCategory, conn::KUidBackupRestoreKey );
       
   103     iRestoreBackupSubscriber->Subscribe();
       
   104 
       
   105     // Category KPSUidStartup
       
   106     iSimChangedSubscriber = CSysApSubscriber::NewL( *this, KPSUidStartup, KPSSimOwned );
       
   107     iSimChangedSubscriber->Subscribe();
       
   108     iWakeupAlarmSubscriber = CSysApSubscriber::NewL( *this, KAlarmServerPubSubCategory, KWakeupAlarmPubSubKey );
       
   109     iWakeupAlarmSubscriber->Subscribe();
       
   110 
       
   111     // Category KPSUidCoreApplicationUIs
       
   112     iAlarmLightSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KLightsAlarmLightActive );
       
   113     iAlarmLightSubscriber->Subscribe();
       
   114     iVTLightsSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KLightsVTForcedLightsOn ); 
       
   115     iVTLightsSubscriber->Subscribe();
       
   116     iSSLightsSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn );
       
   117     iSSLightsSubscriber->Subscribe();
       
   118     iATCLightsSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KLightsATCForcedLightsOn );
       
   119     iATCLightsSubscriber->Subscribe();
       
   120     iLightsControlSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KLightsControl );
       
   121     iLightsControlSubscriber->Subscribe();
       
   122     iDisableKeyguardSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard );
       
   123     iDisableKeyguardSubscriber->Subscribe();
       
   124     iSoftRejectSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsSoftReject );
       
   125     iSoftRejectSubscriber->Subscribe();
       
   126     iUipIndSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsUipInd );
       
   127     iUipIndSubscriber->Subscribe();
       
   128     iMessageToneQuitSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit );
       
   129     iMessageToneQuitSubscriber->Subscribe();
       
   130     iNspsRawKeyEventSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsNspsRawKeyEvent );
       
   131     iNspsRawKeyEventSubscriber->Subscribe();
       
   132     iLightsRawKeyEventSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsLightsRawKeyEvent );
       
   133     iLightsRawKeyEventSubscriber->Subscribe();
       
   134     iMmcRemovedWithoutEjectSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsMmcRemovedWithoutEject );
       
   135     iMmcRemovedWithoutEjectSubscriber->Subscribe();
       
   136     iNewEmailStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsNewEmailStatus );
       
   137     iNewEmailStatusSubscriber->Subscribe();
       
   138     iAutolockStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus );
       
   139     iAutolockStatusSubscriber->Subscribe();
       
   140     iPoCIndicatorSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsPoCIndicator );
       
   141     iPoCIndicatorSubscriber->Subscribe();
       
   142     iPoCMissedIndicatorSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsPoCMissedIndicator );
       
   143     iPoCMissedIndicatorSubscriber->Subscribe();
       
   144     iTarmStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator );
       
   145     iTarmStatusSubscriber->Subscribe();
       
   146     iMtvRecStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsMtvRecStatus );
       
   147     iMtvRecStatusSubscriber->Subscribe();
       
   148     iMtvDvbhStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsMtvDvbhStatus );
       
   149     iMtvDvbhStatusSubscriber->Subscribe();
       
   150     
       
   151     // Category KPSUidWlan
       
   152     iWlanIndicatorSubscriber = CSysApSubscriber::NewL( *this, KPSUidWlan, KPSWlanIndicator );
       
   153     iWlanIndicatorSubscriber->Subscribe();
       
   154 
       
   155     // KPSUidCtsyCallInformation
       
   156     iCallInfoSubscriber = CSysApSubscriber::NewL( *this, KPSUidCtsyCallInformation, KCTsyCallState );
       
   157     iCallInfoSubscriber->Subscribe();
       
   158 
       
   159     // Category KPSUidNetworkInfo
       
   160     iHomeZoneStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidNetworkInfo, KNWHomeZoneStatus ); 
       
   161     iHomeZoneStatusSubscriber->Subscribe();
       
   162     iNetworkModeSubscriber = CSysApSubscriber::NewL( *this, KPSUidNetworkInfo, KNWTelephonyNetworkMode );
       
   163     iNetworkModeSubscriber->Subscribe();
       
   164 
       
   165     // Category KPSUidHWRM
       
   166     iFlipStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidHWRM, KHWRMFlipStatus );
       
   167     iFlipStatusSubscriber->Subscribe();
       
   168     
       
   169     if ( iSysApAppUi.SysApFeatureManager().FmTxSupported() )
       
   170         {
       
   171         // Category KHWRMFmTxStatus
       
   172         iFmTxStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidHWRMFmTx, KHWRMFmTxStatus );
       
   173         iFmTxStatusSubscriber->Subscribe();
       
   174         iPreviousFmTxPSValue = EFmTxStateUnknown;    
       
   175         }
       
   176 
       
   177     iSyncStatusSubscriber = CSysApSubscriber::NewL( *this, KPSUidDataSynchronizationInternalKeys, KDataSyncStatus );
       
   178     iSyncStatusSubscriber->Subscribe();
       
   179     
       
   180     iVideoSharingIndicatorSubscriber = CSysApSubscriber::NewL( *this, KPSUidCoreApplicationUIs, KCoreAppUIsVideoSharingIndicator );
       
   181     iVideoSharingIndicatorSubscriber->Subscribe();
       
   182     
       
   183     iGpsIndicatorSubscriber = CSysApSubscriber::NewL( *this, KPosIndicatorCategoryUid, KPosIntGpsHwStatus );
       
   184     iGpsIndicatorSubscriber->Subscribe();
       
   185 
       
   186     iSmsPhoneStoreSubscriber = CSysApSubscriber::NewL( *this, KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey );
       
   187     iSmsPhoneStoreSubscriber->Subscribe();
       
   188     }
       
   189 
       
   190 // ----------------------------------------------------------------------------
       
   191 // CSysApPubSubObserver::~CSysApPubSubObserver() 
       
   192 // ----------------------------------------------------------------------------
       
   193 
       
   194 CSysApPubSubObserver::~CSysApPubSubObserver()
       
   195     {
       
   196     delete iAutolockStatusSubscriber;
       
   197     delete iBatteryBarsSubscriber;
       
   198     delete iBatteryLowIndicationSubscriber;
       
   199     delete iBatteryCStatusSubscriber;
       
   200     delete iChargerCStatusSubscriber; 
       
   201     delete iCallInfoSubscriber;
       
   202     delete iInboxStatusSubscriber;
       
   203     delete iOutboxStatusSubscriber; 
       
   204     delete iIrdaStatusSubscriber;
       
   205     delete iGprsStatusSubscriber; 
       
   206     delete iWcdmaStatusSubscriber;
       
   207     delete iHomeZoneStatusSubscriber;
       
   208     delete iNewEmailStatusSubscriber; 
       
   209     delete iLocationGlobalPrivacySubscriber;
       
   210     delete iRestoreBackupSubscriber;
       
   211     delete iPoCIndicatorSubscriber;
       
   212     delete iPoCMissedIndicatorSubscriber;
       
   213     delete iTarmStatusSubscriber;
       
   214     delete iMtvRecStatusSubscriber;
       
   215     delete iMtvDvbhStatusSubscriber;
       
   216     delete iSimChangedSubscriber;
       
   217     delete iWakeupAlarmSubscriber;
       
   218     delete iAlarmLightSubscriber;
       
   219     delete iVTLightsSubscriber; 
       
   220     delete iSSLightsSubscriber;
       
   221     delete iATCLightsSubscriber;
       
   222     delete iLightsControlSubscriber;
       
   223     delete iDisableKeyguardSubscriber;
       
   224     delete iSoftRejectSubscriber;
       
   225     delete iUipIndSubscriber;
       
   226     delete iMessageToneQuitSubscriber;
       
   227     delete iNspsRawKeyEventSubscriber;
       
   228     delete iLightsRawKeyEventSubscriber;
       
   229     delete iMmcRemovedWithoutEjectSubscriber;
       
   230     delete iNetworkModeSubscriber;
       
   231     delete iWlanIndicatorSubscriber;
       
   232     delete iFlipStatusSubscriber;
       
   233     delete iFmTxStatusSubscriber;
       
   234     delete iFmTxRemConObserver;
       
   235     delete iSyncStatusSubscriber;
       
   236     delete iVideoSharingIndicatorSubscriber;
       
   237     delete iGpsIndicatorSubscriber;
       
   238     delete iSmsPhoneStoreSubscriber;
       
   239     }
       
   240 
       
   241 
       
   242 // ----------------------------------------------------------------------------
       
   243 // CSysApPubSubObserver::HandlePropertyChangedL()
       
   244 // ----------------------------------------------------------------------------
       
   245 void CSysApPubSubObserver::HandlePropertyChangedL( const TUid& aCategory, const TUint aKey )
       
   246     {
       
   247     TInt value( 0 );
       
   248     RProperty::Get( aCategory, aKey, value );
       
   249 
       
   250 #ifdef _DEBUG
       
   251 
       
   252     HBufC* hbuf = HBufC::New( 120 );
       
   253 
       
   254     if ( hbuf )
       
   255         {
       
   256         TPtr buf = hbuf->Des();
       
   257 
       
   258         buf = _L("CSysApPubSubObserver::HandlePropertyChangedL: category=0x");
       
   259         buf.AppendNumFixedWidth( aCategory.iUid, EHex, 8 );
       
   260         buf.Append( _L(", key=0x") );
       
   261         buf.AppendNumFixedWidth( aKey, EHex, 8 );
       
   262         buf.Append( _L(", value=") );
       
   263         buf.AppendNum( value );
       
   264 
       
   265         RDebug::Print( buf );
       
   266         delete hbuf;
       
   267         }
       
   268 
       
   269 #endif
       
   270 
       
   271     // KIrdaPropertyCategory is actually defined as KUidSystemCategory, but just in case this ever changes,
       
   272     // check them separately here. The keys should have no overlap.
       
   273     if ( aCategory == KUidSystemCategory || aCategory == KIrdaPropertyCategory )
       
   274         {
       
   275         HandleSystemCategoryL( aKey, value );
       
   276         }
       
   277     else if ( aCategory == KPSUidStartup || aCategory == KAlarmServerPubSubCategory )
       
   278         {
       
   279         HandleStartupCategoryL( aKey, value );
       
   280         }
       
   281     else if ( aCategory == KPSUidCoreApplicationUIs )
       
   282         {
       
   283         HandleCoreAppUIsCategoryL( aKey, value );
       
   284         }
       
   285     else if ( aCategory == KPSUidHWRMPowerState )
       
   286         {
       
   287         HandleHwrmPowerStateCategoryL( aKey, value );
       
   288         }
       
   289     else if ( aCategory == KPSUidWlan )
       
   290         {
       
   291         HandleWlanCategoryL( aKey, value );
       
   292         }
       
   293     else if ( aCategory == KPSUidCtsyCallInformation )
       
   294         {
       
   295         HandleTelephonyCallInformationCategoryL( aKey, value );
       
   296         }
       
   297     else if ( aCategory == KPSUidNetworkInfo )
       
   298         {
       
   299         HandleNetworkInfoCategoryL( aKey, value );
       
   300         }
       
   301     else if ( aCategory == KPSUidHWRM )
       
   302         {
       
   303         HandleHwrmCategoryL( aKey, value );
       
   304         }
       
   305     else if ( aCategory == KPSUidHWRMFmTx )
       
   306         {
       
   307         HandleHwrmFmTxCategoryL( aKey, value );
       
   308         }
       
   309     else if ( aCategory == KPSUidDataSynchronizationInternalKeys )
       
   310         {
       
   311         HandleDataSyncCategoryL( aKey, value );
       
   312         }
       
   313     else if ( aCategory == KPosIndicatorCategoryUid )
       
   314         {
       
   315         HandlePosIndicatorCategoryL( aKey, value );
       
   316         }
       
   317     else if ( aCategory == KUidPSSMSStackCategory )
       
   318         {
       
   319         HandleSmsStackCategoryL( aKey, value );
       
   320         }
       
   321     }
       
   322 // ----------------------------------------------------------------------------
       
   323 // CSysApPubSubObserver::HandleCoreAppUIsCategoryL()
       
   324 // ----------------------------------------------------------------------------
       
   325 void CSysApPubSubObserver::HandleCoreAppUIsCategoryL( const TUint aKey, const TInt aValue )
       
   326     {
       
   327     switch ( aKey )
       
   328         {
       
   329         case KLightsAlarmLightActive:
       
   330             if ( aValue == ELightsBlinking )
       
   331                 {
       
   332                 iSysApAppUi.AlertUiAlertingL( ETrue );
       
   333                 }
       
   334             else if ( aValue == ELightsNotBlinking )
       
   335                 {
       
   336                 iSysApAppUi.AlertUiAlertingL( EFalse );
       
   337                 }
       
   338             break;
       
   339         case KLightsVTForcedLightsOn:
       
   340             iSysApAppUi.HandleForcedLightsVTRequireL( aValue );
       
   341             break;
       
   342         case KLightsSSForcedLightsOn:
       
   343             iSysApAppUi.HandleForcedLightsSSRequireL( aValue );
       
   344             break;
       
   345         case KLightsATCForcedLightsOn: 
       
   346               iSysApAppUi.HandleForcedLightsATCRequireL( aValue ); 
       
   347               break; 
       
   348         case KLightsControl:
       
   349             iSysApAppUi.HandleLightsRequireL();
       
   350             break;
       
   351         case KCoreAppUIsDisableKeyguard:
       
   352             iSysApAppUi.AlertUiKeyLockOff( aValue == ECoreAppUIsDisableKeyguard );
       
   353             break;
       
   354         case KCoreAppUIsSoftReject:
       
   355             if ( aValue == ECoreAppUIsSoftReject )
       
   356                 {
       
   357                 iSysApAppUi.DoNotEnableKeylock();
       
   358                 iSysApAppUi.SwitchLightsOnSoftRejectL();
       
   359                 }
       
   360             break;
       
   361         case KCoreAppUIsUipInd:
       
   362             if ( aValue == ECoreAppUIsDoNotShow )
       
   363                 {
       
   364                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorInstantMessage, EAknIndicatorStateOff ); 
       
   365                 }
       
   366             else if ( aValue == ECoreAppUIsShow )
       
   367                 {
       
   368                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorInstantMessage, EAknIndicatorStateOn ); 
       
   369                 }
       
   370             break;
       
   371         case KCoreAppUIsMessageToneQuit:
       
   372             iSysApAppUi.HandleMessageTonePlayingQuitability( aValue );
       
   373             break;
       
   374         case KCoreAppUIsNspsRawKeyEvent:
       
   375             iSysApAppUi.HandleNspsRawKeyEventL();
       
   376             break;
       
   377         case KCoreAppUIsLightsRawKeyEvent:
       
   378             if ( aValue == ECoreAppUIsKeyEvent )
       
   379                 {
       
   380                 iSysApAppUi.HandleRawKeyEventLightsRequireL();
       
   381                 }
       
   382             break;
       
   383         case KCoreAppUIsMmcRemovedWithoutEject:
       
   384             {
       
   385             TUint cmd( aValue & KCoreAppUIsMmcRemovedWithoutEjectCmdMask );
       
   386             if ( cmd == ECoreAppUIsEjectCommandUsed )
       
   387                 {
       
   388                 iSysApAppUi.EjectStarted( ETrue );
       
   389                 }
       
   390             else if ( cmd == ECoreAppUIsEjectCommandNotUsed )
       
   391                 {
       
   392                 iSysApAppUi.EjectStarted( EFalse );
       
   393                 }
       
   394             else if ( cmd == ECoreAppUIsEjectCommandUsedToDrive )
       
   395                 {
       
   396                 TInt drive( aValue >> KCoreAppUIsMmcRemovedWithoutEjectValShift );
       
   397                 iSysApAppUi.EjectUsed( drive );
       
   398                 }
       
   399             break;
       
   400             }
       
   401         case KCoreAppUIsNewEmailStatus:
       
   402             if ( aValue == ECoreAppUIsNewEmail )
       
   403                 {
       
   404                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorEmailMessage, EAknIndicatorStateOn );
       
   405                 }
       
   406             else if ( aValue == ECoreAppUIsNoNewEmail )
       
   407                 {
       
   408                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorEmailMessage, EAknIndicatorStateOff );
       
   409                 }
       
   410             break;
       
   411 
       
   412         case KCoreAppUIsAutolockStatus:
       
   413             if ( aValue == EAutolockOff )
       
   414                 {
       
   415                 iSysApAppUi.SetDeviceLockEnabledL( EFalse );
       
   416                 }
       
   417             else if ( aValue > EAutolockOff ) // we are not interested in why autolock is enabled
       
   418                 {
       
   419                 iSysApAppUi.SetDeviceLockEnabledL( ETrue );
       
   420                 }
       
   421             break;
       
   422 
       
   423         case KCoreAppUIsPoCIndicator:
       
   424             if ( aValue == ECoreAppUIsPocIndicatorOff || aValue == ECoreAppUIsPocIndicatorUninitialized )
       
   425                 {
       
   426                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoC, EAknIndicatorStateOff );
       
   427                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoCDnD, EAknIndicatorStateOff );
       
   428                 }
       
   429             else if ( aValue == ECoreAppUIsPocIndicatorDoNotDisturb )
       
   430                 {
       
   431                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoC, EAknIndicatorStateOff );
       
   432                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoCDnD, EAknIndicatorStateOn );
       
   433                 }
       
   434             else if ( aValue == ECoreAppUIsPocIndicatorConnectionOn )
       
   435                 {
       
   436                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoC, EAknIndicatorStateOn );
       
   437                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoCDnD, EAknIndicatorStateOff );
       
   438                 }
       
   439             break;
       
   440         case KCoreAppUIsPoCMissedIndicator:
       
   441             if ( aValue == ECoreAppUIsPocMissedIndicatorOff || aValue == ECoreAppUIsPocMissedIndicatorUninitialized )
       
   442                 {
       
   443                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoCMissed, EAknIndicatorStateOff );
       
   444                 }
       
   445             else if ( aValue == ECoreAppUIsPocMissedIndicatorOn )
       
   446                 {
       
   447                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorPoCMissed, EAknIndicatorStateOn );
       
   448                 }
       
   449             break;
       
   450             
       
   451         case KCoreAppUIsTarmIndicator:
       
   452             iSysApAppUi.HandleTarmIndicatorL( aValue );
       
   453             break;
       
   454 
       
   455         case KCoreAppUIsMtvRecStatus:
       
   456             if ( aValue == ECoreAppUIsMtvRecStatusOn  )
       
   457                 {
       
   458                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorMobileTVRec, EAknIndicatorStateOn );
       
   459                 }
       
   460             else if ( aValue == ECoreAppUIsMtvRecStatusOff || aValue == ECoreAppUIsMtvRecStatusUninitialized )
       
   461                 {
       
   462                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorMobileTVRec, EAknIndicatorStateOff );
       
   463                 }
       
   464             break;
       
   465 
       
   466         case KCoreAppUIsMtvDvbhStatus:
       
   467             if ( aValue == ECoreAppUIsMtvDvbhStatusOn )
       
   468                 {
       
   469                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorMobileTV, EAknIndicatorStateOn );
       
   470                 }
       
   471             else if ( aValue == ECoreAppUIsMtvDvbhStatusOff || aValue == ECoreAppUIsMtvDvbhStatusUninitialized )
       
   472                 {
       
   473                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorMobileTV, EAknIndicatorStateOff );
       
   474                 }
       
   475             break;
       
   476         
       
   477         case KCoreAppUIsVideoSharingIndicator:
       
   478             if ( aValue == ECoreAppUIsVideoSharingIndicatorOn )
       
   479                 {
       
   480                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorVideoSharing, EAknIndicatorStateOn );
       
   481                 }
       
   482             else if ( aValue == ECoreAppUIsVideoSharingIndicatorOff || aValue == ECoreAppUIsVideoSharingIndicatorUninitialized )
       
   483                 {
       
   484                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorVideoSharing, EAknIndicatorStateOff );
       
   485                 }
       
   486             break;
       
   487 
       
   488         default:
       
   489             break;
       
   490         }
       
   491     }
       
   492 
       
   493 // ----------------------------------------------------------------------------
       
   494 // CSysApPubSubObserver::HandleStartupCategoryL()
       
   495 // ----------------------------------------------------------------------------
       
   496 void CSysApPubSubObserver::HandleStartupCategoryL( const TUint aKey, const TInt aValue )
       
   497     {
       
   498     switch ( aKey )
       
   499         {
       
   500         case KPSSimOwned:
       
   501             if ( aValue == ESimNotOwned )
       
   502                 { 
       
   503                 TRAPD( simChangedErr, iSysApAppUi.DoSimChangedFromPreviousBootL() );
       
   504                 TRACES( RDebug::Print( _L("CSysApPubSubObserver::HandleStartupCategoryL: simChangedErr = %d" ), simChangedErr ) ); 
       
   505                 simChangedErr = simChangedErr; // suppress 'variable not used' warning 
       
   506                 }
       
   507             break;
       
   508             
       
   509         case KWakeupAlarmPubSubKey:
       
   510             {
       
   511             TRACES( RDebug::Print(_L("CSysApPubSubObserver::HandleStartupCategoryL called CSysApAppUi::ShowAlarmIndicatorL with aShowIndicator = %d "), (aValue == EActiveWakeupAlarmSet)));
       
   512             iSysApAppUi.ShowAlarmIndicatorL( aValue == EActiveWakeupAlarmSet );
       
   513             break;
       
   514             }
       
   515         default:
       
   516             break;
       
   517         }
       
   518     }
       
   519 
       
   520 // ----------------------------------------------------------------------------
       
   521 // CSysApPubSubObserver::HandleSystemCategoryL()
       
   522 // ----------------------------------------------------------------------------
       
   523 void CSysApPubSubObserver::HandleSystemCategoryL( const TUint aKey, const TInt aValue )
       
   524     {
       
   525     switch ( aKey )
       
   526         {
       
   527         case KUidInboxStatusValue:
       
   528             iSysApAppUi.SetEnvelopeIndicatorL();
       
   529             break;
       
   530 
       
   531         case KUidOutboxStatusValue:
       
   532             if ( aValue == ESADocumentsInOutbox )
       
   533                 {
       
   534                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorOutbox, EAknIndicatorStateOn );
       
   535                 }
       
   536             //Hide the Outbox indicator
       
   537             else if ( aValue == ESAOutboxEmpty )
       
   538                 {
       
   539                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorOutbox, EAknIndicatorStateOff );
       
   540                 }
       
   541             break;
       
   542 
       
   543         case KIrdaStatus:
       
   544             if ( aValue == TIrdaStatusCodes::EIrLoaded || aValue == TIrdaStatusCodes::EIrBlocked || aValue == TIrdaStatusCodes::EIrDisconnected )
       
   545                 {
       
   546                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorIrActive, EAknIndicatorStateAnimate );
       
   547                 }
       
   548             else if ( aValue == TIrdaStatusCodes::EIrConnected )
       
   549                 {
       
   550                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorIrActive, EAknIndicatorStateOn );
       
   551                 }
       
   552             else if ( aValue == TIrdaStatusCodes::EIrUnloaded )
       
   553                 {
       
   554                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorIrActive, EAknIndicatorStateOff );
       
   555                 }
       
   556             break;
       
   557 
       
   558         case KPSUidGprsStatusValue:
       
   559         case KPSUidWcdmaStatusValue:        
       
   560             iSysApAppUi.SetSignalIndicatorL();
       
   561             break;
       
   562 
       
   563         case KPSUidLocationGlobalPrivacyValue:
       
   564             iSysApAppUi.HandleLocationPrivacyIndicatorL( aValue );
       
   565             break;
       
   566 
       
   567         case conn::KUidBackupRestoreKey:
       
   568             {            
       
   569             conn::TBURPartType partType = static_cast< conn::TBURPartType >( aValue & conn::KBURPartTypeMask );
       
   570 
       
   571             if ( partType == conn::EBURRestoreFull || partType == conn::EBURRestorePartial )
       
   572                 {
       
   573                 iRestoreOngoing = ETrue;
       
   574                 }
       
   575             else if ( iRestoreOngoing )
       
   576                 {
       
   577                 TRACES( RDebug::Print( _L("CSysApPubSubObserver::HandleSystemCategoryL: restore finished, make the device reset" ) ) ); 
       
   578                 User::After( 1000000 );
       
   579                 iSysApAppUi.ShowQueryL( ESysApRestartPhoneQuery );   
       
   580                 }
       
   581             }
       
   582             break;
       
   583             
       
   584         default:
       
   585             break;
       
   586         } 
       
   587     }
       
   588 
       
   589 // ----------------------------------------------------------------------------
       
   590 // CSysApPubSubObserver::HandleHwrmPowerStateCategoryL()
       
   591 // ----------------------------------------------------------------------------
       
   592 void CSysApPubSubObserver::HandleHwrmPowerStateCategoryL( const TUint aKey, const TInt aValue )
       
   593     {
       
   594     switch ( aKey )
       
   595         {
       
   596         case KHWRMBatteryLevel:
       
   597             iSysApAppUi.UpdateBatteryBarsL( aValue );
       
   598             break;
       
   599         
       
   600         case KHWRMBatteryStatus:
       
   601             iSysApAppUi.HandleBatteryStatusL( aValue );            
       
   602             break;
       
   603     
       
   604         case KHWRMChargingStatus:
       
   605             iSysApAppUi.HandleChargingStatusL( aValue );           
       
   606             break;
       
   607 
       
   608         default:
       
   609             break;
       
   610         } 
       
   611     }
       
   612 
       
   613 // ----------------------------------------------------------------------------
       
   614 // CSysApPubSubObserver::HandleHwrmFmTxCategoryL()
       
   615 // ----------------------------------------------------------------------------
       
   616 void CSysApPubSubObserver::HandleHwrmFmTxCategoryL( const TUint aKey, 
       
   617                                                     const TInt aValue )
       
   618     {
       
   619 	TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL aKey %d, aValue %d"), aKey, aValue));
       
   620     	
       
   621     if ( aKey == KHWRMFmTxStatus )
       
   622         {
       
   623         TBool isFmTxTurnedOn( EFalse );
       
   624         TBool isFmTxTurnedOff( EFalse );
       
   625         
       
   626         const TInt KFmTxNotSendingIndicator( EAknIndicatorFMTxEnabled );
       
   627         const TInt KFmTxActiveIndicator( EAknIndicatorFMTxSending );
       
   628             
       
   629 		TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL aKey = KHWRMFmTxStatus, iPreviousFmTxPSValue = %d"), iPreviousFmTxPSValue));            
       
   630             
       
   631         switch ( iPreviousFmTxPSValue )
       
   632             {
       
   633             // Previous "On" states
       
   634             case EFmTxStateActive:
       
   635             case EFmTxStateInactive:         
       
   636             case EFmTxStateScanning: // equivalent to EFmTxStateInactive for UI purposes                                                  
       
   637                             
       
   638                 if ( aValue == EFmTxStateUnknown || aValue == EFmTxStateOff || 
       
   639                      aValue == EFmTxStatePowerSaveInactivity || aValue == EFmTxStatePowerSaveAccessory  )
       
   640                     {
       
   641                     // Active/Inactive -> Off state                    
       
   642                     TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL Active/Inactive -> Off transition")));
       
   643                     
       
   644     	            // turn any FM TX indicators off
       
   645 	                iSysApAppUi.SetIndicatorStateL( KFmTxActiveIndicator, EAknIndicatorStateOff );
       
   646 	                iSysApAppUi.SetIndicatorStateL( KFmTxNotSendingIndicator, EAknIndicatorStateOff );
       
   647                     
       
   648                     // give notification
       
   649                     if ( aValue == EFmTxStatePowerSaveAccessory )
       
   650                     	{
       
   651                     	iSysApAppUi.ShowUiNoteL( EFmTxAccessoryStandbyNote );
       
   652                     	}
       
   653                     else
       
   654                     	{
       
   655                     	iSysApAppUi.ShowUiNoteL( EFmTxOffNote );
       
   656                     	}
       
   657                     isFmTxTurnedOff = ETrue;                                                                           	
       
   658                     }
       
   659                 else if ( aValue == EFmTxStateInactive || aValue == EFmTxStateScanning )
       
   660                     {
       
   661                     // Active -> Inactive
       
   662                     TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL Active -> Inactive transition")));
       
   663                    
       
   664                     // enable not sending indicator
       
   665 	                iSysApAppUi.SetIndicatorStateL( KFmTxActiveIndicator, EAknIndicatorStateOff );                      
       
   666                     iSysApAppUi.SetIndicatorStateL( KFmTxNotSendingIndicator, EAknIndicatorStateOn );                  
       
   667                     }
       
   668                 else if ( aValue == EFmTxStateActive )
       
   669                     {
       
   670                     // Inactive -> Active
       
   671                     TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL Inactive -> Active transition")));
       
   672                     
       
   673                     // enable active indicator
       
   674                     iSysApAppUi.SetIndicatorStateL( KFmTxNotSendingIndicator, EAknIndicatorStateOff );    
       
   675                     iSysApAppUi.SetIndicatorStateL( KFmTxActiveIndicator, EAknIndicatorStateOn );					                
       
   676                     }    
       
   677         
       
   678                 break;    
       
   679  
       
   680 			// Previous "Off" states       
       
   681             case EFmTxStateUnknown:			 
       
   682             case EFmTxStateOff:			 
       
   683             case EFmTxStatePowerSaveInactivity:
       
   684             case EFmTxStatePowerSaveAccessory:            
       
   685                                                                                        
       
   686                 if ( aValue == EFmTxStateActive )
       
   687                     {
       
   688                     // Off -> Active
       
   689                     TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL Off -> Active transition")));
       
   690                                         
       
   691                     // enable active indicator
       
   692                     iSysApAppUi.SetIndicatorStateL( KFmTxNotSendingIndicator, EAknIndicatorStateOff );   
       
   693                     iSysApAppUi.SetIndicatorStateL( KFmTxActiveIndicator, EAknIndicatorStateOn );					                  
       
   694                     
       
   695                     // give notification
       
   696                     iSysApAppUi.ShowUiNoteL( EFmTxOnNote );
       
   697                     isFmTxTurnedOn = ETrue;
       
   698                     }
       
   699                 else if ( aValue == EFmTxStateInactive || aValue == EFmTxStateScanning )
       
   700                 	{
       
   701                 	// Off -> Inactive
       
   702                 	TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL Off -> Inactive transition")));
       
   703                 	
       
   704                     // enable not sending indicator
       
   705 	                iSysApAppUi.SetIndicatorStateL( KFmTxActiveIndicator, EAknIndicatorStateOff );                      
       
   706                     iSysApAppUi.SetIndicatorStateL( KFmTxNotSendingIndicator, EAknIndicatorStateOn );                      	
       
   707                     
       
   708                     // give notification
       
   709                     iSysApAppUi.ShowUiNoteL( EFmTxOnNote );
       
   710                     isFmTxTurnedOn = ETrue;
       
   711                 	}                
       
   712                 break;                
       
   713                             
       
   714             }
       
   715             
       
   716         if ( isFmTxTurnedOn )
       
   717             {
       
   718             if ( !iFmTxRemConObserver )
       
   719                 {
       
   720                 // create observer which captures volume keys
       
   721                 iFmTxRemConObserver = CSysApRemConObserver::NewL( iSysApAppUi );
       
   722                 }
       
   723 
       
   724 
       
   725             if ( iSysApAppUi.SysApFeatureManager().FmTxRdsTextSupported() )
       
   726                 {
       
   727                 _LIT( KRdsObserverExe, "RDSEventObserver.exe" );
       
   728                 
       
   729                 RProcess process;
       
   730                 TInt error = process.Create( KRdsObserverExe, KNullDesC );
       
   731                 
       
   732                 if ( error == KErrNone )
       
   733                     {
       
   734                     process.Resume();
       
   735                     }
       
   736                 else
       
   737                     {
       
   738                     TRACES(RDebug::Print(_L("CSysApPubSubObserver::HandleHwrmFmTxCategoryL: error=%d"), error ) );
       
   739                     }
       
   740                 
       
   741                 process.Close();
       
   742                 }
       
   743         
       
   744             }
       
   745         else if ( isFmTxTurnedOff )
       
   746             {
       
   747             delete iFmTxRemConObserver;
       
   748             iFmTxRemConObserver = NULL;
       
   749             }
       
   750         iPreviousFmTxPSValue = aValue;
       
   751         }
       
   752     }
       
   753 
       
   754 // ----------------------------------------------------------------------------
       
   755 // CSysApPubSubObserver::HandleWlanCategoryL()
       
   756 // ----------------------------------------------------------------------------
       
   757 void CSysApPubSubObserver::HandleWlanCategoryL( const TUint aKey, const TInt aValue )
       
   758     {
       
   759     switch ( aKey )
       
   760         {
       
   761         case KPSWlanIndicator:
       
   762             iSysApAppUi.HandleWlanIndicatorL(aValue);
       
   763             break;        
       
   764 
       
   765         default:
       
   766             break;
       
   767         } 
       
   768     }
       
   769 
       
   770 // ----------------------------------------------------------------------------
       
   771 // CSysApPubSubObserver::HandleTelephonyCallInformationCategoryL()
       
   772 // ----------------------------------------------------------------------------
       
   773 void CSysApPubSubObserver::HandleTelephonyCallInformationCategoryL( const TUint aKey, const TInt aValue )
       
   774     {
       
   775     switch ( aKey )
       
   776         {
       
   777         case KCTsyCallState:
       
   778             iSysApAppUi.HandleCurrentCallStateChangeL( aValue );
       
   779             break;
       
   780         
       
   781         default:
       
   782             break;            
       
   783         }
       
   784     }
       
   785 
       
   786 // ----------------------------------------------------------------------------
       
   787 // CSysApPubSubObserver::HandleNetworkInfoCategoryL()
       
   788 // ----------------------------------------------------------------------------
       
   789 void CSysApPubSubObserver::HandleNetworkInfoCategoryL( const TUint aKey, const TInt aValue )
       
   790     {
       
   791     switch ( aKey )
       
   792         {
       
   793         case KNWHomeZoneStatus:
       
   794             if ( aValue == ENWHomeZone )
       
   795                 {
       
   796                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorHomeZone, EAknIndicatorStateOn );
       
   797                 }
       
   798             else if ( aValue == ENWNone || aValue == ENWCityZone )
       
   799                 {
       
   800                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorHomeZone, EAknIndicatorStateOff );
       
   801                 }
       
   802             break; 
       
   803 
       
   804         case KNWTelephonyNetworkMode:
       
   805             iSysApAppUi.SetSignalIndicatorL();
       
   806             break;
       
   807 
       
   808         default:
       
   809             break;
       
   810         } 
       
   811     }
       
   812 
       
   813 // ----------------------------------------------------------------------------
       
   814 // CSysApPubSubObserver::HandleHwrmCategoryL()
       
   815 // ----------------------------------------------------------------------------
       
   816 void CSysApPubSubObserver::HandleHwrmCategoryL( const TUint aKey, const TInt aValue )
       
   817     {
       
   818     switch ( aKey )
       
   819         {
       
   820         case KHWRMFlipStatus:
       
   821             if ( aValue == EPSHWRMFlipClosed )
       
   822                 {
       
   823                 iSysApAppUi.SimulateFlipKeyEventL( EFalse );
       
   824                 }
       
   825             else if ( aValue == EPSHWRMFlipOpen )
       
   826                 {
       
   827                 iSysApAppUi.SimulateFlipKeyEventL( ETrue );
       
   828                 }
       
   829             break; 
       
   830 
       
   831         default:
       
   832             break;
       
   833         } 
       
   834     }
       
   835 
       
   836 // ----------------------------------------------------------------------------
       
   837 // CSysApPubSubObserver::HandleDataSyncCategoryL()
       
   838 // ----------------------------------------------------------------------------
       
   839 void CSysApPubSubObserver::HandleDataSyncCategoryL( const TUint aKey, const TInt aValue )
       
   840     {
       
   841     switch ( aKey )
       
   842         {
       
   843         case KDataSyncStatus:
       
   844             if ( aValue > EDataSyncNotRunning )
       
   845                 {
       
   846                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorSynchronization , EAknIndicatorStateOn );
       
   847                 }
       
   848             else
       
   849                 {
       
   850                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorSynchronization, EAknIndicatorStateOff );
       
   851                 }
       
   852             break;
       
   853         
       
   854         default:
       
   855             break;        
       
   856         }
       
   857         
       
   858     }
       
   859 
       
   860 // ----------------------------------------------------------------------------
       
   861 // CSysApPubSubObserver::HandlePosIndicatorCategoryL()
       
   862 // ----------------------------------------------------------------------------
       
   863 void CSysApPubSubObserver::HandlePosIndicatorCategoryL( const TUint aKey, const TInt aValue )
       
   864     {
       
   865     switch ( aKey )
       
   866         {
       
   867         case KPosIntGpsHwStatus:
       
   868             if ( aValue == EPosIntGpsHwOff )
       
   869                 {
       
   870                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorGPS, EAknIndicatorStateOff );
       
   871                 }
       
   872             else if ( aValue == EPosIntGpsHwOn )    
       
   873                 {
       
   874                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorGPS, EAknIndicatorStateOn );
       
   875                 }
       
   876             else if ( aValue == EPosIntGpsHwIntermediate )
       
   877                 {
       
   878                 iSysApAppUi.SetIndicatorStateL( EAknIndicatorGPS, EAknIndicatorStateAnimate );
       
   879                 }
       
   880             break;
       
   881         
       
   882         default:
       
   883             break;
       
   884         }
       
   885     }
       
   886 
       
   887 // ----------------------------------------------------------------------------
       
   888 // CSysApPubSubObserver::HandleSmsStackCategoryL()
       
   889 // ----------------------------------------------------------------------------
       
   890 
       
   891 void CSysApPubSubObserver::HandleSmsStackCategoryL( const TUint aKey, const TInt /*aValue*/ )
       
   892     {
       
   893     switch ( aKey )
       
   894         {
       
   895         case KUidPSSMSStackDiskSpaceMonitorKey:
       
   896             iSysApAppUi.SetEnvelopeIndicatorL();
       
   897             break;
       
   898 
       
   899         default:
       
   900             break;
       
   901         }
       
   902     }
       
   903 
       
   904 // End of File
       
   905 
       
   906 
       
   907