41 #include "SATInternalPSKeys.h" |
41 #include "SATInternalPSKeys.h" |
42 #include "CSatSystemState.h" |
42 #include "CSatSystemState.h" |
43 #include "msatmultimodeapi.h" |
43 #include "msatmultimodeapi.h" |
44 #include "SatLog.h" |
44 #include "SatLog.h" |
45 |
45 |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // Helper function to define a property and log result |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 TInt DefineProperty(TUid aCategory, TUint aKey, TInt aAttr, |
|
52 const TSecurityPolicy & aReadPolicy, const TSecurityPolicy& aWritePolicy) |
|
53 { |
|
54 TInt err = RProperty::Define( aCategory, aKey, aAttr, aReadPolicy, aWritePolicy ); |
|
55 LOG3( SIMPLE, |
|
56 "SATSYSTEMSTATE: CSatSystemState::ConstructL: property %d defined, err=%d", |
|
57 aKey, err); |
|
58 return err; |
|
59 } |
|
60 |
46 // ============================ MEMBER FUNCTIONS =============================== |
61 // ============================ MEMBER FUNCTIONS =============================== |
47 |
62 |
48 // ----------------------------------------------------------------------------- |
63 // ----------------------------------------------------------------------------- |
49 // C++ default constructor can NOT contain any code, that |
64 // C++ default constructor can NOT contain any code, that |
50 // might leave. |
65 // might leave. |
53 CSatSystemState::CSatSystemState( MSatMultiModeApi& aPhone ) : iPhone( aPhone ) |
68 CSatSystemState::CSatSystemState( MSatMultiModeApi& aPhone ) : iPhone( aPhone ) |
54 { |
69 { |
55 LOG( SIMPLE, |
70 LOG( SIMPLE, |
56 "SATSYSTEMSTATE: CSatSystemState::CSatSystemState calling-exiting" ) |
71 "SATSYSTEMSTATE: CSatSystemState::CSatSystemState calling-exiting" ) |
57 } |
72 } |
|
73 |
58 |
74 |
59 // ----------------------------------------------------------------------------- |
75 // ----------------------------------------------------------------------------- |
60 // Symbian 2nd phase constructor can leave. |
76 // Symbian 2nd phase constructor can leave. |
61 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
62 // |
78 // |
66 |
82 |
67 // Define policies |
83 // Define policies |
68 TSecurityPolicy readPolicy( ECapabilityReadUserData ); |
84 TSecurityPolicy readPolicy( ECapabilityReadUserData ); |
69 TSecurityPolicy writePolicy( ECapabilityWriteUserData ); |
85 TSecurityPolicy writePolicy( ECapabilityWriteUserData ); |
70 |
86 |
71 TInt err( KErrNone ); |
87 DefineProperty( KPSUidSatServerInternal, |
72 // Define properties in P&S for SetUpIdleModeTex command |
88 KSatIdleModeText, |
73 err = RProperty::Define( KPSUidSatServerInternal, |
89 RProperty::ELargeText, |
74 KSatIdleModeText, |
90 readPolicy, |
75 RProperty::ELargeText, |
91 writePolicy ); |
76 readPolicy, |
92 |
77 writePolicy ); |
93 DefineProperty( KPSUidSatServerInternal, |
78 LOG2( SIMPLE, |
94 KSatIdleModeTextIconId, |
79 "SATSYSTEMSTATE: CSatSystemState::ConstructL \ |
95 RProperty::EInt, |
80 Define KSatIdleModeText err: %i", err ) |
96 readPolicy, |
81 |
97 writePolicy ); |
82 err = RProperty::Define( KPSUidSatServerInternal, |
98 |
83 KSatIdleModeTextIconId, |
99 DefineProperty( KPSUidSatServerInternal, |
84 RProperty::EInt, |
100 KSatIdleModeTextIconQualifier, |
85 readPolicy, |
101 RProperty::EInt, |
86 writePolicy ); |
102 readPolicy, |
87 LOG2( SIMPLE, |
103 writePolicy ); |
88 "SATSYSTEMSTATE: CSatSystemState::ConstructL \ |
|
89 Define KSatIdleModeTextIconId err: %i", err ) |
|
90 |
|
91 err = RProperty::Define( KPSUidSatServerInternal, |
|
92 KSatIdleModeTextIconQualifier, |
|
93 RProperty::EInt, |
|
94 readPolicy, |
|
95 writePolicy ); |
|
96 LOG2( SIMPLE, |
|
97 "SATSYSTEMSTATE: CSatSystemState::ConstructL \ |
|
98 Define KSatIdleModeTextIconQualifier err: %i", err ) |
|
99 |
104 |
100 // Set default (empty) values |
105 // Set default (empty) values |
101 WriteSetIdleModeText( KNullDesC, KErrNotFound, RSat::ENoIconId ); |
106 WriteSetIdleModeText( KNullDesC, KErrNotFound, RSat::ENoIconId ); |
102 |
107 |
103 err = RProperty::Define( KPSUidSatServer, |
108 DefineProperty( KPSUidSatServer, |
104 KSatLanguageSelectionTimeBeforeReboot, |
109 KSatLanguageSelectionTimeBeforeReboot, |
105 RProperty::EInt, |
110 RProperty::EInt, |
106 readPolicy, |
111 readPolicy, |
107 writePolicy ); |
112 writePolicy ); |
108 LOG2( SIMPLE, |
113 |
109 "SATSYSTEMSTATE: CSatSystemState::ConstructL \ |
|
110 Define KSatLanguageSelectionTimeBeforeReboot err: %i", err ) |
|
111 |
|
112 // Create Network Registration Status Monitor. |
114 // Create Network Registration Status Monitor. |
113 iNetworkRegStatusMonitor = CSatNetworkRegStatusMonitor::NewL( aPhone ); |
115 iNetworkRegStatusMonitor = CSatNetworkRegStatusMonitor::NewL( aPhone ); |
114 |
116 |
115 // Start Network Registration Status Monitor. |
117 // Start Network Registration Status Monitor. |
116 iNetworkRegStatusMonitor->Start(); |
118 iNetworkRegStatusMonitor->Start(); |
274 // ----------------------------------------------------------------------------- |
276 // ----------------------------------------------------------------------------- |
275 // |
277 // |
276 TBool CSatSystemState::IsPhoneInIdleStateL() |
278 TBool CSatSystemState::IsPhoneInIdleStateL() |
277 { |
279 { |
278 LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" ) |
280 LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" ) |
279 TInt idleStatus(EHomeScreenIdleState) ; |
281 TInt idleStatus( EHomeScreenWidgetViewForeground ); |
280 |
282 |
281 // Get the idle status from P&S |
283 // Get the idle status from P&S |
282 User::LeaveIfError( RProperty::Get( |
284 User::LeaveIfError( RProperty::Get( |
283 KHsCategoryUid, |
285 KHsCategoryUid, |
284 KHsCategoryStateKey, |
286 KHsCategoryStateKey, |
285 idleStatus)); |
287 idleStatus)); |
286 // Returns true if phone in idle state. |
288 // Returns true if phone in idle state. |
287 const TBool result( EHomeScreenIdleState == idleStatus ); |
289 const TBool result( EHomeScreenWidgetViewForeground == idleStatus ); |
288 |
290 |
289 LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \ |
291 LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \ |
290 with value: %d", result ) |
292 with value: %d", result ) |
291 return result; |
293 return result; |
292 } |
294 } |