16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include "mpsetnetworkinfoobs.h" |
21 #include "CNetworkResetHandler.h" |
22 #include "psetnetwork.h" |
22 #include "MPsetNetworkInfoObs.h" |
23 #include "psetsaobserver.h" |
23 #include "MPsetNetworkSelect.h" |
24 #include "psetpanic.h" |
24 #include "PsetNetwork.h" |
25 #include "psetconstants.h" |
25 #include "PsetSAObserver.h" |
26 #include "mpsetnetworkselect.h" |
26 #include "PSetPanic.h" |
|
27 #include "PsetConstants.h" |
|
28 #include "PhoneSettingsLogger.h" |
|
29 |
27 #include <etelmm.h> |
30 #include <etelmm.h> |
28 #include <mmretrieve.h> |
31 #include <mmretrieve.h> |
29 #include <rmmcustomapi.h> |
32 #include <rmmcustomapi.h> |
30 |
33 |
31 #include <e32svr.h> |
34 #include <e32svr.h> |
32 #include "phonesettingslogger.h" |
|
33 |
35 |
34 // LOCAL CONSTANTS AND MACROS |
36 // LOCAL CONSTANTS AND MACROS |
35 _LIT( KPSNameOfClass, "CPsetNetwork" ); |
37 _LIT( KPSNameOfClass, "CPsetNetwork" ); |
36 |
38 |
37 enum TActiveObserver |
39 enum TActiveObserver |
143 // |
147 // |
144 // --------------------------------------------------------------------------- |
148 // --------------------------------------------------------------------------- |
145 // |
149 // |
146 EXPORT_C TInt CPsetNetwork::GetNetworkSelectMode( TSelectMode& aMode ) |
150 EXPORT_C TInt CPsetNetwork::GetNetworkSelectMode( TSelectMode& aMode ) |
147 { |
151 { |
148 /***************************************************** |
|
149 * Series 60 Customer / ETel |
|
150 * Series 60 ETel API |
|
151 *****************************************************/ |
|
152 RMobilePhone::TMobilePhoneNetworkSelectionV1 setMode; |
152 RMobilePhone::TMobilePhoneNetworkSelectionV1 setMode; |
153 RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg setModePckg( setMode ); |
153 RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg setModePckg( setMode ); |
154 |
154 |
155 __PHSLOGSTRING("[PHS]--> CPsetNetwork::GetNetworkSelectMode"); |
155 __PHSLOGSTRING("[PHS]--> CPsetNetwork::GetNetworkSelectMode"); |
156 |
156 |
192 { |
192 { |
193 previousModeAutomatic = ETrue; |
193 previousModeAutomatic = ETrue; |
194 } |
194 } |
195 iTempNetInfo = aInfo; |
195 iTempNetInfo = aInfo; |
196 |
196 |
197 /***************************************************** |
|
198 * Series 60 Customer / ETel |
|
199 * Series 60 ETel API |
|
200 *****************************************************/ |
|
201 if ( aInfo.iMode == ENetSelectModeManual ) |
197 if ( aInfo.iMode == ENetSelectModeManual ) |
202 { |
198 { |
203 //Copy data to member variables and make a request. |
199 //Copy data to member variables and make a request. |
204 iNwInfo.iCountry.Append( aInfo.iId.iCountryCode ); |
200 iNwInfo.iCountry.Append( aInfo.iId.iCountryCode ); |
205 __PHSLOGSTRING1("[PHS] CPsetNetwork::SelectNetworkL: Manual - CountryCode: %S", &aInfo.iId.iCountryCode); |
201 __PHSLOGSTRING1("[PHS] CPsetNetwork::SelectNetworkL: Manual - CountryCode: %S", &aInfo.iId.iCountryCode); |
271 // Params have to be cleared here since the observer may initiate another asynchronous operation immediately |
267 // Params have to be cleared here since the observer may initiate another asynchronous operation immediately |
272 // after they are notified, effectively messing up the state machine which controls the logic in DoCancel() |
268 // after they are notified, effectively messing up the state machine which controls the logic in DoCancel() |
273 // resulting in a possible dead lock when CActive::Cancel()'s User::WaitForRequest( iStatus ) never gets signaled. |
269 // resulting in a possible dead lock when CActive::Cancel()'s User::WaitForRequest( iStatus ) never gets signaled. |
274 ClearParams(); |
270 ClearParams(); |
275 |
271 |
276 if ( iActiveObserver == ENetSelectObserver && iObserver ) |
272 if ( iActiveObserver == ENetSelectObserver ) |
277 { |
273 { |
278 __ASSERT_ALWAYS( iObserver, Panic( KPSNameOfClass, ENetNoObserver ) ); |
274 __ASSERT_ALWAYS( iObserver, Panic( KPSNameOfClass, ENetNoObserver ) ); |
279 HideRequestNoteL(); |
275 HideRequestNoteL(); |
280 } |
276 } |
281 else if ( iActiveObserver == ENetModeObserver && iNetworkModeObserver ) |
277 else if ( iActiveObserver == ENetModeObserver ) |
282 { |
278 { |
283 __ASSERT_ALWAYS( iNetworkModeObserver, |
279 __ASSERT_ALWAYS( iNetworkModeObserver, |
284 Panic( KPSNameOfClass, ENetNoNetworkObserver ) ); |
280 Panic( KPSNameOfClass, ENetNoNetworkObserver ) ); |
285 } |
281 } |
286 |
282 |
317 iNetworkRetrieve->RetrieveListV2L(); |
313 iNetworkRetrieve->RetrieveListV2L(); |
318 CleanupStack::PushL( results ); |
314 CleanupStack::PushL( results ); |
319 TInt amount = results->Enumerate(); |
315 TInt amount = results->Enumerate(); |
320 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: amount: %d", amount); |
316 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: amount: %d", amount); |
321 TInt i = 0; |
317 TInt i = 0; |
322 /***************************************************** |
318 |
323 * Series 60 Customer / ETel |
|
324 * Series 60 ETel API |
|
325 *****************************************************/ |
|
326 RMobilePhone::TMobilePhoneNetworkInfoV2 nwNames; |
319 RMobilePhone::TMobilePhoneNetworkInfoV2 nwNames; |
327 while ( amount > i ) |
320 while ( amount > i ) |
328 { |
321 { |
329 nwNames = results->GetEntryL( i ); |
322 nwNames = results->GetEntryL( i ); |
330 iTempNetInfo.iId.iCountryCode.Copy( nwNames.iCountryCode ); |
323 iTempNetInfo.iId.iCountryCode.Copy( nwNames.iCountryCode ); |
331 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: CountryCode: %S", &iTempNetInfo.iId.iCountryCode); |
324 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: CountryCode: %S", &iTempNetInfo.iId.iCountryCode); |
332 |
325 |
333 iTempNetInfo.iId.iNetworkCode.Copy( nwNames.iNetworkId ); |
326 iTempNetInfo.iId.iNetworkCode.Copy( nwNames.iNetworkId ); |
334 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: NetworkCode: %S", &iTempNetInfo.iId.iNetworkCode); |
327 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: NetworkCode: %S", &iTempNetInfo.iId.iNetworkCode); |
335 |
|
336 iTempNetInfo.iStatus = (MPsetNetworkSelect::TNetworkStatus)nwNames.iStatus; |
|
337 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: Status: %d", &iTempNetInfo.iStatus); |
|
338 |
328 |
339 iTempNetInfo.iLongName.Copy( nwNames.iLongName ); |
329 iTempNetInfo.iLongName.Copy( nwNames.iLongName ); |
340 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: LongName: %S", &iTempNetInfo.iLongName); |
330 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: LongName: %S", &iTempNetInfo.iLongName); |
341 |
331 |
342 iTempNetInfo.iShortName.Copy( nwNames.iShortName ); |
332 iTempNetInfo.iShortName.Copy( nwNames.iShortName ); |
343 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: ShortName: %S", &iTempNetInfo.iShortName); |
333 __PHSLOGSTRING1("[PHS] CPsetNetwork::RunL: ShortName: %S", &iTempNetInfo.iShortName); |
344 |
334 |
345 if ( nwNames.iAccess == RMobilePhone::ENetworkAccessUtran ) |
335 if ( nwNames.iAccess == RMobilePhone::ENetworkAccessUtran ) |
346 { |
336 { |
347 iTempNetInfo.iAccess = ENetNetworkWCDMA; |
337 iTempNetInfo.iAccess = ENetNetworkWCDMA; |
348 } |
|
349 else if ( nwNames.iAccess == RMobilePhone::ENetworkAccessGsmAndUtran ) |
|
350 { |
|
351 iTempNetInfo.iAccess = ENetNetworkGSMandWCDMA; |
|
352 } |
338 } |
353 else |
339 else |
354 { |
340 { |
355 iTempNetInfo.iAccess = ENetNetworkGSM; |
341 iTempNetInfo.iAccess = ENetNetworkGSM; |
356 } |
342 } |
|
343 |
|
344 /** Implementation of forbidden operator icon begins */ |
|
345 // Set network status for displaying forbidden operator icon |
|
346 iTempNetInfo.iStatus = static_cast<MPsetNetworkSelect::TNetworkStatus>( nwNames.iStatus ); |
|
347 /** Implementation of forbidden operator icon ends */ |
|
348 |
357 array->AppendL( iTempNetInfo ); |
349 array->AppendL( iTempNetInfo ); |
358 i++; |
350 i++; |
359 } |
351 } |
360 CleanupStack::PopAndDestroy( results ); |
352 CleanupStack::PopAndDestroy( results ); |
361 results = NULL; |
353 results = NULL; |
479 // |
471 // |
480 void CPsetNetwork::ConstructL( MPsetNetworkInfoObserver& aObserver ) |
472 void CPsetNetwork::ConstructL( MPsetNetworkInfoObserver& aObserver ) |
481 { |
473 { |
482 iObserver = &aObserver; |
474 iObserver = &aObserver; |
483 iActiveObserver = ENetSelectObserver; |
475 iActiveObserver = ENetSelectObserver; |
484 /***************************************************** |
476 |
485 * Series 60 Customer / ETel |
|
486 * Series 60 ETel API |
|
487 *****************************************************/ |
|
488 iRegStatus = RMobilePhone::ERegistrationUnknown; |
477 iRegStatus = RMobilePhone::ERegistrationUnknown; |
489 User::LeaveIfError( iCustomPhone.Open( iPhone ) ); |
478 User::LeaveIfError( iCustomPhone.Open( iPhone ) ); |
490 |
479 |
491 iSAObserver = CPsetSAObserver::NewL(); |
480 iSAObserver = CPsetSAObserver::NewL(); |
492 CActiveScheduler::Add( this ); |
481 CActiveScheduler::Add( this ); |
|
482 iResetNetworkSearch = CNetworkResetHandler::NewL( iPhone ); |
493 } |
483 } |
494 |
484 |
495 // --------------------------------------------------------------------------- |
485 // --------------------------------------------------------------------------- |
496 // |
486 // |
497 // Adds this to scheduler |
487 // Adds this to scheduler |
500 // |
490 // |
501 void CPsetNetwork::ConstructL( MPsetNetworkModeObserver& aModeObserver ) |
491 void CPsetNetwork::ConstructL( MPsetNetworkModeObserver& aModeObserver ) |
502 { |
492 { |
503 iNetworkModeObserver = &aModeObserver; |
493 iNetworkModeObserver = &aModeObserver; |
504 iActiveObserver = ENetModeObserver; |
494 iActiveObserver = ENetModeObserver; |
505 /***************************************************** |
495 |
506 * Series 60 Customer / ETel |
|
507 * Series 60 ETel API |
|
508 *****************************************************/ |
|
509 User::LeaveIfError( iCustomPhone.Open( iPhone ) ); |
496 User::LeaveIfError( iCustomPhone.Open( iPhone ) ); |
510 |
497 |
511 CActiveScheduler::Add( this ); |
498 CActiveScheduler::Add( this ); |
|
499 iResetNetworkSearch = CNetworkResetHandler::NewL( iPhone ); |
512 } |
500 } |
513 |
501 |
514 // --------------------------------------------------------------------------- |
502 // --------------------------------------------------------------------------- |
515 // |
503 // |
516 // C++ constructor. |
504 // C++ constructor. |
567 // --------------------------------------------------------------------------- |
555 // --------------------------------------------------------------------------- |
568 // |
556 // |
569 EXPORT_C TInt CPsetNetwork::ResetNetworkSearch() |
557 EXPORT_C TInt CPsetNetwork::ResetNetworkSearch() |
570 { |
558 { |
571 __PHSLOGSTRING("[PHS]--> CPsetNetwork::ResetNetworkSearch"); |
559 __PHSLOGSTRING("[PHS]--> CPsetNetwork::ResetNetworkSearch"); |
572 RMmCustomAPI customApi; |
560 |
573 TInt error = customApi.Open( iPhone ); |
561 TInt error = iResetNetworkSearch->ResetNetworkSearch(); |
574 if (error == KErrNone) |
562 |
575 { |
563 __PHSLOGSTRING1("[PHS] <--CPsetNetwork::ResetNetworkSearch: error: %d", error); |
576 customApi.ResetNetServer(); |
564 |
577 } |
|
578 customApi.Close(); |
|
579 |
|
580 __PHSLOGSTRING("[PHS] <--CPsetNetwork::ResetNetworkSearch"); |
|
581 //for compatibility reasons returns a value |
565 //for compatibility reasons returns a value |
582 return error; |
566 return error; |
583 } |
567 } |
584 |
568 |
585 // --------------------------------------------------------------------------- |
569 // --------------------------------------------------------------------------- |