satengine/SatServer/SystemState/src/CSatSystemState.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
    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 
       
    20 #include    <mtclreg.h>
    19 #include    <mtclreg.h>
    21 #include    <smsclnt.h>
    20 #include    <smsclnt.h>
    22 #include    <smutset.h>
    21 #include    <smutset.h>
    23 #include    <PSVariables.h>             // Publish & Suscribe keys
    22 #include    <PSVariables.h>             // Publish & Suscribe keys
    24 #include    <centralrepository.h>       // CRepository
    23 #include    <centralrepository.h>       // CRepository
    25 #include    <CommonEngineDomainCRKeys.h>
    24 #include    <CommonEngineDomainCRKeys.h>
    26 #include    <ProfileEngineSDKCRKeys.h>
    25 #include    <ProfileEngineSDKCRKeys.h>
    27 #include    <settingsinternalcrkeys.h>
    26 #include    <settingsinternalcrkeys.h>
    28 #include    <satdomainpskeys.h>
    27 #include    <satdomainpskeys.h>
    29 #define Q_OS_SYMBIAN // needed to activate homescreendomainpskeys.h
    28 #include    <activeidle2domainpskeys.h>
    30 #include    <homescreendomainpskeys.h>
    29 #include    <ScreensaverInternalPSKeys.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 // ******************************************************************
       
    37 #include    <ctsydomainpskeys.h>
    30 #include    <ctsydomainpskeys.h>
    38 #include    <sbdefs.h>
    31 #include    <sbdefs.h>
    39 #include    <BTSapDomainPSKeys.h>
    32 #include    <BTSapDomainPSKeys.h>
    40 
    33 
    41 #include    "SATInternalPSKeys.h"
    34 #include    "SATInternalPSKeys.h"
   274 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   275 //
   268 //
   276 TBool CSatSystemState::IsPhoneInIdleStateL()
   269 TBool CSatSystemState::IsPhoneInIdleStateL()
   277     {
   270     {
   278     LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" )
   271     LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" )
   279     TInt idleStatus(EHomeScreenIdleState) ;
   272     TInt idleStatus;
   280 
   273 
   281     // Get the idle status from P&S
   274     // Get the idle status from P&S
   282     User::LeaveIfError( RProperty::Get(
   275     User::LeaveIfError( RProperty::Get(
   283         KHsCategoryUid, 
   276         KPSUidAiInformation,
   284         KHsCategoryStateKey, 
   277         KActiveIdleState,
   285         idleStatus));
   278         idleStatus ) );
   286     // Returns true if phone in idle state. 
   279 
   287     const TBool result( EHomeScreenIdleState == idleStatus ); 
   280     // Returns true if phone in idle state.
       
   281     const TBool result( EPSAiForeground == idleStatus );
   288 
   282 
   289     LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \
   283     LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \
   290         with value: %d", result )
   284         with value: %d", result )
   291     return result;
   285     return result;
   292     }
   286     }
   298 TBool CSatSystemState::IsScreenSaverActivedFromIdle()
   292 TBool CSatSystemState::IsScreenSaverActivedFromIdle()
   299     {
   293     {
   300     LOG( SIMPLE, 
   294     LOG( SIMPLE, 
   301     "SATSYSTEMSTATE: CSatSystemState::IsScreenSaverActivedFromIdle calling" )
   295     "SATSYSTEMSTATE: CSatSystemState::IsScreenSaverActivedFromIdle calling" )
   302     TBool result( EFalse );
   296     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 
       
   308     TInt screenSaverActive( -1 );
   297     TInt screenSaverActive( -1 );
   309 
   298 
   310     // Get the idle status from P&S
   299     // Get the idle status from P&S
   311     TInt err = RProperty::Get( KPSUidScreenSaver, 
   300     TInt err = RProperty::Get( KPSUidScreenSaver, 
   312         KScreenSaverActivatedFromIdle, screenSaverActive );
   301         KScreenSaverActivatedFromIdle, screenSaverActive );
   321         }
   310         }
   322 
   311 
   323     LOG2( SIMPLE, 
   312     LOG2( SIMPLE, 
   324         "SATSYSTEMSTATE: CSatSystemState:: IsScreenSaverActivedFromIdle \
   313         "SATSYSTEMSTATE: CSatSystemState:: IsScreenSaverActivedFromIdle \
   325          err: %d", err )
   314          err: %d", err )
   326     */
   315         
   327 
       
   328     LOG2( SIMPLE, 
   316     LOG2( SIMPLE, 
   329         "SATSYSTEMSTATE: CSatSystemState:: \
   317         "SATSYSTEMSTATE: CSatSystemState:: \
   330         IsScreenSaverActivedFromIdle exiting with value: %d", result )
   318         IsScreenSaverActivedFromIdle exiting with value: %d", result )
   331     return result;    
   319     return result;    
   332     }
   320     }