cellular/telephonysettings/src/PsetNetwork.cpp
branchRCL_3
changeset 5 7237db0d9fca
parent 3 a4a774cb6ea7
child 18 594d59766373
equal deleted inserted replaced
3:a4a774cb6ea7 5:7237db0d9fca
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 //  INCLUDE FILES
    20 //  INCLUDE FILES
       
    21 #include "CNetworkResetHandler.h"
    21 #include "MPsetNetworkInfoObs.h"
    22 #include "MPsetNetworkInfoObs.h"
       
    23 #include "MPsetNetworkSelect.h"
    22 #include "PsetNetwork.h"
    24 #include "PsetNetwork.h"
    23 #include "PsetSAObserver.h"     
    25 #include "PsetSAObserver.h"     
    24 #include "PSetPanic.h"          
    26 #include "PSetPanic.h"          
    25 #include "PsetConstants.h"
    27 #include "PsetConstants.h"
    26 #include "MPsetNetworkSelect.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
    87     Cancel();
    89     Cancel();
    88     iCustomPhone.Close();
    90     iCustomPhone.Close();
    89     delete iNetworkRetrieve;
    91     delete iNetworkRetrieve;
    90     iNetworkRetrieve = NULL;
    92     iNetworkRetrieve = NULL;
    91     delete iSAObserver;
    93     delete iSAObserver;
    92     iSAObserver = NULL;    
    94     iSAObserver = NULL;
       
    95     delete iResetNetworkSearch;
       
    96     iResetNetworkSearch = NULL;    
    93     } 
    97     } 
    94 
    98 
    95 // ---------------------------------------------------------------------------
    99 // ---------------------------------------------------------------------------
    96 // 
   100 // 
    97 // Returns available networks
   101 // Returns available networks
   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);
   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 );
   472 //
   465 //
   473 void CPsetNetwork::ConstructL( MPsetNetworkInfoObserver& aObserver )
   466 void CPsetNetwork::ConstructL( MPsetNetworkInfoObserver& aObserver )
   474     {
   467     {
   475     iObserver = &aObserver;
   468     iObserver = &aObserver;
   476     iActiveObserver = ENetSelectObserver;
   469     iActiveObserver = ENetSelectObserver;
   477     /*****************************************************
   470 
   478     *    Series 60 Customer / ETel
       
   479     *    Series 60  ETel API
       
   480     *****************************************************/
       
   481     iRegStatus = RMobilePhone::ERegistrationUnknown;
   471     iRegStatus = RMobilePhone::ERegistrationUnknown;
   482     User::LeaveIfError( iCustomPhone.Open( iPhone ) );
   472     User::LeaveIfError( iCustomPhone.Open( iPhone ) );
   483     
   473     
   484     iSAObserver = CPsetSAObserver::NewL();
   474     iSAObserver = CPsetSAObserver::NewL();
   485     CActiveScheduler::Add( this );
   475     CActiveScheduler::Add( this );
       
   476     iResetNetworkSearch = CNetworkResetHandler::NewL( iPhone );
   486     }
   477     }
   487 
   478 
   488 // ---------------------------------------------------------------------------
   479 // ---------------------------------------------------------------------------
   489 // 
   480 // 
   490 // Adds this to scheduler
   481 // Adds this to scheduler
   493 //
   484 //
   494 void CPsetNetwork::ConstructL( MPsetNetworkModeObserver& aModeObserver )
   485 void CPsetNetwork::ConstructL( MPsetNetworkModeObserver& aModeObserver )
   495     {
   486     {
   496     iNetworkModeObserver = &aModeObserver;
   487     iNetworkModeObserver = &aModeObserver;
   497     iActiveObserver = ENetModeObserver;
   488     iActiveObserver = ENetModeObserver;
   498     /*****************************************************
   489 
   499     *    Series 60 Customer / ETel
       
   500     *    Series 60  ETel API
       
   501     *****************************************************/
       
   502     User::LeaveIfError( iCustomPhone.Open( iPhone ) );
   490     User::LeaveIfError( iCustomPhone.Open( iPhone ) );
   503     
   491     
   504     CActiveScheduler::Add( this );
   492     CActiveScheduler::Add( this );
       
   493     iResetNetworkSearch = CNetworkResetHandler::NewL( iPhone );
   505     }
   494     }
   506 
   495 
   507 // ---------------------------------------------------------------------------
   496 // ---------------------------------------------------------------------------
   508 // 
   497 // 
   509 // C++ constructor.
   498 // C++ constructor.
   560 // ---------------------------------------------------------------------------
   549 // ---------------------------------------------------------------------------
   561 //
   550 //
   562 EXPORT_C TInt CPsetNetwork::ResetNetworkSearch()
   551 EXPORT_C TInt CPsetNetwork::ResetNetworkSearch()
   563     {
   552     {
   564     __PHSLOGSTRING("[PHS]--> CPsetNetwork::ResetNetworkSearch");
   553     __PHSLOGSTRING("[PHS]--> CPsetNetwork::ResetNetworkSearch");
   565     RMmCustomAPI customApi;
   554 	
   566     TInt error = customApi.Open( iPhone );
   555     TInt error = iResetNetworkSearch->ResetNetworkSearch();
   567     if	(error == KErrNone)
   556 	
   568         {
   557     __PHSLOGSTRING1("[PHS] <--CPsetNetwork::ResetNetworkSearch: error: %d", error);
   569         customApi.ResetNetServer();
   558 	
   570         }
       
   571     customApi.Close();
       
   572 
       
   573     __PHSLOGSTRING("[PHS] <--CPsetNetwork::ResetNetworkSearch");
       
   574     //for compatibility reasons returns a value
   559     //for compatibility reasons returns a value
   575     return error;
   560     return error;
   576     }
   561     }
   577 
   562 
   578 // ---------------------------------------------------------------------------
   563 // ---------------------------------------------------------------------------