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: Interface for ALS control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <rmmcustomapi.h> |
|
22 #include <startupdomainpskeys.h> |
|
23 #include <centralrepository.h> |
|
24 #include <sssettingsprivatepskeys.h> // sssettings pub&sub keys. |
|
25 #include <sssettingsprivatecrkeys.h> // sssettings centrep keys. |
|
26 #include <PSVariables.h> |
|
27 |
|
28 #include "csssettingsalsnotifier.h" |
|
29 #include "csssettingsactiveobject.h" |
|
30 #include "sssettingslogger.h" |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CSSSettingsAlsNotifier::CSSSettingsAlsNotifier |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CSSSettingsAlsNotifier::CSSSettingsAlsNotifier( |
|
38 RMobilePhone& aMobilePhone, |
|
39 RMmCustomAPI& aCustomPhone, |
|
40 MCenRepNotifyHandlerCallback& aAlsNotifyHandler ) |
|
41 : CActive( EPriorityStandard ), |
|
42 iMobilePhone( aMobilePhone ), |
|
43 iCustomPhone( aCustomPhone ), |
|
44 iAlsNotifyHandler( &aAlsNotifyHandler ) |
|
45 { |
|
46 CActiveScheduler::Add( this ); |
|
47 } |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CSSSettingsAlsNotifier::ConstructL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 void CSSSettingsAlsNotifier::ConstructL() |
|
55 { |
|
56 iRepository = CRepository::NewL ( KCRUidSupplementaryServiceSettings ); |
|
57 iCenRepNotifyHandler = CCenRepNotifyHandler::NewL( |
|
58 *this, |
|
59 *iRepository, |
|
60 CCenRepNotifyHandler::EIntKey, |
|
61 KSettingsAlsLine ); |
|
62 iCenRepNotifyHandler->StartListeningL(); |
|
63 |
|
64 TInt error(KErrNone); |
|
65 error = RProperty::Define( |
|
66 KPSUidSSConfig, |
|
67 KSettingsPPSupportsALS, |
|
68 RProperty::EInt ); |
|
69 if( ( error != KErrNone ) && ( error != KErrAlreadyExists ) ) |
|
70 { |
|
71 User::Leave ( error ); |
|
72 } |
|
73 error = RProperty::Define( |
|
74 KPSUidSSConfig, |
|
75 KSettingsSIMSupportsALS, |
|
76 RProperty::EInt ); |
|
77 if( ( error != KErrNone ) && ( error != KErrAlreadyExists ) ) |
|
78 { |
|
79 User::Leave ( error ); |
|
80 } |
|
81 |
|
82 iPPSupportsAlNotifier = CSSSettingsActiveObject::NewL( |
|
83 KPSUidSSConfig, |
|
84 KSettingsPPSupportsALS, |
|
85 *this ); |
|
86 iSimSupportsAlsNotifier = CSSSettingsActiveObject::NewL( |
|
87 KPSUidSSConfig, |
|
88 KSettingsSIMSupportsALS, |
|
89 *this ); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CSSSettingsAlsNotifier::NewL |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CSSSettingsAlsNotifier* CSSSettingsAlsNotifier::NewL( |
|
97 RMobilePhone& aMobilePhone, |
|
98 RMmCustomAPI& aCustomPhone, |
|
99 MCenRepNotifyHandlerCallback& aAlsNotifyHandler ) |
|
100 { |
|
101 CSSSettingsAlsNotifier* self = |
|
102 new ( ELeave ) CSSSettingsAlsNotifier( |
|
103 aMobilePhone, |
|
104 aCustomPhone, |
|
105 aAlsNotifyHandler ); |
|
106 |
|
107 CleanupStack::PushL( self ); |
|
108 self->ConstructL(); |
|
109 CleanupStack::Pop(); |
|
110 |
|
111 return self; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CSSSettingsAlsNotifier::~CSSSettingsAlsNotifier |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 CSSSettingsAlsNotifier::~CSSSettingsAlsNotifier() |
|
119 { |
|
120 delete iPPSupportsAlNotifier; |
|
121 delete iSimSupportsAlsNotifier; |
|
122 |
|
123 if( iCenRepNotifyHandler ) |
|
124 { |
|
125 iCenRepNotifyHandler->StopListening(); |
|
126 } |
|
127 delete iCenRepNotifyHandler; |
|
128 delete iRepository; |
|
129 |
|
130 Cancel(); |
|
131 // Do close after active request has been cancelled. |
|
132 iMobilePhone.Close(); |
|
133 iCustomPhone.Close(); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CSSSettingsAlsNotifier::RunL |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CSSSettingsAlsNotifier::RunL() |
|
141 { |
|
142 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::RunL"); |
|
143 TInt error = iStatus.Int(); |
|
144 if (( error == KErrCancel ) || ( error == KErrNotSupported )) |
|
145 { |
|
146 return; |
|
147 } |
|
148 |
|
149 // Reset the request: |
|
150 RMobilePhone::TMobilePhoneALSLine newLine = iSimActiveAls; |
|
151 iMobilePhone.NotifyALSLineChange( iStatus, iSimActiveAls ); |
|
152 SetActive(); |
|
153 |
|
154 if ( error == KErrNone ) |
|
155 { |
|
156 TSSSettingsAlsValue newValue = ESSSettingsAlsNotSupported; |
|
157 if ( newLine == RMobilePhone::EAlternateLinePrimary ) |
|
158 { |
|
159 newValue = ESSSettingsAlsPrimary; |
|
160 } |
|
161 else if ( newLine == RMobilePhone::EAlternateLineAuxiliary ) |
|
162 { |
|
163 newValue = ESSSettingsAlsAlternate; |
|
164 } |
|
165 else |
|
166 { |
|
167 newValue = ESSSettingsAlsNotSupported; |
|
168 } |
|
169 |
|
170 // Inform observer. |
|
171 iAlsNotifyHandler->HandleNotifyInt( |
|
172 KSettingsAlsLine, |
|
173 newValue ); |
|
174 } |
|
175 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::RunL"); |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // CSSSettingsAlsNotifier::DoCancel |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void CSSSettingsAlsNotifier::DoCancel() |
|
183 { |
|
184 iMobilePhone.CancelAsyncRequest( EMobilePhoneNotifyALSLineChange ); |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CSSSettingsAlsNotifier::NotifyAlsChange |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 TInt CSSSettingsAlsNotifier::NotifyAlsChange() |
|
192 { |
|
193 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::NotifyAlsChange"); |
|
194 TInt error = EnsureAlsStatus(); |
|
195 if ( error == KErrNone ) |
|
196 { |
|
197 error = iPPSupportsAlNotifier->NotifyKeyChange(); |
|
198 |
|
199 if ( error == KErrNone || error == KErrAlreadyExists ) |
|
200 { |
|
201 error = iSimSupportsAlsNotifier->NotifyKeyChange(); |
|
202 if ( error != KErrNone && error != KErrAlreadyExists ) |
|
203 { |
|
204 iPPSupportsAlNotifier->CancelNotify(); |
|
205 } |
|
206 } |
|
207 if ( error == KErrNone || error == KErrAlreadyExists ) |
|
208 { |
|
209 // Add notifier to Etel side if supported |
|
210 if ( !IsActive() && iSimSupportAls ) |
|
211 { |
|
212 iMobilePhone.NotifyALSLineChange( iStatus, iSimActiveAls ); |
|
213 SetActive(); |
|
214 |
|
215 // Everything was ok, so inform that. |
|
216 error = KErrNone; |
|
217 } |
|
218 } |
|
219 } |
|
220 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::NotifyAlsChange"); |
|
221 return error; |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CSSSettingsAlsNotifier::CancelNotify |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 void CSSSettingsAlsNotifier::CancelNotify() |
|
229 { |
|
230 iCenRepNotifyHandler->StopListening(); |
|
231 iPPSupportsAlNotifier->CancelNotify(); |
|
232 iSimSupportsAlsNotifier->CancelNotify(); |
|
233 Cancel(); |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CSSSettingsAlsNotifier::SetAlsValue |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 TInt CSSSettingsAlsNotifier::SetAlsValue( TSSSettingsAlsValue aValue ) |
|
241 { |
|
242 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue"); |
|
243 TInt error = EnsureAlsStatus(); |
|
244 if ( error != KErrNone ) |
|
245 { |
|
246 return error; |
|
247 } |
|
248 // If ALS not supported... |
|
249 if ( !iPPSupportAls && !iSimSupportAls && !iAlsCSPSupport ) |
|
250 { |
|
251 aValue = ESSSettingsAlsNotSupported; |
|
252 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue: aValue: %d", aValue); |
|
253 return KErrNone; |
|
254 } |
|
255 |
|
256 // Check if aValue is corrupted. |
|
257 if (( aValue < ESSSettingsAlsNotSupported ) || |
|
258 ( aValue > ESSSettingsAlsAlternate )) |
|
259 { |
|
260 return KErrArgument; |
|
261 } |
|
262 |
|
263 // If ALS is supported on SIM, use that. |
|
264 if ( iSimSupportAls ) |
|
265 { |
|
266 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue: SIM ALS supported"); |
|
267 // Write to ETel |
|
268 RMobilePhone::TMobilePhoneALSLine simAlsLine; |
|
269 switch ( aValue ) |
|
270 { |
|
271 case ESSSettingsAlsPrimary: |
|
272 simAlsLine = RMobilePhone::EAlternateLinePrimary; |
|
273 break; |
|
274 case ESSSettingsAlsAlternate: |
|
275 simAlsLine = RMobilePhone::EAlternateLineAuxiliary; |
|
276 break; |
|
277 default: |
|
278 return KErrNotSupported; |
|
279 } |
|
280 TRequestStatus status; |
|
281 iMobilePhone.SetALSLine( status, simAlsLine ); |
|
282 User::WaitForRequest( status ); |
|
283 error = status.Int(); |
|
284 } |
|
285 else |
|
286 { |
|
287 error = iRepository->Set( KSettingsAlsLine, aValue ); |
|
288 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::SetAlsValue: aValue: %d", aValue); |
|
289 } |
|
290 |
|
291 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::SetAlsValue"); |
|
292 return error; |
|
293 } |
|
294 |
|
295 // ----------------------------------------------------------------------------- |
|
296 // CSSSettingsAlsNotifier::GetAlsValue |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 TInt CSSSettingsAlsNotifier::GetAlsValue( TSSSettingsAlsValue& aValue ) |
|
300 { |
|
301 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue"); |
|
302 TInt error = EnsureAlsStatus(); |
|
303 if ( error != KErrNone ) |
|
304 { |
|
305 return error; |
|
306 } |
|
307 |
|
308 // If ALS not supported... |
|
309 if ( !iPPSupportAls && !iSimSupportAls && !iAlsCSPSupport ) |
|
310 { |
|
311 aValue = ESSSettingsAlsNotSupported; |
|
312 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue: aValue: %d", aValue); |
|
313 return KErrNone; |
|
314 } |
|
315 |
|
316 // Check if aValue is corrupted. |
|
317 if (( aValue < ESSSettingsAlsNotSupported ) || |
|
318 ( aValue > ESSSettingsAlsAlternate )) |
|
319 { |
|
320 return KErrArgument; |
|
321 } |
|
322 |
|
323 // If ALS is supported on SIM, use that. |
|
324 if ( iSimSupportAls ) |
|
325 { |
|
326 // Get from ETel; |
|
327 RMobilePhone::TMobilePhoneALSLine simAlsLine; |
|
328 error = iMobilePhone.GetALSLine( simAlsLine ); |
|
329 if ( error != KErrNone ) |
|
330 { |
|
331 return error; |
|
332 } |
|
333 switch ( simAlsLine ) |
|
334 { |
|
335 case RMobilePhone::EAlternateLineAuxiliary: |
|
336 aValue = ESSSettingsAlsAlternate; |
|
337 break; |
|
338 case RMobilePhone::EAlternateLinePrimary: |
|
339 aValue = ESSSettingsAlsPrimary; |
|
340 break; |
|
341 default: |
|
342 __ASSERT_DEBUG( EFalse , Panic( |
|
343 SSSettingsPanicConflictInAls ) ); |
|
344 aValue = ESSSettingsAlsNotSupported; |
|
345 error = KErrCorrupt; |
|
346 break; |
|
347 } |
|
348 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue: SimAls supported: aValue: %d", aValue); |
|
349 } |
|
350 else |
|
351 { |
|
352 error = iRepository->Get( KSettingsAlsLine, (TInt&)aValue ); |
|
353 |
|
354 if ( error != KErrNone ) |
|
355 { |
|
356 return error; |
|
357 } |
|
358 |
|
359 TInt usedLine = aValue; |
|
360 |
|
361 // If used SIM doesn't support ALS set ESSSettingsAlsPrimary line to use. |
|
362 if ( error == KErrNone && usedLine == ESSSettingsAlsNotSupported ) |
|
363 { |
|
364 // Set default value |
|
365 error = SetAlsValue( ESSSettingsAlsPrimary ); |
|
366 if ( error == KErrNone ) |
|
367 { |
|
368 aValue = ESSSettingsAlsPrimary; |
|
369 } |
|
370 } |
|
371 else if (( aValue < ESSSettingsAlsNotSupported ) || |
|
372 ( aValue > ESSSettingsAlsAlternate )) |
|
373 { |
|
374 error = KErrCorrupt; |
|
375 } |
|
376 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsValue: aValue: %d", aValue); |
|
377 } |
|
378 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::GetAlsValue"); |
|
379 return error; |
|
380 } |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CSSSettingsAlsNotifier::GetAlsSupport |
|
384 // ----------------------------------------------------------------------------- |
|
385 // |
|
386 void CSSSettingsAlsNotifier::GetAlsSupport( |
|
387 TBool& aPPSupport, TBool& aSimSupport, TBool& aCSPSupport, TInt& aCSPError ) |
|
388 { |
|
389 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport"); |
|
390 TInt error = EnsureAlsStatus(); |
|
391 |
|
392 if( error != KErrNone ) |
|
393 { |
|
394 __SSSLOGSTRING("[SSS] If we aren't able to get ALS status we can not support it"); |
|
395 // If we aren't able to get ALS status we can not support it. |
|
396 aPPSupport = EFalse; |
|
397 aSimSupport = EFalse; |
|
398 aCSPSupport = EFalse; |
|
399 aCSPError = iAlsCSPError; |
|
400 return; |
|
401 } |
|
402 |
|
403 aPPSupport = iPPSupportAls; |
|
404 aSimSupport = iSimSupportAls; |
|
405 aCSPSupport = iAlsCSPSupport; |
|
406 aCSPError = iAlsCSPError; |
|
407 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport: iPPSupportAls: %d", iPPSupportAls); |
|
408 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport: iSimSupportAls: %d", iSimSupportAls); |
|
409 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::GetAlsSupport: iAlsCSPSupport: %d", iAlsCSPSupport); |
|
410 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::GetAlsSupport"); |
|
411 } |
|
412 |
|
413 // ----------------------------------------------------------------------------- |
|
414 // CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 TInt CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile( |
|
418 TBool& aIsAlsSopportedInPP ) |
|
419 { |
|
420 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile"); |
|
421 RMmCustomAPI::TAlsSupport ppAlsSupport; |
|
422 |
|
423 TInt error = iCustomPhone.CheckAlsPpSupport( ppAlsSupport ); |
|
424 |
|
425 if ( ( error == KErrNone ) && |
|
426 ( ppAlsSupport == RMmCustomAPI::EAlsSupportOn ) ) |
|
427 { |
|
428 aIsAlsSopportedInPP = ETrue; |
|
429 } |
|
430 else |
|
431 { |
|
432 aIsAlsSopportedInPP = EFalse; |
|
433 } |
|
434 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile: aIsAlsSopportedInPP: %d", aIsAlsSopportedInPP); |
|
435 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::CheckAlsSupportInProductProfile"); |
|
436 return error; |
|
437 } |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // CSSSettingsAlsNotifier::CheckAlsSupportInSim |
|
441 // ----------------------------------------------------------------------------- |
|
442 // |
|
443 TInt CSSSettingsAlsNotifier::CheckAlsSupportInSim( |
|
444 TBool& aIsAlsSopportedInSim ) |
|
445 { |
|
446 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInSim"); |
|
447 RMobilePhone::TMobilePhoneALSLine simAlsSupport; |
|
448 TInt error = iMobilePhone.GetALSLine( simAlsSupport ); |
|
449 |
|
450 if (( error != KErrNone ) || |
|
451 ( simAlsSupport == RMobilePhone::EAlternateLineUnknown ) || |
|
452 ( simAlsSupport == RMobilePhone::EAlternateLineNotAvailable )) |
|
453 { |
|
454 aIsAlsSopportedInSim = EFalse; |
|
455 } |
|
456 else |
|
457 { |
|
458 aIsAlsSopportedInSim = ETrue; |
|
459 } |
|
460 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::CheckAlsSupportInSim: aIsAlsSopportedInSim: %d", aIsAlsSopportedInSim); |
|
461 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::CheckAlsSupportInSim"); |
|
462 return error; |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CSSSettingsAlsNotifier::EnsureAlsStatus |
|
467 // ----------------------------------------------------------------------------- |
|
468 // |
|
469 TInt CSSSettingsAlsNotifier::EnsureAlsStatus() |
|
470 { |
|
471 RMobilePhone::TCspCPHSTeleservices params = ( RMobilePhone::TCspCPHSTeleservices )0; |
|
472 TInt error(KErrNone); |
|
473 TInt simState(0); |
|
474 TBool savePPSimAls(0); |
|
475 TBool saveSimAls(0); |
|
476 |
|
477 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus"); |
|
478 if ( iAlsStatusChecked ) |
|
479 { |
|
480 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus - Already checked: %d", iAlsStatusChecked); |
|
481 return KErrNone; |
|
482 } |
|
483 |
|
484 error = RProperty::Get( KPSUidStartup, KPSSimStatus, simState ); |
|
485 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus - KPSUidSIMStatusValue: %d", simState); |
|
486 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus - KPSUidSIMStatusValue Error: %d", error); |
|
487 |
|
488 if ( error == KErrNone ) |
|
489 { |
|
490 // Make sure that SIM state is OK otherwise parameters coming from SIM are mess. |
|
491 if ( simState ==ESimUsable ) |
|
492 { |
|
493 // Get Als support from Product Profile. |
|
494 error = CheckAlsSupportInProductProfile( iPPSupportAls ); |
|
495 if ( error == KErrNone ) |
|
496 { |
|
497 savePPSimAls = ETrue; |
|
498 } |
|
499 if ( error != KErrNone ) |
|
500 { |
|
501 return error; |
|
502 } |
|
503 |
|
504 // Get Als support from SIM. |
|
505 error = CheckAlsSupportInSim( iSimSupportAls ); |
|
506 if ( error == KErrNone ) |
|
507 { |
|
508 saveSimAls = ETrue; |
|
509 } |
|
510 if ( ( error != KErrNone ) && ( error != KErrNotFound ) ) |
|
511 { |
|
512 return error; |
|
513 } |
|
514 |
|
515 // Open connection RCustomerServiceProfileCache. |
|
516 RCustomerServiceProfileCache alsProfileCache; |
|
517 error = alsProfileCache.Open(); |
|
518 if ( error != KErrNone ) |
|
519 { |
|
520 return error; |
|
521 } |
|
522 |
|
523 // Get ALS CSP bit from cache. |
|
524 iAlsCSPError = alsProfileCache.CspCPHSTeleservices( params ); |
|
525 |
|
526 if ( iAlsCSPError == KErrNone || iAlsCSPError == KErrNotSupported ) |
|
527 { |
|
528 // Checks CSP ALS support. |
|
529 iAlsCSPSupport = CheckIfAlsCSPSupported( params ); |
|
530 } |
|
531 // If ETEL/TSY responses with error KErrNotReady/KErrServerBusy then CSP value is not correct one |
|
532 // and iAlsStatusChecked is set to EFalse. |
|
533 else if ( iAlsCSPError == KErrNotReady || iAlsCSPError == KErrServerBusy ) |
|
534 { |
|
535 iAlsStatusChecked = EFalse; |
|
536 alsProfileCache.Close(); |
|
537 return iAlsCSPError; |
|
538 } |
|
539 // Close connection RCustomerServiceProfileCache. |
|
540 alsProfileCache.Close(); |
|
541 |
|
542 // Save PP and SIM als values to P&S. |
|
543 if ( savePPSimAls ) |
|
544 { |
|
545 error = RProperty::Set( KPSUidSSConfig, KSettingsPPSupportsALS, iPPSupportAls ); |
|
546 if ( error != KErrNone ) |
|
547 { |
|
548 return error; |
|
549 } |
|
550 } |
|
551 |
|
552 if ( saveSimAls ) |
|
553 { |
|
554 error = RProperty::Set( KPSUidSSConfig, KSettingsSIMSupportsALS, iSimSupportAls ); |
|
555 if ( error != KErrNone ) |
|
556 { |
|
557 return error; |
|
558 } |
|
559 } |
|
560 |
|
561 iAlsStatusChecked = ETrue; |
|
562 } |
|
563 else |
|
564 { |
|
565 iAlsStatusChecked = EFalse; |
|
566 } |
|
567 } |
|
568 __SSSLOGSTRING1("[SSS]--> CSSSettingsAlsNotifier::EnsureAlsStatus: iAlsStatusChecked: %d", iAlsStatusChecked); |
|
569 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::EnsureAlsStatus"); |
|
570 return KErrNone; |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------------------------- |
|
574 // CSSSettingsAlsNotifier::CheckIfAlsCSPSupported |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 TBool CSSSettingsAlsNotifier::CheckIfAlsCSPSupported( |
|
578 const RMobilePhone::TCspCPHSTeleservices aContainer ) const |
|
579 { |
|
580 TBool supported(EFalse); |
|
581 |
|
582 if ( ( aContainer & RMobilePhone::KCspALS ) != 0 ) |
|
583 { |
|
584 supported = ETrue; |
|
585 } |
|
586 return supported; |
|
587 } |
|
588 |
|
589 // ----------------------------------------------------------------------------- |
|
590 // CSSSettingsAlsNotifier::HandleNotifyInt |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 void CSSSettingsAlsNotifier::HandleNotifyInt( TUint32 aId, TInt /*aNewValue*/ ) |
|
594 { |
|
595 __SSSLOGSTRING("[SSS] -->CSSSettingsAlsNotifier::HandleNotifyInt"); |
|
596 if ( aId == KSettingsAlsLine ) |
|
597 { |
|
598 iAlsStatusChecked = EFalse; |
|
599 EnsureAlsStatus(); |
|
600 |
|
601 // Inform others |
|
602 TSSSettingsAlsValue newLine = ESSSettingsAlsNotSupported; |
|
603 if ( GetAlsValue( newLine ) == KErrNone ) |
|
604 { |
|
605 iAlsNotifyHandler->HandleNotifyInt( |
|
606 KSettingsAlsLine, |
|
607 newLine ); |
|
608 } |
|
609 } |
|
610 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::HandleNotifyInt"); |
|
611 } |
|
612 |
|
613 // ----------------------------------------------------------------------------- |
|
614 // CSSSettingsAlsNotifier::HandleNotifyError |
|
615 // ----------------------------------------------------------------------------- |
|
616 // |
|
617 void CSSSettingsAlsNotifier::HandleNotifyError( TUint32 aId, TInt /*aError*/, |
|
618 CCenRepNotifyHandler* /*aHandler*/ ) |
|
619 { |
|
620 if ( aId == KSettingsAlsLine ) |
|
621 { |
|
622 // Here you could call the below, if you are sure that it do not cause |
|
623 // eternal loop |
|
624 // TRAPD( error, aHandler->StartListeningL() ); |
|
625 } |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CSSSettingsAlsNotifier::HandlePubSubNotify |
|
630 // ----------------------------------------------------------------------------- |
|
631 // |
|
632 void CSSSettingsAlsNotifier::HandlePubSubNotify( const TUid aUid, const TUint32 aKeyId ) |
|
633 { |
|
634 if ( aUid == KPSUidSSConfig ) |
|
635 { |
|
636 if ( ( aKeyId == KSettingsPPSupportsALS ) || |
|
637 ( aKeyId == KSettingsSIMSupportsALS ) ) |
|
638 { |
|
639 |
|
640 if ( iAlsStatusChecked == EFalse ) |
|
641 { |
|
642 EnsureAlsStatus(); |
|
643 } |
|
644 |
|
645 // Inform others |
|
646 TSSSettingsAlsValue newValue = ESSSettingsAlsNotSupported; |
|
647 if ( GetAlsValue( newValue ) == KErrNone ) |
|
648 { |
|
649 iAlsNotifyHandler->HandleNotifyInt( |
|
650 KSettingsAlsLine, |
|
651 newValue ); |
|
652 } |
|
653 } |
|
654 } |
|
655 } |
|
656 |
|
657 // ----------------------------------------------------------------------------- |
|
658 // CSSSettingsAlsNotifier::HandleRefresh |
|
659 // ----------------------------------------------------------------------------- |
|
660 TInt CSSSettingsAlsNotifier::HandleRefresh() |
|
661 { |
|
662 __SSSLOGSTRING("[SSS]--> CSSSettingsAlsNotifier::HandleRefresh"); |
|
663 TInt error = CheckAlsSupportInProductProfile( iPPSupportAls ); |
|
664 if ( error == KErrNone ) |
|
665 { |
|
666 error = RProperty::Set( |
|
667 KPSUidSSConfig, |
|
668 KSettingsPPSupportsALS, |
|
669 iPPSupportAls ); |
|
670 } |
|
671 |
|
672 if ( error != KErrNone ) |
|
673 { |
|
674 return error; |
|
675 } |
|
676 |
|
677 error = CheckAlsSupportInSim( iSimSupportAls ); |
|
678 if ( error == KErrNone ) |
|
679 { |
|
680 error = RProperty::Set( |
|
681 KPSUidSSConfig, |
|
682 KSettingsSIMSupportsALS, |
|
683 iSimSupportAls ); |
|
684 } |
|
685 |
|
686 if ( error != KErrNone ) |
|
687 { |
|
688 return error; |
|
689 } |
|
690 |
|
691 // Inform others |
|
692 TSSSettingsAlsValue newLine; |
|
693 error = GetAlsValue( newLine ); |
|
694 if ( error == KErrNone ) |
|
695 { |
|
696 SetAlsValue( newLine ); |
|
697 } |
|
698 |
|
699 __SSSLOGSTRING("[SSS] <--CSSSettingsAlsNotifier::HandleRefresh"); |
|
700 return error; |
|
701 } |
|
702 |
|
703 // End of File |
|