satengine/SatServer/SystemState/src/CSatSystemState.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
parent 8 ba42c4bd84dd
child 20 987c9837762f
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
    14 * Description:  Provides system state information to SAT Server
    14 * Description:  Provides system state information to SAT Server
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
       
    19 
    19 #include    <mtclreg.h>
    20 #include    <mtclreg.h>
    20 #include    <smsclnt.h>
    21 #include    <smsclnt.h>
    21 #include    <smutset.h>
    22 #include    <smutset.h>
    22 #include    <PSVariables.h>             // Publish & Suscribe keys
    23 #include    <PSVariables.h>             // Publish & Suscribe keys
    23 #include    <centralrepository.h>       // CRepository
    24 #include    <centralrepository.h>       // CRepository
    24 #include    <CommonEngineDomainCRKeys.h>
    25 #include    <CommonEngineDomainCRKeys.h>
    25 #include    <ProfileEngineSDKCRKeys.h>
    26 #include    <ProfileEngineSDKCRKeys.h>
    26 #include    <settingsinternalcrkeys.h>
    27 #include    <settingsinternalcrkeys.h>
    27 #include    <satdomainpskeys.h>
    28 #include    <satdomainpskeys.h>
    28 #include    <activeidle2domainpskeys.h>
    29 #define Q_OS_SYMBIAN // needed to activate homescreendomainpskeys.h
    29 #include    <ScreensaverInternalPSKeys.h>
    30 #include    <homescreendomainpskeys.h>
       
    31 
       
    32 // ******************************************************************
       
    33 // TODO: ScreensaverInternalPSKeys.h does no longer exist.
       
    34 // Must find an alternative way to check screen locked state.
       
    35 // #include    <ScreensaverInternalPSKeys.h>
       
    36 // ******************************************************************
    30 #include    <ctsydomainpskeys.h>
    37 #include    <ctsydomainpskeys.h>
    31 #include    <sbdefs.h>
    38 #include    <sbdefs.h>
    32 #include    <BTSapDomainPSKeys.h>
    39 #include    <BTSapDomainPSKeys.h>
    33 
    40 
    34 #include    "SATInternalPSKeys.h"
    41 #include    "SATInternalPSKeys.h"
   267 // -----------------------------------------------------------------------------
   274 // -----------------------------------------------------------------------------
   268 //
   275 //
   269 TBool CSatSystemState::IsPhoneInIdleStateL()
   276 TBool CSatSystemState::IsPhoneInIdleStateL()
   270     {
   277     {
   271     LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" )
   278     LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" )
   272     TInt idleStatus;
   279     TInt idleStatus(EHomeScreenIdleState) ;
   273 
   280 
   274     // Get the idle status from P&S
   281     // Get the idle status from P&S
   275     User::LeaveIfError( RProperty::Get(
   282     User::LeaveIfError( RProperty::Get(
   276         KPSUidAiInformation,
   283         KHsCategoryUid, 
   277         KActiveIdleState,
   284         KHsCategoryStateKey, 
   278         idleStatus ) );
   285         idleStatus));
   279 
   286     // Returns true if phone in idle state. 
   280     // Returns true if phone in idle state.
   287     const TBool result( EHomeScreenIdleState == idleStatus ); 
   281     const TBool result( EPSAiForeground == idleStatus );
       
   282 
   288 
   283     LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \
   289     LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \
   284         with value: %d", result )
   290         with value: %d", result )
   285     return result;
   291     return result;
   286     }
   292     }
   292 TBool CSatSystemState::IsScreenSaverActivedFromIdle()
   298 TBool CSatSystemState::IsScreenSaverActivedFromIdle()
   293     {
   299     {
   294     LOG( SIMPLE, 
   300     LOG( SIMPLE, 
   295     "SATSYSTEMSTATE: CSatSystemState::IsScreenSaverActivedFromIdle calling" )
   301     "SATSYSTEMSTATE: CSatSystemState::IsScreenSaverActivedFromIdle calling" )
   296     TBool result( EFalse );
   302     TBool result( EFalse );
       
   303 
       
   304     /*
       
   305     // TODO: This method can no longer be used for checking screen saver status.
       
   306     // Must find an alternative method.
       
   307 
   297     TInt screenSaverActive( -1 );
   308     TInt screenSaverActive( -1 );
   298 
   309 
   299     // Get the idle status from P&S
   310     // Get the idle status from P&S
   300     TInt err = RProperty::Get( KPSUidScreenSaver, 
   311     TInt err = RProperty::Get( KPSUidScreenSaver, 
   301         KScreenSaverActivatedFromIdle, screenSaverActive );
   312         KScreenSaverActivatedFromIdle, screenSaverActive );
   310         }
   321         }
   311 
   322 
   312     LOG2( SIMPLE, 
   323     LOG2( SIMPLE, 
   313         "SATSYSTEMSTATE: CSatSystemState:: IsScreenSaverActivedFromIdle \
   324         "SATSYSTEMSTATE: CSatSystemState:: IsScreenSaverActivedFromIdle \
   314          err: %d", err )
   325          err: %d", err )
   315         
   326     */
       
   327 
   316     LOG2( SIMPLE, 
   328     LOG2( SIMPLE, 
   317         "SATSYSTEMSTATE: CSatSystemState:: \
   329         "SATSYSTEMSTATE: CSatSystemState:: \
   318         IsScreenSaverActivedFromIdle exiting with value: %d", result )
   330         IsScreenSaverActivedFromIdle exiting with value: %d", result )
   319     return result;    
   331     return result;    
   320     }
   332     }