33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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: Provides system state information to SAT Server
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include <mtclreg.h>
|
|
21 |
#include <smsclnt.h>
|
|
22 |
#include <smutset.h>
|
|
23 |
#include <PSVariables.h> // Publish & Suscribe keys
|
|
24 |
#include <centralrepository.h> // CRepository
|
|
25 |
#include <CommonEngineDomainCRKeys.h>
|
|
26 |
#include <ProfileEngineSDKCRKeys.h>
|
|
27 |
#include <settingsinternalcrkeys.h>
|
|
28 |
#include <satdomainpskeys.h>
|
|
29 |
#define Q_OS_SYMBIAN // needed to activate homescreendomainpskeys.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 |
// ******************************************************************
|
|
37 |
#include <ctsydomainpskeys.h>
|
|
38 |
#include <sbdefs.h>
|
|
39 |
#include <BTSapDomainPSKeys.h>
|
|
40 |
|
|
41 |
#include "SATInternalPSKeys.h"
|
|
42 |
#include "CSatSystemState.h"
|
|
43 |
#include "msatmultimodeapi.h"
|
|
44 |
#include "SatLog.h"
|
|
45 |
|
51
|
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 |
|
33
|
61 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
62 |
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
// C++ default constructor can NOT contain any code, that
|
|
65 |
// might leave.
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
CSatSystemState::CSatSystemState( MSatMultiModeApi& aPhone ) : iPhone( aPhone )
|
|
69 |
{
|
|
70 |
LOG( SIMPLE,
|
|
71 |
"SATSYSTEMSTATE: CSatSystemState::CSatSystemState calling-exiting" )
|
|
72 |
}
|
|
73 |
|
51
|
74 |
|
33
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
// Symbian 2nd phase constructor can leave.
|
|
77 |
// -----------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
void CSatSystemState::ConstructL( MSatMultiModeApi& aPhone )
|
|
80 |
{
|
|
81 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ConstructL calling" )
|
|
82 |
|
|
83 |
// Define policies
|
|
84 |
TSecurityPolicy readPolicy( ECapabilityReadUserData );
|
|
85 |
TSecurityPolicy writePolicy( ECapabilityWriteUserData );
|
|
86 |
|
51
|
87 |
DefineProperty( KPSUidSatServerInternal,
|
|
88 |
KSatIdleModeText,
|
|
89 |
RProperty::ELargeText,
|
|
90 |
readPolicy,
|
|
91 |
writePolicy );
|
33
|
92 |
|
51
|
93 |
DefineProperty( KPSUidSatServerInternal,
|
|
94 |
KSatIdleModeTextIconId,
|
|
95 |
RProperty::EInt,
|
|
96 |
readPolicy,
|
|
97 |
writePolicy );
|
33
|
98 |
|
51
|
99 |
DefineProperty( KPSUidSatServerInternal,
|
|
100 |
KSatIdleModeTextIconQualifier,
|
|
101 |
RProperty::EInt,
|
|
102 |
readPolicy,
|
|
103 |
writePolicy );
|
33
|
104 |
|
|
105 |
// Set default (empty) values
|
|
106 |
WriteSetIdleModeText( KNullDesC, KErrNotFound, RSat::ENoIconId );
|
|
107 |
|
51
|
108 |
DefineProperty( KPSUidSatServer,
|
|
109 |
KSatLanguageSelectionTimeBeforeReboot,
|
|
110 |
RProperty::EInt,
|
|
111 |
readPolicy,
|
|
112 |
writePolicy );
|
|
113 |
|
33
|
114 |
// Create Network Registration Status Monitor.
|
|
115 |
iNetworkRegStatusMonitor = CSatNetworkRegStatusMonitor::NewL( aPhone );
|
|
116 |
|
|
117 |
// Start Network Registration Status Monitor.
|
|
118 |
iNetworkRegStatusMonitor->Start();
|
|
119 |
|
|
120 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ConstructL exiting" )
|
|
121 |
}
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
// Two-phased constructor.
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
MSatSystemState* CSatSystemState::NewL( MSatMultiModeApi& aPhone )
|
|
128 |
{
|
|
129 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::NewL calling" )
|
|
130 |
|
|
131 |
CSatSystemState* self = new( ELeave ) CSatSystemState( aPhone );
|
|
132 |
CleanupStack::PushL( self );
|
|
133 |
self->ConstructL( aPhone );
|
|
134 |
CleanupStack::Pop( self );
|
|
135 |
|
|
136 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::NewL exiting" )
|
|
137 |
return self;
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// Destructor
|
|
142 |
CSatSystemState::~CSatSystemState()
|
|
143 |
{
|
|
144 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::~CSatSystemState calling" )
|
|
145 |
|
|
146 |
delete iNetworkRegStatusMonitor;
|
|
147 |
iNetworkRegStatusMonitor = NULL;
|
|
148 |
|
|
149 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::~CSatSystemState exiting" )
|
|
150 |
}
|
|
151 |
|
|
152 |
// -----------------------------------------------------------------------------
|
|
153 |
// Returns network registration status.
|
|
154 |
// -----------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
RMobilePhone::TMobilePhoneRegistrationStatus
|
|
157 |
CSatSystemState::GetNetworkRegistrationStatus()
|
|
158 |
{
|
|
159 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::\
|
|
160 |
GetNetworkRegistrationStatus calling-exiting" )
|
|
161 |
return iNetworkRegStatusMonitor->CurrentValue();
|
|
162 |
}
|
|
163 |
|
|
164 |
// -----------------------------------------------------------------------------
|
|
165 |
// Checks current call status and returns true only if cuurent call status is
|
|
166 |
// voice call active.
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
TBool CSatSystemState::IsCallActive()
|
|
170 |
{
|
|
171 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsCallActive calling" )
|
|
172 |
TInt callActiveState = EPSCTsyCallTypeNone;
|
|
173 |
|
|
174 |
// Get current call status from P&S
|
|
175 |
const TInt errCode( RProperty::Get(
|
|
176 |
KPSUidCtsyCallInformation,
|
|
177 |
KCTsyCallType,
|
|
178 |
callActiveState ) );
|
|
179 |
|
|
180 |
// Check current call type
|
|
181 |
TBool result(
|
|
182 |
( EPSCTsyCallTypeCSVoice == callActiveState ) &&
|
|
183 |
( KErrNone == errCode ) );
|
|
184 |
|
|
185 |
LOG2(
|
|
186 |
SIMPLE,
|
|
187 |
"SATSYSTEMSTATE: CSatSystemState::IsCallActive exiting with value: %d",
|
|
188 |
result )
|
|
189 |
return result;
|
|
190 |
}
|
|
191 |
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
// Checks current call state and returns true if phone is alerting or ringing.
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
TBool CSatSystemState::IsCallIncoming()
|
|
197 |
{
|
|
198 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsCallIncoming calling" )
|
|
199 |
|
|
200 |
// Using MSatMultiModeApi::IsCallIncoming to check call status instead of
|
|
201 |
// checking P&S key so that we can get the status on time
|
|
202 |
TBool result( iPhone.IsCallIncoming() );
|
|
203 |
|
|
204 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsCallIncoming exiting \
|
|
205 |
with value: %d", result )
|
|
206 |
return result;
|
|
207 |
}
|
|
208 |
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
// Gets the SMS Service center number and returns it.
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
//
|
|
213 |
const TDesC& CSatSystemState::SCANumber()
|
|
214 |
{
|
|
215 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::SCANumber calling" )
|
|
216 |
|
|
217 |
// Null possible previous SCA number
|
|
218 |
iScaAddress = KNullDesC;
|
|
219 |
TBuf<KMaxSCANumberSize> address;
|
|
220 |
|
|
221 |
TRAPD( err, ReadCurrentSMSCL( address ) );
|
|
222 |
LOG2( SIMPLE,
|
|
223 |
"SATSYSTEMSTATE: CSatSystemState::SCANumber err: %d", err )
|
|
224 |
// If any error occurs, return null string.
|
|
225 |
if ( KErrNone != err )
|
|
226 |
{
|
|
227 |
address = KNullDesC;
|
|
228 |
}
|
|
229 |
|
|
230 |
iScaAddress = address;
|
|
231 |
|
|
232 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::SCANumber exiting" )
|
|
233 |
return iScaAddress;
|
|
234 |
}
|
|
235 |
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
// Method is used when the information of phones silent mode is needed.
|
|
238 |
// Returns true if silent mode is on and false otherwise.
|
|
239 |
// -----------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
TBool CSatSystemState::IsSilentMode()
|
|
242 |
{
|
|
243 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsSilentMode calling" )
|
|
244 |
TBool result( EFalse );
|
|
245 |
TInt silenceMode( -1 );
|
|
246 |
CRepository* centRep( NULL );
|
|
247 |
|
|
248 |
TRAPD( err, centRep = CRepository::NewL( KCRUidProfileEngine ) );
|
|
249 |
LOG2( SIMPLE, "SATSYSTEMSTATE:CSatSystemState::IsSilentMode\
|
|
250 |
CRepository::NewL result: %i", err )
|
|
251 |
if ( ( KErrNone == err ) && centRep )
|
|
252 |
{
|
|
253 |
// Get the needed information from CentRep
|
|
254 |
centRep->Get( KProEngActiveMessageAlert, silenceMode );
|
|
255 |
|
|
256 |
// Delete CentRep
|
|
257 |
delete centRep;
|
|
258 |
|
|
259 |
if ( 0 == silenceMode )
|
|
260 |
{
|
|
261 |
LOG( SIMPLE, "SATSYSTEMSTATE:CSatSystemState::IsSilentMode\
|
|
262 |
Silent mode" )
|
|
263 |
result = ETrue;
|
|
264 |
}
|
|
265 |
}
|
|
266 |
|
|
267 |
LOG2(
|
|
268 |
SIMPLE,
|
|
269 |
"SATSYSTEMSTATE: CSatSystemState::IsSilentMode exiting with value: %d",
|
|
270 |
result )
|
|
271 |
return result;
|
|
272 |
}
|
|
273 |
|
|
274 |
// -----------------------------------------------------------------------------
|
|
275 |
// Checks is phone in idle state.
|
|
276 |
// -----------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
TBool CSatSystemState::IsPhoneInIdleStateL()
|
|
279 |
{
|
|
280 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState calling" )
|
51
|
281 |
TInt idleStatus( EHomeScreenWidgetViewForeground );
|
33
|
282 |
|
|
283 |
// Get the idle status from P&S
|
|
284 |
User::LeaveIfError( RProperty::Get(
|
|
285 |
KHsCategoryUid,
|
|
286 |
KHsCategoryStateKey,
|
|
287 |
idleStatus));
|
|
288 |
// Returns true if phone in idle state.
|
51
|
289 |
const TBool result( EHomeScreenWidgetViewForeground == idleStatus );
|
33
|
290 |
|
|
291 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsPhoneInIdleState exiting \
|
|
292 |
with value: %d", result )
|
|
293 |
return result;
|
|
294 |
}
|
|
295 |
|
|
296 |
// -----------------------------------------------------------------------------
|
|
297 |
// Checks is screen saver actived from idle.
|
|
298 |
// -----------------------------------------------------------------------------
|
|
299 |
//
|
|
300 |
TBool CSatSystemState::IsScreenSaverActivedFromIdle()
|
|
301 |
{
|
|
302 |
LOG( SIMPLE,
|
|
303 |
"SATSYSTEMSTATE: CSatSystemState::IsScreenSaverActivedFromIdle calling" )
|
|
304 |
TBool result( EFalse );
|
|
305 |
|
|
306 |
/*
|
|
307 |
// TODO: This method can no longer be used for checking screen saver status.
|
|
308 |
// Must find an alternative method.
|
|
309 |
|
|
310 |
TInt screenSaverActive( -1 );
|
|
311 |
|
|
312 |
// Get the idle status from P&S
|
|
313 |
TInt err = RProperty::Get( KPSUidScreenSaver,
|
|
314 |
KScreenSaverActivatedFromIdle, screenSaverActive );
|
|
315 |
|
|
316 |
if ( KErrNone == err )
|
|
317 |
{
|
|
318 |
// Returns true if screen saver is actived from idle.
|
|
319 |
if ( screenSaverActive )
|
|
320 |
{
|
|
321 |
result = ETrue;
|
|
322 |
}
|
|
323 |
}
|
|
324 |
|
|
325 |
LOG2( SIMPLE,
|
|
326 |
"SATSYSTEMSTATE: CSatSystemState:: IsScreenSaverActivedFromIdle \
|
|
327 |
err: %d", err )
|
|
328 |
*/
|
|
329 |
|
|
330 |
LOG2( SIMPLE,
|
|
331 |
"SATSYSTEMSTATE: CSatSystemState:: \
|
|
332 |
IsScreenSaverActivedFromIdle exiting with value: %d", result )
|
|
333 |
return result;
|
|
334 |
}
|
|
335 |
|
|
336 |
// -----------------------------------------------------------------------------
|
|
337 |
// Sets time between language selection and reboot.
|
|
338 |
// -----------------------------------------------------------------------------
|
|
339 |
//
|
|
340 |
TInt CSatSystemState::WriteLanguageSelectionTime(
|
|
341 |
TInt aTime )
|
|
342 |
{
|
|
343 |
LOG2( NORMAL,
|
|
344 |
"SATSYSTEMSTATE: CSatSystemState::WriteLanguageSelectionTime calling, \
|
|
345 |
aTime: %d", aTime )
|
|
346 |
TInt errorCode( KErrNone );
|
|
347 |
|
|
348 |
// Set SetUpIdleModeText string
|
|
349 |
errorCode = RProperty::Set(
|
|
350 |
KPSUidSatServer,
|
|
351 |
KSatLanguageSelectionTimeBeforeReboot,
|
|
352 |
aTime );
|
|
353 |
LOG2( NORMAL,
|
|
354 |
"SATSYSTEMSTATE: CSatSystemState::WriteLanguageSelectionTime exiting, \
|
|
355 |
errorCode: %d", errorCode )
|
|
356 |
return errorCode;
|
|
357 |
}
|
|
358 |
|
|
359 |
// -----------------------------------------------------------------------------
|
|
360 |
// Writes idle mode text and icon ID to P&S.
|
|
361 |
// -----------------------------------------------------------------------------
|
|
362 |
//
|
|
363 |
TInt CSatSystemState::WriteSetIdleModeText(
|
|
364 |
const TDesC& aString,
|
|
365 |
TInt aIconId,
|
|
366 |
RSat::TIconQualifier aIconQualifier )
|
|
367 |
{
|
|
368 |
LOG( SIMPLE,
|
|
369 |
"SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText calling" )
|
|
370 |
LOG2(
|
|
371 |
NORMAL,
|
|
372 |
"SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText ID: %d",
|
|
373 |
aIconId )
|
|
374 |
TInt errorCode( KErrNone );
|
|
375 |
|
|
376 |
// Set SetUpIdleModeText string
|
|
377 |
errorCode = RProperty::Set(
|
|
378 |
KPSUidSatServerInternal,
|
|
379 |
KSatIdleModeText,
|
|
380 |
aString );
|
|
381 |
LOG2( NORMAL,
|
|
382 |
"SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText errorCode: %d",
|
|
383 |
errorCode )
|
|
384 |
if ( KErrNone == errorCode )
|
|
385 |
{
|
|
386 |
// Set SetUpIdleModeText icon
|
|
387 |
errorCode = RProperty::Set(
|
|
388 |
KPSUidSatServerInternal,
|
|
389 |
KSatIdleModeTextIconId,
|
|
390 |
aIconId );
|
|
391 |
if ( KErrNone == errorCode )
|
|
392 |
{
|
|
393 |
// Select qualifier value for icon.
|
|
394 |
TSatIdleModeTextIconQualifierValue qualifier( KSatIdleIconQInit );
|
|
395 |
LOG2( NORMAL,
|
|
396 |
"SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText \
|
|
397 |
aIconQualifier: %d", aIconQualifier )
|
|
398 |
switch ( aIconQualifier )
|
|
399 |
{
|
|
400 |
// Icon not present.
|
|
401 |
case RSat::ENoIconId:
|
|
402 |
{
|
|
403 |
qualifier = KSatIdleIconQNoIcon;
|
|
404 |
break;
|
|
405 |
}
|
|
406 |
// Icon is self explanatory. Displayed instead text string.
|
|
407 |
case RSat::ESelfExplanatory:
|
|
408 |
{
|
|
409 |
qualifier = KSatIdleIconQSelfExplanatory;
|
|
410 |
break;
|
|
411 |
}
|
|
412 |
// Icon is not self explanatory. Displayed with text string.
|
|
413 |
case RSat::ENotSelfExplanatory:
|
|
414 |
{
|
|
415 |
qualifier = KSatIdleIconQNotSelfExplanatory;
|
|
416 |
break;
|
|
417 |
}
|
|
418 |
// Icon qualifier is not set.
|
|
419 |
case RSat::EIconQualifierNotSet:
|
|
420 |
default:
|
|
421 |
{
|
|
422 |
qualifier = KSatIdleIconQInit;
|
|
423 |
break;
|
|
424 |
}
|
|
425 |
}
|
|
426 |
|
|
427 |
LOG2( NORMAL,
|
|
428 |
"SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText \
|
|
429 |
IconQualifier: %d", qualifier )
|
|
430 |
|
|
431 |
// Set qualifier for icon.
|
|
432 |
errorCode = RProperty::Set(
|
|
433 |
KPSUidSatServerInternal,
|
|
434 |
KSatIdleModeTextIconQualifier,
|
|
435 |
qualifier );
|
|
436 |
}
|
|
437 |
}
|
|
438 |
|
|
439 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::WriteSetIdleModeText \
|
|
440 |
exiting with value: %d", errorCode )
|
|
441 |
return errorCode;
|
|
442 |
}
|
|
443 |
|
|
444 |
// -----------------------------------------------------------------------------
|
|
445 |
// Checks is backup process ongoing.
|
|
446 |
// -----------------------------------------------------------------------------
|
|
447 |
//
|
|
448 |
TBool CSatSystemState::IsBackupProcessOngoing()
|
|
449 |
{
|
|
450 |
LOG( SIMPLE,
|
|
451 |
"SATSYSTEMSTATE: CSatSystemState::IsBackupProcessOngoing calling" )
|
|
452 |
TInt backupState( conn::ENoBackup );
|
|
453 |
|
|
454 |
// Get the backup state from P&S
|
|
455 |
const TInt errCode( RProperty::Get(
|
|
456 |
KUidSystemCategory,
|
|
457 |
conn::KUidBackupRestoreKey,
|
|
458 |
backupState ) );
|
|
459 |
|
|
460 |
TBool result(
|
|
461 |
( conn::ENoBackup != ( backupState & conn::KBackupIncTypeMask ) )
|
|
462 |
&& ( KErrNone == errCode ) );
|
|
463 |
|
|
464 |
LOG2( SIMPLE,
|
|
465 |
"SATSYSTEMSTATE: CSatSystemState::IsBackupProcessOngoing exiting \
|
|
466 |
with value: %d", result )
|
|
467 |
return result;
|
|
468 |
}
|
|
469 |
|
|
470 |
// -----------------------------------------------------------------------------
|
|
471 |
// CSatSystemState::IsConfirmSatOperationsOn
|
|
472 |
// -----------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
TBool CSatSystemState::IsConfirmSatOperationsOn()
|
|
475 |
{
|
|
476 |
LOG( SIMPLE,
|
|
477 |
"SATSYSTEMSTATE: CSatSystemState::IsConfirmSatOperationsOn calling" )
|
|
478 |
TBool result( EFalse );
|
|
479 |
TInt confirmSatOperations( 0 );
|
|
480 |
CRepository* centRep( NULL );
|
|
481 |
|
|
482 |
TRAPD( err, centRep = CRepository::NewL( KCRUidPersonalizationSettings ) );
|
|
483 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CentRep failed: %i", err )
|
|
484 |
if ( ( KErrNone == err ) && centRep )
|
|
485 |
{
|
|
486 |
// Get the needed information from CentRep
|
|
487 |
centRep->Get( KSettingsConfirmSatOperations, confirmSatOperations );
|
|
488 |
|
|
489 |
// Delete CentRep
|
|
490 |
delete centRep;
|
|
491 |
|
|
492 |
if ( 1 == confirmSatOperations )
|
|
493 |
{
|
|
494 |
LOG( SIMPLE,
|
|
495 |
"SATSYSTEMSTATE: CSatSystemState::IsConfirmSatOperationsOn \
|
|
496 |
1 == confirmSatOperations" )
|
|
497 |
result = ETrue;
|
|
498 |
}
|
|
499 |
}
|
|
500 |
|
|
501 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::IsConfirmSatOperationsOn \
|
|
502 |
exiting with value: %d", result )
|
|
503 |
return result;
|
|
504 |
}
|
|
505 |
|
|
506 |
// -----------------------------------------------------------------------------
|
|
507 |
// CSatSystemState::DisplayTextLanguage
|
|
508 |
// -----------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
TBool CSatSystemState::DisplayTextLanguage()
|
|
511 |
{
|
|
512 |
LOG( SIMPLE,
|
|
513 |
"SATSYSTEMSTATE: CSatSystemState::DisplayTextLanguage calling" )
|
|
514 |
TInt selLanguage( 0 );
|
|
515 |
CRepository* centRep( NULL );
|
|
516 |
|
|
517 |
// Create instance to CentRep
|
|
518 |
TRAPD( err, centRep = CRepository::NewL( KCRUidCommonEngineKeys ) );
|
|
519 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CentRep failed: %i", err )
|
|
520 |
if ( ( KErrNone == err ) && centRep )
|
|
521 |
{
|
|
522 |
// Get the needed information from CentRep
|
|
523 |
centRep->Get( KGSDisplayTxtLang, selLanguage );
|
|
524 |
|
|
525 |
// Delete CentRep
|
|
526 |
delete centRep;
|
|
527 |
}
|
|
528 |
|
|
529 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::DisplayTextLanguage \
|
|
530 |
exiting with value: %d", selLanguage )
|
|
531 |
return selLanguage;
|
|
532 |
}
|
|
533 |
|
|
534 |
// -----------------------------------------------------------------------------
|
|
535 |
// Checks is BT SAP active
|
|
536 |
// -----------------------------------------------------------------------------
|
|
537 |
//
|
|
538 |
TBool CSatSystemState::IsBtSapActive()
|
|
539 |
{
|
|
540 |
LOG( SIMPLE,
|
|
541 |
"SATSYSTEMSTATE: CSatSystemState::IsBtSapActive calling" )
|
|
542 |
TInt sapActive( EBTSapNotConnected );
|
|
543 |
|
|
544 |
// Get the backup state from P&S
|
|
545 |
const TInt errCode( RProperty::Get(
|
|
546 |
KPSUidBluetoothSapConnectionState,
|
|
547 |
KBTSapConnectionState,
|
|
548 |
sapActive ) );
|
|
549 |
|
|
550 |
LOG2(
|
|
551 |
SIMPLE,
|
|
552 |
"SATSYSTEMSTATE: RProperty::Get returned value: %i", errCode )
|
|
553 |
|
|
554 |
TBool result( ( ( EBTSapConnecting == sapActive ) ||
|
|
555 |
( EBTSapConnected == sapActive ) ) &&
|
|
556 |
( KErrNone == errCode ) );
|
|
557 |
|
|
558 |
LOG2(
|
|
559 |
SIMPLE,
|
|
560 |
"SATSYSTEMSTATE: CSatSystemState::IsBtSapActive exiting with value: %i",
|
|
561 |
result )
|
|
562 |
return result;
|
|
563 |
}
|
|
564 |
|
|
565 |
// -----------------------------------------------------------------------------
|
|
566 |
// Reads current SMS Center number.
|
|
567 |
// -----------------------------------------------------------------------------
|
|
568 |
//
|
|
569 |
void CSatSystemState::ReadCurrentSMSCL( TDes& aAddress )
|
|
570 |
{
|
|
571 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL calling" )
|
|
572 |
|
|
573 |
aAddress = KNullDesC;
|
|
574 |
TInt status( KErrNone );
|
|
575 |
|
|
576 |
// Open message server connection.
|
|
577 |
CMsvSession* msvSession = CMsvSession::OpenSyncL( *this );
|
|
578 |
CleanupStack::PushL( msvSession );
|
|
579 |
|
|
580 |
CClientMtmRegistry* clientRegistry =
|
|
581 |
CClientMtmRegistry::NewL( *msvSession );
|
|
582 |
|
|
583 |
CleanupStack::PushL( clientRegistry );
|
|
584 |
|
|
585 |
// Get the account.
|
|
586 |
TInt serviceId( ServiceForMTML( *msvSession, KUidMsgTypeSMS ) );
|
|
587 |
if ( KMsvUnknownServiceIndexEntryId != serviceId )
|
|
588 |
{
|
|
589 |
LOG( SIMPLE,
|
|
590 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
591 |
KMsvUnknownServiceIndexEntryId != serviceId" )
|
|
592 |
// Read the setting.
|
|
593 |
CSmsClientMtm* mtm =
|
|
594 |
static_cast<CSmsClientMtm*>( clientRegistry->NewMtmL( KUidMsgTypeSMS ) );
|
|
595 |
CleanupStack::PushL( mtm );
|
|
596 |
mtm->SwitchCurrentEntryL( serviceId );
|
|
597 |
mtm->LoadMessageL();
|
|
598 |
// Findout the number.
|
|
599 |
const CSmsSettings& settings = mtm->ServiceSettings();
|
|
600 |
|
|
601 |
#ifndef __HIDE_MESSAGING_API_V1__
|
|
602 |
if ( settings.NumSCAddresses() != 0 )
|
|
603 |
{
|
|
604 |
if ( settings.DefaultSC() < settings.NumSCAddresses() )
|
|
605 |
{
|
|
606 |
LOG( SIMPLE,
|
|
607 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
608 |
settings.DefaultSC() < settings.NumSCAddresses()" )
|
|
609 |
TPtrC addr = settings.SCAddress( settings.DefaultSC() ).Address();
|
|
610 |
aAddress = addr;
|
|
611 |
}
|
|
612 |
else
|
|
613 |
{
|
|
614 |
LOG( SIMPLE,
|
|
615 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
616 |
others" )
|
|
617 |
status = KErrOverflow;
|
|
618 |
}
|
|
619 |
}
|
|
620 |
#else
|
|
621 |
|
|
622 |
if ( settings.ServiceCenterCount() != 0 )
|
|
623 |
{
|
|
624 |
LOG( SIMPLE,
|
|
625 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
626 |
settings.ServiceCenterCount() != 0" )
|
|
627 |
if ( settings.DefaultServiceCenter() < settings.ServiceCenterCount() )
|
|
628 |
{
|
|
629 |
LOG( SIMPLE,
|
|
630 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
631 |
settings.DefaultServiceCenter() < \
|
|
632 |
settings.ServiceCenterCount()" )
|
|
633 |
TPtrC addr = settings.GetServiceCenter(
|
|
634 |
settings.DefaultServiceCenter() ).Address();
|
|
635 |
aAddress = addr;
|
|
636 |
}
|
|
637 |
else
|
|
638 |
{
|
|
639 |
status = KErrOverflow;
|
|
640 |
}
|
|
641 |
}
|
|
642 |
|
|
643 |
#endif
|
|
644 |
else
|
|
645 |
{
|
|
646 |
LOG( SIMPLE,
|
|
647 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
648 |
settings.ServiceCenterCount() == 0" )
|
|
649 |
status = KErrNotFound;
|
|
650 |
}
|
|
651 |
|
|
652 |
// Cleanup.
|
|
653 |
CleanupStack::PopAndDestroy( mtm );
|
|
654 |
}
|
|
655 |
else
|
|
656 |
{
|
|
657 |
LOG( SIMPLE,
|
|
658 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL \
|
|
659 |
KMsvUnknownServiceIndexEntryId == serviceId" )
|
|
660 |
status = KErrNotFound;
|
|
661 |
}
|
|
662 |
|
|
663 |
CleanupStack::PopAndDestroy( clientRegistry );
|
|
664 |
CleanupStack::PopAndDestroy( msvSession );
|
|
665 |
|
|
666 |
if ( KErrNone != status )
|
|
667 |
{
|
|
668 |
LOG2( NORMAL,
|
|
669 |
"SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL leave: %d",
|
|
670 |
status )
|
|
671 |
User::Leave( status );
|
|
672 |
}
|
|
673 |
|
|
674 |
LOG( NORMAL, "SATSYSTEMSTATE: CSatSystemState::ReadCurrentSMSCL exiting" )
|
|
675 |
}
|
|
676 |
|
|
677 |
// -----------------------------------------------------------------------------
|
|
678 |
// Specifies an entry in the Message Server index.
|
|
679 |
// -----------------------------------------------------------------------------
|
|
680 |
//
|
|
681 |
TMsvId CSatSystemState::ServiceForMTML(
|
|
682 |
CMsvSession& aSession,
|
|
683 |
const TUid& aMtm ) const
|
|
684 |
{
|
|
685 |
LOG( SIMPLE, "SATSYSTEMSTATE: CSatSystemState::ServiceForMTML calling" )
|
|
686 |
|
|
687 |
CMsvEntry* entry = aSession.GetEntryL( KMsvRootIndexEntryIdValue );
|
|
688 |
CleanupStack::PushL( entry );
|
|
689 |
TMsvId serviceId = KMsvUnknownServiceIndexEntryId;
|
|
690 |
LOG2( SIMPLE,
|
|
691 |
"SATSYSTEMSTATE: CSatSystemState::ServiceForMTML count: %d",
|
|
692 |
entry->Count() )
|
|
693 |
// Check are there any entries
|
|
694 |
if ( entry->Count() != 0 )
|
|
695 |
{
|
|
696 |
entry->SetSortTypeL(
|
|
697 |
TMsvSelectionOrdering( KMsvGroupByType | KMsvGroupByStandardFolders,
|
|
698 |
EMsvSortByDetailsReverse,
|
|
699 |
ETrue ) );
|
|
700 |
|
|
701 |
const TMsvEntry* tentry;
|
|
702 |
for ( TInt cc( entry->Count() ); --cc >= 0; )
|
|
703 |
{
|
|
704 |
tentry = &( *entry )[cc];
|
|
705 |
if ( tentry->iMtm == aMtm )
|
|
706 |
{
|
|
707 |
LOG( SIMPLE,
|
|
708 |
"SATSYSTEMSTATE: CSatSystemState::ServiceForMTML \
|
|
709 |
tentry->iMtm == aMtm" )
|
|
710 |
if ( ( tentry->iType.iUid == KUidMsvServiceEntryValue ) &&
|
|
711 |
( tentry->Id() != KMsvLocalServiceIndexEntryIdValue ) )
|
|
712 |
{
|
|
713 |
LOG( SIMPLE,
|
|
714 |
"SATSYSTEMSTATE: CSatSystemState::ServiceForMTML \
|
|
715 |
exit loop" )
|
|
716 |
serviceId = tentry->Id();
|
|
717 |
cc = 0; // To exit for-loop. Replaces break.
|
|
718 |
}
|
|
719 |
}
|
|
720 |
}
|
|
721 |
}
|
|
722 |
|
|
723 |
CleanupStack::PopAndDestroy( entry );
|
|
724 |
|
|
725 |
LOG2( SIMPLE,
|
|
726 |
"SATSYSTEMSTATE: CSatSystemState::ServiceForMTML exiting with value: %d",
|
|
727 |
serviceId )
|
|
728 |
return serviceId;
|
|
729 |
}
|
|
730 |
|
|
731 |
// -----------------------------------------------------------------------------
|
|
732 |
// Method is used when the information of phones warnings and game tone
|
|
733 |
// mode is needed.
|
|
734 |
// Returns true if silent mode is on and false otherwise.
|
|
735 |
// -----------------------------------------------------------------------------
|
|
736 |
//
|
|
737 |
TBool CSatSystemState::IsWarningAndGameTonesOn()
|
|
738 |
{
|
|
739 |
LOG( SIMPLE, "SATSYSTEMSTATE: \
|
|
740 |
CSatSystemState::IsWarningAndGameTonesOn calling" )
|
|
741 |
|
|
742 |
TBool modeOn( ETrue );
|
|
743 |
CRepository* centRep( NULL );
|
|
744 |
|
|
745 |
TRAPD( err, centRep = CRepository::NewL( KCRUidProfileEngine ) );
|
|
746 |
LOG2( SIMPLE, "SATSYSTEMSTATE: CentRep failed: %i", err )
|
|
747 |
if ( ( KErrNone == err ) && centRep )
|
|
748 |
{
|
|
749 |
// Get the needed information from CentRep
|
|
750 |
centRep->Get( KProEngActiveWarningTones, modeOn );
|
|
751 |
|
|
752 |
// Delete CentRep
|
|
753 |
delete centRep;
|
|
754 |
|
|
755 |
}
|
|
756 |
|
|
757 |
LOG2(
|
|
758 |
SIMPLE,
|
|
759 |
"SATSYSTEMSTATE: \
|
|
760 |
CSatSystemState::IsWarningAndGameTonesOn exiting with value: %d",
|
|
761 |
modeOn )
|
|
762 |
|
|
763 |
return modeOn;
|
|
764 |
}
|