|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Operator/Service provider name publisher. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <StringLoader.h> |
|
20 #include <centralrepository.h> |
|
21 #include <avkondomainpskeys.h> |
|
22 #include <e32property.h> |
|
23 #include <aidevstaplgres.rsg> |
|
24 #include "aioperatornamepublisher.h" |
|
25 #include "ainetworkinfolistener.h" |
|
26 #include "aidevicestatuscontentmodel.h" |
|
27 #include "aiprioritizer.h" |
|
28 #include "ainwidpriorities.h" |
|
29 #include "activeidle2domaincrkeys.h" |
|
30 |
|
31 //Delay used to animate |
|
32 const TInt KCleanOperationDelay = 2 * 1000000; |
|
33 |
|
34 |
|
35 const TInt KBitShiftByFour = 4; |
|
36 const TInt KIsDigitLowLimit = 0; |
|
37 const TInt KIsDigitHighLimit = 10; |
|
38 |
|
39 LOCAL_C void AppendDigit( TDes& aCode, TInt aValue ) |
|
40 { |
|
41 // add a digit if valid value. |
|
42 if ( aValue >= KIsDigitLowLimit && aValue < KIsDigitHighLimit ) |
|
43 { |
|
44 aCode.AppendNumUC( static_cast<TUint8>( aValue ) ); |
|
45 } |
|
46 } |
|
47 |
|
48 |
|
49 //Convert string to integer. |
|
50 LOCAL_C TInt StrToInt( const TDesC& aDesc ) |
|
51 { |
|
52 TLex lex( aDesc ); |
|
53 |
|
54 TInt ret; |
|
55 TInt err = lex.Val( ret ); |
|
56 |
|
57 if( err != KErrNone ) |
|
58 { |
|
59 ret = KErrNotFound; |
|
60 } |
|
61 return ret; |
|
62 } |
|
63 |
|
64 |
|
65 // ======== MEMBER FUNCTIONS ======== |
|
66 |
|
67 CAiOperatorNamePublisher::CAiOperatorNamePublisher() |
|
68 : iPriority( EAiInvalidPriority ) |
|
69 { |
|
70 } |
|
71 |
|
72 |
|
73 void CAiOperatorNamePublisher::ConstructL() |
|
74 { |
|
75 iListener = CAiNetworkInfoListener::InstanceL(); |
|
76 iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
77 } |
|
78 |
|
79 |
|
80 CAiOperatorNamePublisher* CAiOperatorNamePublisher::NewL() |
|
81 { |
|
82 CAiOperatorNamePublisher* self = new( ELeave ) CAiOperatorNamePublisher; |
|
83 CleanupStack::PushL( self ); |
|
84 self->ConstructL(); |
|
85 CleanupStack::Pop( self ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 |
|
90 CAiOperatorNamePublisher::~CAiOperatorNamePublisher() |
|
91 { |
|
92 if( iListener ) |
|
93 { |
|
94 iListener->RemoveObserver( *this ); |
|
95 iListener->Release(); |
|
96 } |
|
97 if( iPeriodic ) |
|
98 { |
|
99 iPeriodic->Cancel(); |
|
100 delete iPeriodic; |
|
101 } |
|
102 } |
|
103 |
|
104 |
|
105 void CAiOperatorNamePublisher::ResumeL() |
|
106 { |
|
107 iListener->AddObserverL( *this ); |
|
108 } |
|
109 |
|
110 |
|
111 void CAiOperatorNamePublisher::HandleNetworkInfoChange( |
|
112 const MNWMessageObserver::TNWMessages& /*aMessage*/, |
|
113 const TNWInfo& /*aInfo*/, |
|
114 const TBool aShowOpInd ) |
|
115 { |
|
116 if( aShowOpInd ) |
|
117 { |
|
118 TRAP_IGNORE ( RefreshL( ETrue )); |
|
119 } |
|
120 else |
|
121 { |
|
122 TRAP_IGNORE ( |
|
123 iPrioritizer->TryToCleanL( *iBroadcaster, |
|
124 EAiDeviceStatusContentNetworkIdentity, |
|
125 iPriority )); |
|
126 } |
|
127 |
|
128 } |
|
129 |
|
130 |
|
131 void CAiOperatorNamePublisher::Subscribe( MAiContentObserver& /*aObserver*/, |
|
132 MAiPropertyExtension& aExtension, |
|
133 MAiPublishPrioritizer& aPrioritizer, |
|
134 MAiPublisherBroadcaster& aBroadcaster ) |
|
135 { |
|
136 iExtension = &aExtension; |
|
137 iPrioritizer = &aPrioritizer; |
|
138 iBroadcaster = &aBroadcaster; |
|
139 } |
|
140 |
|
141 |
|
142 void CAiOperatorNamePublisher::RefreshL( TBool aClean ) |
|
143 { |
|
144 iSuccess = EFalse; |
|
145 |
|
146 if( aClean ) |
|
147 { |
|
148 iPrioritizer->TryToCleanL( *iBroadcaster, |
|
149 EAiDeviceStatusContentNetworkIdentity, |
|
150 iPriority ); |
|
151 } |
|
152 |
|
153 const TNWInfo& nwInfo = iListener->NetworkInfo(); |
|
154 |
|
155 #if defined(WINSCW) || defined(__WINS__) |
|
156 // Show operator name in emulator |
|
157 #else |
|
158 if ( nwInfo.iRegistrationStatus == ENWNotRegisteredNoService || |
|
159 nwInfo.iRegistrationStatus == ENWRegistrationUnknown || |
|
160 !iListener->IsOperatorIndicatorAllowed() ) |
|
161 { |
|
162 return; |
|
163 } |
|
164 #endif |
|
165 |
|
166 TBool showSimultaneously = EFalse; |
|
167 |
|
168 TUid uid = { KCRUidActiveIdleLV }; |
|
169 CRepository* cenRep = CRepository::NewLC( uid ); |
|
170 TInt err = cenRep->Get( KAISPNAndEONS, showSimultaneously ); |
|
171 if( err ) |
|
172 { |
|
173 showSimultaneously = EFalse; |
|
174 } |
|
175 CleanupStack::PopAndDestroy( cenRep ); |
|
176 |
|
177 const TBool isKeyLockEnabled = IsKeyLockEnabled(); |
|
178 |
|
179 //Check if PLMN must be shown. |
|
180 |
|
181 const TBool showPLMN = nwInfo.iServiceProviderNameDisplayReq & ENWDisplayPLMNRequired; |
|
182 |
|
183 TBool isInSPDI = EFalse; |
|
184 TBool showSPN = EFalse; |
|
185 |
|
186 //Check if we are in SPDI and SPN (Service Provider Name) must be shown. |
|
187 CheckServiceProviderDisplayListStatus( StrToInt( nwInfo.iCountryCode ), |
|
188 StrToInt( nwInfo.iNetworkId ), |
|
189 showSPN, |
|
190 isInSPDI ); |
|
191 |
|
192 //SPN must be shown if it is defined in PLMNField or if it is set in service provider name |
|
193 //display requirements. |
|
194 showSPN = |
|
195 showSPN || |
|
196 ( nwInfo.iServiceProviderNameDisplayReq & ENWDisplaySPNRequired ); |
|
197 |
|
198 |
|
199 #if defined(WINSCW) || defined(__WINS__) |
|
200 _LIT( KOperator, "Operator" ); |
|
201 const TPtrC serviceProviderName( KOperator() ); |
|
202 #else |
|
203 const TPtrC serviceProviderName = nwInfo.iSPName; |
|
204 #endif |
|
205 |
|
206 if ( ( !IsRoaming() || isInSPDI ) && serviceProviderName.Length() ) |
|
207 { |
|
208 if ( showPLMN ) |
|
209 { |
|
210 if ( showSimultaneously ) |
|
211 { |
|
212 //spn & plmn (SPN.And.EONS) |
|
213 HBufC* operatorName = ConstructOperatorNameStringL( serviceProviderName ); |
|
214 CleanupStack::PushL( operatorName ); |
|
215 |
|
216 iPriority = EAiServiceProviderName; |
|
217 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
218 EAiDeviceStatusContentNetworkIdentity, |
|
219 operatorName->Des(), |
|
220 iPriority ); |
|
221 CleanupStack::PopAndDestroy(operatorName); |
|
222 } |
|
223 else if( isKeyLockEnabled ) |
|
224 { |
|
225 //only plmn |
|
226 ShowNetworkIdentityNameL( ETrue ); |
|
227 } |
|
228 else |
|
229 { |
|
230 //spn & plmn (SPN.And.EONS.No) |
|
231 iPriority = EAiServiceProviderName; |
|
232 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
233 EAiDeviceStatusContentNetworkIdentity, |
|
234 serviceProviderName, |
|
235 iPriority ); |
|
236 StartDelayedPLMNOperation();//to publish PLMN name |
|
237 } |
|
238 } |
|
239 else |
|
240 { |
|
241 //only spn |
|
242 iPriority = EAiServiceProviderName; |
|
243 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
244 EAiDeviceStatusContentNetworkIdentity, |
|
245 serviceProviderName, |
|
246 iPriority ); |
|
247 iSuccess = ETrue; |
|
248 } |
|
249 } |
|
250 else |
|
251 { |
|
252 if ( showSPN && serviceProviderName.Length() ) |
|
253 { |
|
254 if ( showSimultaneously ) |
|
255 { |
|
256 //spn & plmn (SPN.And.EONS) |
|
257 HBufC* operatorName = ConstructOperatorNameStringL( serviceProviderName ); |
|
258 CleanupStack::PushL( operatorName ); |
|
259 |
|
260 iPriority = EAiServiceProviderName; |
|
261 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
262 EAiDeviceStatusContentNetworkIdentity, |
|
263 operatorName->Des(), |
|
264 iPriority ); |
|
265 CleanupStack::PopAndDestroy(operatorName); |
|
266 } |
|
267 else if( isKeyLockEnabled ) |
|
268 { |
|
269 //only plmn |
|
270 ShowNetworkIdentityNameL( ETrue ); |
|
271 } |
|
272 else |
|
273 { |
|
274 //spn & plmn (SPN.And.EONS.No) |
|
275 iPriority = EAiServiceProviderName; |
|
276 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
277 EAiDeviceStatusContentNetworkIdentity, |
|
278 serviceProviderName, |
|
279 iPriority ); |
|
280 StartDelayedPLMNOperation();//to publish PLMN name |
|
281 } |
|
282 } |
|
283 else |
|
284 { |
|
285 //only plmn |
|
286 ShowNetworkIdentityNameL( ETrue ); |
|
287 } |
|
288 } |
|
289 } |
|
290 |
|
291 HBufC* CAiOperatorNamePublisher::ConstructOperatorNameStringL( const TDesC& aServiceProviderName ) |
|
292 { |
|
293 ShowNetworkIdentityNameL( EFalse ); |
|
294 |
|
295 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
296 HBufC* opnSpnFormatString = StringLoader::LoadLC( R_AI_OPN_SPN_SEPARATOR_FORMAT, |
|
297 coeEnv ); |
|
298 HBufC* opnSpnStringTemp = HBufC::NewLC( iNetworkIdentityName.Length() |
|
299 + opnSpnFormatString->Length() |
|
300 + aServiceProviderName.Length() ); |
|
301 |
|
302 HBufC* opnSpnString = HBufC::NewLC( iNetworkIdentityName.Length() |
|
303 + opnSpnFormatString->Length() |
|
304 + aServiceProviderName.Length() ); |
|
305 |
|
306 TPtr opnSpnStringTempPtr = opnSpnStringTemp->Des(); |
|
307 StringLoader::Format( opnSpnStringTempPtr, |
|
308 *opnSpnFormatString, |
|
309 1, |
|
310 aServiceProviderName ); |
|
311 |
|
312 TPtr opnSpnStringPtr = opnSpnString->Des(); |
|
313 StringLoader::Format( opnSpnStringPtr, |
|
314 opnSpnStringTempPtr, |
|
315 0, |
|
316 iNetworkIdentityName ); |
|
317 |
|
318 CleanupStack::Pop( opnSpnString ); |
|
319 CleanupStack::PopAndDestroy( opnSpnStringTemp ); //opnSpnStringTemp, opnSpnFormatString |
|
320 CleanupStack::PopAndDestroy( opnSpnFormatString ); |
|
321 |
|
322 return opnSpnString; |
|
323 } |
|
324 |
|
325 |
|
326 |
|
327 void CAiOperatorNamePublisher::ShowNetworkIdentityNameL( TBool aTryToPublish ) |
|
328 { |
|
329 const TNWInfo& nwInfo = iListener->NetworkInfo(); |
|
330 |
|
331 iNetworkIdentityName.Set( KNullDesC ); |
|
332 |
|
333 iPriority = EAiInvalidPriority; |
|
334 |
|
335 // *** Network operator name (CPHS-ONS) *** |
|
336 if( nwInfo.iNPName.Length() > 0 && |
|
337 nwInfo.iOperatorNameInfo.iType != RMmCustomAPI::EOperatorNameFlexiblePlmn && |
|
338 nwInfo.iRegistrationStatus == ENWRegisteredOnHomeNetwork ) |
|
339 { |
|
340 //priority |
|
341 iPriority = EAiNetworkOperatorName; |
|
342 //name |
|
343 iNetworkIdentityName.Set( nwInfo.iNPName ); |
|
344 //publish network identity name |
|
345 if( aTryToPublish ) |
|
346 { |
|
347 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
348 EAiDeviceStatusContentNetworkIdentity, |
|
349 iNetworkIdentityName, |
|
350 iPriority ); |
|
351 } |
|
352 |
|
353 iSuccess = ETrue; |
|
354 return; |
|
355 } |
|
356 |
|
357 // *** Operator name *** |
|
358 if( nwInfo.iOperatorNameInfo.iName.Length() > 0 ) |
|
359 { |
|
360 //priority |
|
361 OperatorNamePriority( iPriority ); |
|
362 //name |
|
363 iNetworkIdentityName.Set( nwInfo.iOperatorNameInfo.iName ); |
|
364 //converted name |
|
365 HBufC* convertedOperatorName = NULL; |
|
366 |
|
367 if ( nwInfo.iOperatorNameInfo.iType == RMmCustomAPI::EOperatorNameFlexiblePlmn ) |
|
368 { |
|
369 // Long & short name may be in the same buffer. |
|
370 const TInt separatorPos = iNetworkIdentityName.Locate( KFlexibleNameSeparator ); |
|
371 if ( separatorPos != KErrNotFound ) |
|
372 { |
|
373 convertedOperatorName = nwInfo.iOperatorNameInfo.iName.Left( separatorPos ).AllocLC(); |
|
374 } |
|
375 } |
|
376 else if ( nwInfo.iOperatorNameInfo.iType == |
|
377 RMmCustomAPI::EOperatorNameMccMnc || |
|
378 nwInfo.iOperatorNameInfo.iType == |
|
379 RMmCustomAPI::EOperatorNameCountryMcn ) |
|
380 { |
|
381 // Perform display language specific conversion. |
|
382 convertedOperatorName = nwInfo.iOperatorNameInfo.iName.AllocLC(); |
|
383 TPtr ptr = convertedOperatorName->Des(); |
|
384 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); |
|
385 } |
|
386 else |
|
387 { |
|
388 // No changes needed. |
|
389 } |
|
390 |
|
391 if ( convertedOperatorName ) |
|
392 { |
|
393 iNetworkIdentityName.Set( *convertedOperatorName ); |
|
394 } |
|
395 |
|
396 if( iPriority != EAiInvalidPriority ) |
|
397 { |
|
398 //Publish network identity name |
|
399 if( aTryToPublish ) |
|
400 { |
|
401 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
402 EAiDeviceStatusContentNetworkIdentity, |
|
403 iNetworkIdentityName, |
|
404 iPriority ); |
|
405 } |
|
406 |
|
407 iSuccess = ETrue; |
|
408 } |
|
409 |
|
410 if ( convertedOperatorName ) |
|
411 { |
|
412 CleanupStack::PopAndDestroy( convertedOperatorName ); |
|
413 convertedOperatorName = NULL; |
|
414 } |
|
415 |
|
416 if( iPriority != EAiInvalidPriority ) |
|
417 { |
|
418 return; |
|
419 } |
|
420 } |
|
421 |
|
422 // *** Network info name *** |
|
423 if( iPriority == EAiInvalidPriority ) |
|
424 { |
|
425 //priority |
|
426 iPriority = EAiOperatorNetInfoName; |
|
427 |
|
428 if ( nwInfo.iLongName.Length() > 0 ) |
|
429 { |
|
430 iNetworkIdentityName.Set( nwInfo.iLongName ); |
|
431 } |
|
432 else if ( nwInfo.iShortName.Length() > 0 ) |
|
433 { |
|
434 iNetworkIdentityName.Set( nwInfo.iShortName ); |
|
435 } |
|
436 else if ( nwInfo.iDisplayTag.Length() > 0 ) |
|
437 { |
|
438 iNetworkIdentityName.Set( nwInfo.iDisplayTag ); |
|
439 } |
|
440 else |
|
441 { |
|
442 iPriority = EAiInvalidPriority; |
|
443 } |
|
444 |
|
445 //Publish network identity name |
|
446 if( aTryToPublish ) |
|
447 { |
|
448 iPrioritizer->TryToPublishL( *iBroadcaster, |
|
449 EAiDeviceStatusContentNetworkIdentity, |
|
450 iNetworkIdentityName, |
|
451 iPriority ); |
|
452 } |
|
453 |
|
454 iSuccess = ETrue; |
|
455 return; |
|
456 } |
|
457 } |
|
458 |
|
459 |
|
460 void CAiOperatorNamePublisher::CheckServiceProviderDisplayListStatus( |
|
461 TInt aMCC, |
|
462 TInt aMNC, |
|
463 TBool& aShowSPN, |
|
464 TBool& aIsInSPDI ) const |
|
465 { |
|
466 |
|
467 // Not in list by default |
|
468 aIsInSPDI = EFalse; |
|
469 aShowSPN = EFalse; |
|
470 |
|
471 if ( !CurrentNetworkOk() ) |
|
472 { |
|
473 return; |
|
474 } |
|
475 |
|
476 |
|
477 const TNWInfo& nwInfo = iListener->NetworkInfo(); |
|
478 |
|
479 TInt bufferLength = nwInfo.iPLMNField.Length(); |
|
480 if ( !bufferLength ) |
|
481 { |
|
482 return; |
|
483 } |
|
484 |
|
485 const TUint8* field = |
|
486 reinterpret_cast< const TUint8* >( nwInfo.iPLMNField.Ptr() ); |
|
487 |
|
488 TInt octetIndex = 0; |
|
489 |
|
490 // Update SPN showing. (in 3GPP a tag). |
|
491 aShowSPN = static_cast<TUint8>( field[ octetIndex ] ) ? EFalse : ETrue ; |
|
492 octetIndex++; |
|
493 |
|
494 // Number of PLMN pairs. (in 3GPP number of octets). |
|
495 const TUint8 length = static_cast<TUint8>( ( field[ octetIndex ] ) ); |
|
496 octetIndex++; |
|
497 |
|
498 // Empty list (always with SIM and sometimes with UICC) |
|
499 if ( !( length > 0 ) ) |
|
500 { |
|
501 return; |
|
502 } |
|
503 |
|
504 // Compare MCC&MNC pairs |
|
505 TNWCountryCode mcc; |
|
506 TNWIdentity mnc; |
|
507 |
|
508 const TUint numberOfPairs = length; // each pair has 3 octets |
|
509 |
|
510 for( TUint pair = 0; pair < numberOfPairs; pair++ ) |
|
511 { |
|
512 // 1st octet |
|
513 AppendDigit( mcc, field[ octetIndex ] & 0x0F ); |
|
514 AppendDigit( mcc, ( field[ octetIndex ] & 0xF0 ) >> KBitShiftByFour ); |
|
515 octetIndex++; |
|
516 |
|
517 // 2nd octet |
|
518 AppendDigit( mcc, field[ octetIndex ] & 0x0F ); |
|
519 TInt tmp = ( field[ octetIndex ] & 0xF0 ) >> KBitShiftByFour; |
|
520 octetIndex++; |
|
521 |
|
522 // 3rd octet |
|
523 AppendDigit( mnc, field[ octetIndex ] & 0x0F ); |
|
524 AppendDigit( mnc, ( field[ octetIndex ] & 0xF0 ) >> KBitShiftByFour ); |
|
525 octetIndex++; |
|
526 |
|
527 AppendDigit( mnc, tmp ); // mnc 3rd digit. |
|
528 |
|
529 TInt imcc = StrToInt( mcc ); |
|
530 TInt imnc = StrToInt( mnc ); |
|
531 |
|
532 if ( ( aMNC == imnc ) && ( aMCC == imcc ) ) |
|
533 { |
|
534 // match. |
|
535 aIsInSPDI = ETrue; |
|
536 break; |
|
537 } |
|
538 |
|
539 |
|
540 // Reset |
|
541 mnc.Zero(); |
|
542 mcc.Zero(); |
|
543 } |
|
544 } |
|
545 |
|
546 |
|
547 TBool CAiOperatorNamePublisher::CurrentNetworkOk() const |
|
548 { |
|
549 TBool ok = iListener->MessageReceived( |
|
550 MNWMessageObserver::ENWMessageNetworkInfoChange ) || |
|
551 iListener->MessageReceived( |
|
552 MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange ); |
|
553 |
|
554 ok = ok & ( iListener->NetworkInfo().iStatus == ENWStatusCurrent ); |
|
555 |
|
556 return ok; |
|
557 } |
|
558 |
|
559 |
|
560 TBool CAiOperatorNamePublisher::IsRoaming() const |
|
561 { |
|
562 const TNWInfo& nwInfo = iListener->NetworkInfo(); |
|
563 |
|
564 return iListener->MessageReceived( |
|
565 MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange ) && |
|
566 ( nwInfo.iRegistrationStatus == ENWRegisteredRoaming ); |
|
567 } |
|
568 |
|
569 |
|
570 |
|
571 void CAiOperatorNamePublisher::StartDelayedPLMNOperation() |
|
572 { |
|
573 if( !iPeriodic->IsActive() ) |
|
574 { |
|
575 iPeriodic->Start( KCleanOperationDelay, |
|
576 0, |
|
577 TCallBack( CleanAndShowPLMNOperationCallback, this ) ); |
|
578 } |
|
579 } |
|
580 |
|
581 |
|
582 TInt CAiOperatorNamePublisher::CleanAndShowPLMNOperationCallback( TAny* aPtr ) |
|
583 { |
|
584 CAiOperatorNamePublisher* self = |
|
585 static_cast<CAiOperatorNamePublisher*>( aPtr ); |
|
586 |
|
587 if( self ) |
|
588 { |
|
589 TRAP_IGNORE |
|
590 ( |
|
591 //clean |
|
592 self->DoCleanOperationL(); |
|
593 //show PLMN name |
|
594 self->ShowNetworkIdentityNameL( ETrue ); |
|
595 ); |
|
596 } |
|
597 |
|
598 return KErrNone; |
|
599 } |
|
600 |
|
601 |
|
602 void CAiOperatorNamePublisher::DoCleanOperationL() |
|
603 { |
|
604 iPrioritizer->TryToCleanL( *iBroadcaster, |
|
605 EAiDeviceStatusContentNetworkIdentity, |
|
606 EAiServiceProviderName ); |
|
607 iPeriodic->Cancel(); |
|
608 } |
|
609 |
|
610 |
|
611 TBool CAiOperatorNamePublisher::RefreshL( TInt aContentId, TBool aClean ) |
|
612 { |
|
613 if( aContentId == EAiDeviceStatusContentNetworkIdentity ) |
|
614 { |
|
615 RefreshL( aClean ); |
|
616 if( iSuccess ) |
|
617 { |
|
618 return ETrue; |
|
619 } |
|
620 } |
|
621 |
|
622 return EFalse; |
|
623 } |
|
624 |
|
625 |
|
626 TBool CAiOperatorNamePublisher::RefreshContentWithPriorityL( |
|
627 TInt aContentId, |
|
628 TInt aPriority ) |
|
629 { |
|
630 if( aContentId == EAiDeviceStatusContentNetworkIdentity && aPriority == EAiServiceProviderName ) |
|
631 { |
|
632 RefreshL( EFalse ); |
|
633 if( iSuccess ) |
|
634 { |
|
635 return ETrue; |
|
636 } |
|
637 } |
|
638 return EFalse; |
|
639 } |
|
640 |
|
641 |
|
642 TBool CAiOperatorNamePublisher::OperatorNamePriority( TInt& aPriority ) |
|
643 { |
|
644 TBool succeeded = ETrue; |
|
645 |
|
646 const TNWInfo& nwInfo = iListener->NetworkInfo(); |
|
647 |
|
648 switch ( nwInfo.iOperatorNameInfo.iType ) |
|
649 { |
|
650 case RMmCustomAPI::EOperatorNameFlexiblePlmn: |
|
651 aPriority = EAiFlexiblePLMN; |
|
652 break; |
|
653 |
|
654 case RMmCustomAPI::EOperatorNameNitzFull: |
|
655 aPriority = EAiNITZ; |
|
656 break; |
|
657 |
|
658 case RMmCustomAPI::EOperatorNameNitzShort: |
|
659 aPriority = EAiNITZ; |
|
660 break; |
|
661 |
|
662 case RMmCustomAPI::EOperatorNameProgrammableUcs2: |
|
663 aPriority = EAiUnicodeOperatorName; |
|
664 break; |
|
665 |
|
666 case RMmCustomAPI::EOperatorNameProgrammableLatin: |
|
667 aPriority = EAiLatinOperatorName; |
|
668 break; |
|
669 |
|
670 case RMmCustomAPI::EOperatorNameHardcodedUcs2: |
|
671 aPriority = EAiUnicodeOperatorName; |
|
672 break; |
|
673 |
|
674 case RMmCustomAPI::EOperatorNameHardcodedLatin: |
|
675 aPriority = EAiLatinOperatorName; |
|
676 break; |
|
677 |
|
678 case RMmCustomAPI::EOperatorNameCountryMcn: |
|
679 aPriority = EAiCountryMNC; |
|
680 break; |
|
681 |
|
682 case RMmCustomAPI::EOperatorNameMccMnc: |
|
683 aPriority = EAiMCC_MCN; |
|
684 break; |
|
685 |
|
686 default: |
|
687 aPriority = EAiInvalidPriority; |
|
688 succeeded = EFalse; |
|
689 break; |
|
690 } |
|
691 return succeeded; |
|
692 } |
|
693 |
|
694 TBool CAiOperatorNamePublisher::IsKeyLockEnabled() |
|
695 { |
|
696 TInt value; |
|
697 TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); |
|
698 if ( err != KErrNone ) |
|
699 return EFalse; |
|
700 switch( value ) |
|
701 { |
|
702 case EKeyguardLocked: |
|
703 case EKeyguardAutolockEmulation: |
|
704 return ETrue; |
|
705 case EKeyguardNotActive: |
|
706 default: |
|
707 return EFalse; |
|
708 } |
|
709 } |
|
710 |