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