|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Customer service profile cache |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <bldvariant.hrh> // for feature definitions |
|
21 #include <etel.h> |
|
22 #include <SSSettingsPrivatePSKeys.h> |
|
23 #include <centralrepository.h> |
|
24 #include <mmtsy_names.h> |
|
25 #include <featmgr.h> |
|
26 |
|
27 #include "RCustomerServiceProfileCache.h" |
|
28 #include "SSSettingsLogger.h" |
|
29 |
|
30 // CONSTANTS |
|
31 #define KSSSettingsTSYName KMmTsyModuleName |
|
32 const TInt KCspCacheTSYNameMaxLength( 80 ); |
|
33 const TInt KCspCacheETelRetryCount(8); |
|
34 const TInt KCspCacheETelRetryTimeout(100000); |
|
35 const TInt KCspCacheNoFile(99999); |
|
36 _LIT_SECURITY_POLICY_C1(KSSSettingReadPolicy, ECapabilityReadDeviceData); |
|
37 _LIT_SECURITY_POLICY_C1(KSSSettingWritePolicy, ECapabilityWriteDeviceData); |
|
38 |
|
39 |
|
40 // ==================== LOCAL FUNCTIONS ==================== |
|
41 |
|
42 |
|
43 static TInt CspCacheDoOpenEtelConnection( RTelServer& aEtel, RPhone& aPhone ) |
|
44 { |
|
45 TInt phones(0); |
|
46 if ( aEtel.EnumeratePhones( phones) == KErrNone ) |
|
47 { |
|
48 for ( TInt p = 0 ; p < phones ; p++ ) |
|
49 { |
|
50 TBuf<KCspCacheTSYNameMaxLength> tsyName; |
|
51 if ( aEtel.GetTsyName( p,tsyName ) == KErrNone ) |
|
52 { |
|
53 if ( tsyName.CompareF( KSSSettingsTSYName ) == 0 ) |
|
54 { |
|
55 RTelServer::TPhoneInfo info; |
|
56 if ( aEtel.GetPhoneInfo( p,info ) == KErrNone ) |
|
57 { |
|
58 if ( aPhone.Open( aEtel, info.iName ) == KErrNone ) |
|
59 { |
|
60 return KErrNone; |
|
61 } |
|
62 } |
|
63 } |
|
64 } |
|
65 } |
|
66 } |
|
67 return KErrGeneral; |
|
68 } |
|
69 |
|
70 |
|
71 RCustomerServiceProfileCache::TCspCacheData::TCspCacheData():iCspFilePckg( |
|
72 iCspFile ) |
|
73 { |
|
74 } |
|
75 |
|
76 |
|
77 // ================= MEMBER FUNCTIONS ======================= |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // Constructor |
|
81 // ----------------------------------------------------------------------------- |
|
82 EXPORT_C RCustomerServiceProfileCache::RCustomerServiceProfileCache() |
|
83 :iData( NULL ),iOldCspFile(NULL) |
|
84 { |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // Destructor |
|
89 // ----------------------------------------------------------------------------- |
|
90 EXPORT_C RCustomerServiceProfileCache::~RCustomerServiceProfileCache() |
|
91 { |
|
92 Close(); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CustomerServiceProfileCache::Open |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C TInt RCustomerServiceProfileCache::Open() |
|
100 { |
|
101 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::Open"); |
|
102 TRAPD( error, DoOpenL() ); |
|
103 if ( error != KErrNone ) |
|
104 { |
|
105 Close(); |
|
106 } |
|
107 |
|
108 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::Open: error: %d", error ); |
|
109 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::Open"); |
|
110 return error; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CustomerServiceProfileCache::Close |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 EXPORT_C void RCustomerServiceProfileCache::Close() |
|
118 { |
|
119 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::Close"); |
|
120 if ( iData == NULL ) |
|
121 { |
|
122 delete iOldCspFile; |
|
123 iOldCspFile = NULL; |
|
124 return; |
|
125 } |
|
126 |
|
127 iData->iPhone.Close(); |
|
128 iData->iEtel.Close(); |
|
129 |
|
130 delete iData; |
|
131 iData = NULL; |
|
132 |
|
133 delete iOldCspFile; |
|
134 iOldCspFile = NULL; |
|
135 |
|
136 FeatureManager::UnInitializeLib(); |
|
137 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::Close"); |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CustomerServiceProfileCache::CspCallCompletion |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C TInt RCustomerServiceProfileCache::CspCallCompletion( |
|
145 RMobilePhone::TCspCallCompletion& aParams ) |
|
146 { |
|
147 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCallCompletion"); |
|
148 TInt value(0); |
|
149 TInt error = DoGetValues( value, ESsCspGroup1 ); |
|
150 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCallCompletion: error: %d", error); |
|
151 |
|
152 if ( error == KErrNone ) |
|
153 { |
|
154 //Read 8 bits are moved to correct place within a TInt. |
|
155 aParams = ( RMobilePhone::TCspCallCompletion ) |
|
156 ( ( value >> 24 ) & 0xff ); |
|
157 } |
|
158 |
|
159 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCallCompletion: value: %d", value); |
|
160 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCallCompletion"); |
|
161 return error; |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CustomerServiceProfileCache::CspCallOffering |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TInt RCustomerServiceProfileCache::CspCallOffering( |
|
169 RMobilePhone::TCspCallOffering& aParams ) |
|
170 { |
|
171 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCallOffering"); |
|
172 TInt value(0); |
|
173 TInt error = DoGetValues( value, ESsCspGroup1 ); |
|
174 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCallOffering: error: %d", error); |
|
175 |
|
176 if ( error == KErrNone ) |
|
177 { |
|
178 //Read 8 bits are moved to correct place within a TInt. |
|
179 aParams = ( RMobilePhone::TCspCallOffering ) |
|
180 ( ( value >> 16 ) & 0xff ); |
|
181 } |
|
182 |
|
183 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCallOffering: value: %d", value); |
|
184 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCallOffering"); |
|
185 return error; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // CustomerServiceProfileCache::CspCallRestriction |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 EXPORT_C TInt RCustomerServiceProfileCache::CspCallRestriction( |
|
193 RMobilePhone::TCspCallRestriction& aParams ) |
|
194 { |
|
195 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCallRestriction"); |
|
196 TInt value(0); |
|
197 TInt error = DoGetValues( value, ESsCspGroup1 ); |
|
198 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCallRestriction: error: %d", error); |
|
199 |
|
200 if ( error == KErrNone ) |
|
201 { |
|
202 //Read 8 bits are moved to correct place within a TInt. |
|
203 aParams = ( RMobilePhone::TCspCallRestriction ) |
|
204 ( ( value >> 8 ) & 0xff ); |
|
205 } |
|
206 |
|
207 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCallRestriction: value: %d", value); |
|
208 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCallRestriction"); |
|
209 return error; |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CustomerServiceProfileCache::CspCPHSTeleservices |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 EXPORT_C TInt RCustomerServiceProfileCache::CspCPHSTeleservices( |
|
217 RMobilePhone::TCspCPHSTeleservices& aParams ) |
|
218 { |
|
219 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCPHSTeleservices"); |
|
220 TInt value(0); |
|
221 TInt error = DoGetValues( value, ESsCspGroup1 ); |
|
222 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCPHSTeleservices: error: %d", error); |
|
223 |
|
224 if ( error == KErrNone ) |
|
225 { |
|
226 //Read 8 bits are moved to correct place within a TInt. |
|
227 aParams = ( RMobilePhone::TCspCPHSTeleservices ) |
|
228 ( value & 0xff ); |
|
229 } |
|
230 |
|
231 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCPHSTeleservices: value: %d", value); |
|
232 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCPHSTeleservices"); |
|
233 return error; |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CustomerServiceProfileCache::HandleRefresh |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 EXPORT_C TInt RCustomerServiceProfileCache::HandleRefresh() |
|
241 { |
|
242 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::HandleRefresh"); |
|
243 // Save the old CSP information. |
|
244 *iOldCspFile = iData->iCspFile; |
|
245 |
|
246 TRequestStatus status; |
|
247 TInt value(0); |
|
248 TInt valueExt(0); |
|
249 iData->iPhone.GetCustomerServiceProfile( status, iData->iCspFilePckg ); |
|
250 User::WaitForRequest( status ); |
|
251 TInt error = status.Int(); |
|
252 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::HandleRefresh: GetCustomerServiceProfile: error: %d", error); |
|
253 |
|
254 if ( error == KErrNone ) |
|
255 { |
|
256 // Read 8 bit groups are saved into one TInt. To make room for |
|
257 // all groups, the first read groups are shifted left. |
|
258 value = iData->iCspFile.iCallCompletionServices << 24; |
|
259 value += iData->iCspFile.iCallOfferingServices << 16; |
|
260 value += iData->iCspFile.iCallRestrictionServices << 8; |
|
261 value += iData->iCspFile.iCphsTeleservices; |
|
262 |
|
263 // Read 8 bit groups are saved into one TInt. To make room for |
|
264 // all groups, the first read groups are shifted left. |
|
265 valueExt = iData->iCspFile.iTeleservices << 8; |
|
266 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::HandleRefresh: valueExt1: %d", valueExt); |
|
267 valueExt += iData->iCspFile.iValueAddedServices; |
|
268 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::HandleRefresh: valueExt2: %d", valueExt); |
|
269 } |
|
270 else |
|
271 { |
|
272 value = KErrNotFound; |
|
273 valueExt = KErrNotFound; |
|
274 error = KErrNotSupported; |
|
275 } |
|
276 |
|
277 if ( error == KErrNone ) |
|
278 { |
|
279 // Cache 2. |
|
280 error = DefineAndSetValue( |
|
281 KPSUidSSConfig, |
|
282 KSettingsCspCache2, |
|
283 valueExt ); |
|
284 |
|
285 if ( error == KErrNone ) |
|
286 { |
|
287 // Cache 1. |
|
288 error = DefineAndSetValue( |
|
289 KPSUidSSConfig, |
|
290 KSettingsCspCache1, |
|
291 value ); |
|
292 } |
|
293 } |
|
294 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::HandleRefresh: error: %d", error); |
|
295 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::HandleRefresh"); |
|
296 return error; |
|
297 } |
|
298 |
|
299 // ----------------------------------------------------------------------------- |
|
300 // CustomerServiceProfileCache::CspCPHSValueAddedServices |
|
301 // ----------------------------------------------------------------------------- |
|
302 // |
|
303 EXPORT_C TInt RCustomerServiceProfileCache::CspCPHSValueAddedServices( |
|
304 RMobilePhone::TCspValueAdded& aParams ) |
|
305 { |
|
306 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspCPHSValueAddedServices"); |
|
307 TInt value(0); |
|
308 TInt error = DoGetValues( value, ESsCspGroup2 ); |
|
309 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCPHSValueAddedServices: error: %d", error); |
|
310 |
|
311 if ( error == KErrNone ) |
|
312 { |
|
313 aParams = ( RMobilePhone::TCspValueAdded )( value & 0xff ); |
|
314 } |
|
315 |
|
316 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspCPHSValueAddedServices: value: %d", value); |
|
317 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspCPHSValueAddedServices"); |
|
318 return error; |
|
319 } |
|
320 |
|
321 |
|
322 // ----------------------------------------------------------------------------- |
|
323 // CustomerServiceProfileCache::CspTeleServices |
|
324 |
|
325 // Include SM/CB, Reply path, Del. Conf, Prot. ID, Validity Period. |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 EXPORT_C TInt RCustomerServiceProfileCache::CspTeleServices( |
|
329 RMobilePhone::TCspTeleservices& aParams ) |
|
330 { |
|
331 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::CspTeleServices"); |
|
332 TInt value(0); |
|
333 TInt error = DoGetValues( value, ESsCspGroup2 ); |
|
334 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspTeleServices: error: %d", error); |
|
335 |
|
336 if ( error == KErrNone ) |
|
337 { |
|
338 // Read 8 bits are moved to correct place within a TInt. |
|
339 aParams = ( RMobilePhone::TCspTeleservices ) |
|
340 ( ( value >> 8 ) & 0xff ); |
|
341 } |
|
342 |
|
343 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::CspTeleServices: value: %d", value); |
|
344 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::CspTeleServices"); |
|
345 return error; |
|
346 } |
|
347 |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CustomerServiceProfileCache::ChangedCspTable |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 EXPORT_C TInt RCustomerServiceProfileCache::ChangedCspTable( |
|
354 TDes8& aChangedCsps, |
|
355 TDes8& aNewValues ) |
|
356 { |
|
357 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::ChangedCspTable"); |
|
358 TInt error(KErrNone); |
|
359 if ( !iData || !iOldCspFile ) |
|
360 { |
|
361 // CspFiles did not exist. |
|
362 error = KErrCorrupt; |
|
363 } |
|
364 else |
|
365 { |
|
366 // Set the changed CSP file, done with XORing the old and new CSP file. |
|
367 RMobilePhone::TMobilePhoneCspFileV1Pckg& cspFilePckg = |
|
368 *reinterpret_cast< RMobilePhone::TMobilePhoneCspFileV1Pckg* >( |
|
369 &aChangedCsps ); |
|
370 RMobilePhone::TMobilePhoneCspFileV1& cspFile = cspFilePckg(); |
|
371 |
|
372 cspFile.iCallOfferingServices = ( TUint8 ) ( |
|
373 iData->iCspFile.iCallOfferingServices ^ |
|
374 iOldCspFile->iCallOfferingServices ); |
|
375 |
|
376 cspFile.iCallRestrictionServices = ( TUint8 ) ( |
|
377 iData->iCspFile.iCallRestrictionServices ^ |
|
378 iOldCspFile->iCallRestrictionServices ); |
|
379 |
|
380 cspFile.iOtherSuppServices = ( TUint8 ) ( |
|
381 iData->iCspFile.iOtherSuppServices ^ |
|
382 iOldCspFile->iOtherSuppServices ); |
|
383 |
|
384 cspFile.iCallCompletionServices = ( TUint8 ) ( |
|
385 iData->iCspFile.iCallCompletionServices ^ |
|
386 iOldCspFile->iCallCompletionServices ); |
|
387 |
|
388 cspFile.iTeleservices = ( TUint8 ) ( |
|
389 iData->iCspFile.iTeleservices ^ |
|
390 iOldCspFile->iTeleservices ); |
|
391 |
|
392 cspFile.iCphsTeleservices = ( TUint8 ) ( |
|
393 iData->iCspFile.iCphsTeleservices ^ |
|
394 iOldCspFile->iCphsTeleservices ); |
|
395 |
|
396 cspFile.iCphsFeatures = ( TUint8 ) ( |
|
397 iData->iCspFile.iCphsFeatures ^ |
|
398 iOldCspFile->iCphsFeatures ); |
|
399 |
|
400 cspFile.iNumberIdentServices = ( TUint8 ) ( |
|
401 iData->iCspFile.iNumberIdentServices ^ |
|
402 iOldCspFile->iNumberIdentServices ); |
|
403 |
|
404 cspFile.iPhase2PlusServices = ( TUint8 ) ( |
|
405 iData->iCspFile.iPhase2PlusServices ^ |
|
406 iOldCspFile->iPhase2PlusServices ); |
|
407 |
|
408 cspFile.iValueAddedServices = ( TUint8 ) ( |
|
409 iData->iCspFile.iValueAddedServices ^ |
|
410 iOldCspFile->iValueAddedServices ); |
|
411 |
|
412 |
|
413 // Set the new values. |
|
414 RMobilePhone::TMobilePhoneCspFileV1Pckg& newCspFilePckg = |
|
415 *reinterpret_cast< RMobilePhone::TMobilePhoneCspFileV1Pckg* >( |
|
416 &aNewValues ); |
|
417 RMobilePhone::TMobilePhoneCspFileV1& newCpFile = newCspFilePckg(); |
|
418 |
|
419 newCpFile = iData->iCspFile; |
|
420 } |
|
421 |
|
422 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::ChangedCspTable"); |
|
423 return error; |
|
424 } |
|
425 |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // CustomerServiceProfileCache::DoOpenL |
|
429 // ----------------------------------------------------------------------------- |
|
430 // |
|
431 void RCustomerServiceProfileCache::DoOpenL() |
|
432 { |
|
433 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::DoOpenL"); |
|
434 if ( iData ) |
|
435 { |
|
436 Close(); |
|
437 iData = NULL; |
|
438 } |
|
439 |
|
440 FeatureManager::InitializeLibL(); |
|
441 |
|
442 iData = new ( ELeave ) TCspCacheData; |
|
443 |
|
444 // Retry ETel connection for a few times: |
|
445 TInt error(KErrNone); |
|
446 for ( TInt i = 0 ; i < KCspCacheETelRetryCount ; i++ ) |
|
447 { |
|
448 error = iData->iEtel.Connect(); |
|
449 if ( error == KErrNone ) |
|
450 { |
|
451 break; |
|
452 } |
|
453 User::After( KCspCacheETelRetryTimeout ); |
|
454 } |
|
455 User::LeaveIfError( error ); |
|
456 |
|
457 |
|
458 error = iData->iEtel.LoadPhoneModule( KSSSettingsTSYName ); |
|
459 if (( error != KErrNone ) && ( error != KErrAlreadyExists )) |
|
460 { |
|
461 User::Leave( error ); |
|
462 } |
|
463 User::LeaveIfError( |
|
464 CspCacheDoOpenEtelConnection( iData->iEtel, iData->iPhone ) ); |
|
465 |
|
466 if( iOldCspFile ) |
|
467 { |
|
468 delete iOldCspFile; |
|
469 iOldCspFile = NULL; |
|
470 } |
|
471 // Create and reset old CSP file variable. |
|
472 iOldCspFile = new ( ELeave ) RMobilePhone::TMobilePhoneCspFileV1; |
|
473 DoResetOldCspFile(); |
|
474 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoOpenL"); |
|
475 } |
|
476 |
|
477 |
|
478 // ----------------------------------------------------------------------------- |
|
479 // CustomerServiceProfileCache::DoGetValues |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 TInt RCustomerServiceProfileCache::DoGetValues( TInt& aValue, TSsGroups aGroup ) |
|
483 { |
|
484 __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::DoGetValues"); |
|
485 TInt value(0); |
|
486 TInt error(KErrNone); |
|
487 if ( aGroup == ESsCspGroup1 ) |
|
488 { |
|
489 error = RProperty::Get( KPSUidSSConfig, KSettingsCspCache1, value ); |
|
490 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: ESsCspGroup1 value: %d", value); |
|
491 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: error: %d", error); |
|
492 } |
|
493 else |
|
494 { |
|
495 error = RProperty::Get( KPSUidSSConfig, KSettingsCspCache2, value ); |
|
496 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: ESsCspGroup2 value: %d", value); |
|
497 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: error: %d", error); |
|
498 } |
|
499 // KErrNotFound if Property has not been defined. |
|
500 if ( error == KErrNotFound && aGroup == ESsCspGroup1 ) |
|
501 { |
|
502 error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value ); |
|
503 } |
|
504 else if ( error == KErrNotFound && aGroup == ESsCspGroup2 ) |
|
505 { |
|
506 error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); |
|
507 } |
|
508 |
|
509 if ( error == KErrNone ) |
|
510 { |
|
511 if ( value != KCspCacheNoFile ) |
|
512 { |
|
513 __SSSLOGSTRING("[SSS] ---> GetCustomerServiceProfile"); |
|
514 TRequestStatus status; |
|
515 // GetCustomerServiceProfile status returns KErrNotFound if CSP product profile is OFF. |
|
516 iData->iPhone.GetCustomerServiceProfile( |
|
517 status , |
|
518 iData->iCspFilePckg ); |
|
519 User::WaitForRequest( status ); |
|
520 error = status.Int(); |
|
521 __SSSLOGSTRING1("[SSS] <--- GetCustomerServiceProfile: error: %d", error); |
|
522 |
|
523 if (( error == KErrNotReady ) || ( error == KErrServerBusy )) |
|
524 { |
|
525 return error; |
|
526 } |
|
527 } |
|
528 else // CSP has been read return value, if value is KCspCacheNoFile then return KErrNotSupported. |
|
529 { |
|
530 __SSSLOGSTRING("[SSS] CSP file cannot be found from SIM"); |
|
531 return KErrNotSupported; |
|
532 } |
|
533 |
|
534 if ( error == KErrNone ) |
|
535 { |
|
536 if ( aGroup == ESsCspGroup1 ) |
|
537 { |
|
538 // Read 8 bit groups are saved into one TInt. To make room for |
|
539 // all groups, the first read groups are shifted left. |
|
540 // All the 8 bit data is available in the below keys. |
|
541 |
|
542 // currently only CW supported on the UI level |
|
543 value = iData->iCspFile.iCallCompletionServices << 24; |
|
544 // currently CFU, CFB, CFNRy, CFNRc are supported |
|
545 value += iData->iCspFile.iCallOfferingServices << 16; |
|
546 // complete barring is supported |
|
547 value += iData->iCspFile.iCallRestrictionServices << 8; |
|
548 // contains ALS, 1-bit |
|
549 value += iData->iCspFile.iCphsTeleservices; |
|
550 |
|
551 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: ESsCspGroup1; value: %d", value); |
|
552 } |
|
553 else |
|
554 { |
|
555 // Read 8 bit groups are saved into one TInt. To make room for |
|
556 // all groups, the first read groups are shifted left. |
|
557 |
|
558 // supports SM/CB, Reply path, Del.Conf, Prot.ID, Validity Period |
|
559 value = iData->iCspFile.iTeleservices << 8; |
|
560 // currently PLMN MODE is supported in UI |
|
561 value += iData->iCspFile.iValueAddedServices; |
|
562 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: ESsCspGroup2; value: %d", value); |
|
563 } |
|
564 aValue = value; |
|
565 } |
|
566 else |
|
567 { |
|
568 value = KCspCacheNoFile; |
|
569 error = KErrNotSupported; |
|
570 } |
|
571 } |
|
572 |
|
573 if (( error == KErrNone ) || ( error == KErrNotSupported )) |
|
574 { |
|
575 TInt defError(0); |
|
576 if ( aGroup == ESsCspGroup1 ) |
|
577 { |
|
578 __SSSLOGSTRING("[SSS] DefineAndSetValue -> KSettingsCspCache1"); |
|
579 defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value ); |
|
580 } |
|
581 else |
|
582 { |
|
583 __SSSLOGSTRING("[SSS] DefineAndSetValue -> KSettingsCspCache2"); |
|
584 defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); |
|
585 } |
|
586 |
|
587 // Do not set error if defError is KErrNone. If Define/Set failed then error value is set. |
|
588 if ( defError != KErrNone ) |
|
589 { |
|
590 error = defError; |
|
591 } |
|
592 } |
|
593 |
|
594 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: error: %d", error); |
|
595 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoGetValues"); |
|
596 return error; |
|
597 } |
|
598 |
|
599 // ----------------------------------------------------------------------------- |
|
600 // CustomerServiceProfileCache::DoResetOldCspFile |
|
601 // ----------------------------------------------------------------------------- |
|
602 // |
|
603 void RCustomerServiceProfileCache::DoResetOldCspFile() |
|
604 { |
|
605 if ( iOldCspFile ) |
|
606 { |
|
607 iOldCspFile->iCallOfferingServices = 0; |
|
608 iOldCspFile->iCallRestrictionServices = 0; |
|
609 iOldCspFile->iOtherSuppServices = 0; |
|
610 iOldCspFile->iCallCompletionServices = 0; |
|
611 iOldCspFile->iTeleservices = 0; |
|
612 iOldCspFile->iCphsTeleservices = 0; |
|
613 iOldCspFile->iCphsFeatures = 0; |
|
614 iOldCspFile->iNumberIdentServices = 0; |
|
615 iOldCspFile->iPhase2PlusServices = 0; |
|
616 iOldCspFile->iValueAddedServices = 0; |
|
617 } |
|
618 } |
|
619 |
|
620 // ----------------------------------------------------------------------------- |
|
621 // CustomerServiceProfileCache::DefineAndSetValue |
|
622 // ----------------------------------------------------------------------------- |
|
623 // |
|
624 TInt RCustomerServiceProfileCache::DefineAndSetValue( TUid aCategory, |
|
625 TUint aKey, TInt aValue ) |
|
626 { |
|
627 TInt err = RProperty::Define( |
|
628 aCategory, aKey, |
|
629 RProperty::EInt, KSSSettingReadPolicy, |
|
630 KSSSettingWritePolicy ); |
|
631 |
|
632 if ( err == KErrNone || err == KErrAlreadyExists) |
|
633 { |
|
634 err = RProperty::Set( aCategory, aKey, aValue ); |
|
635 } |
|
636 return err; |
|
637 } |
|
638 |
|
639 // End of File |