cbsref/telephonyrefplugins/atltsy/atcommand/phone/src/atselectnetworkmode.cpp
changeset 49 f50f4094acd7
equal deleted inserted replaced
48:14460bf2a402 49:f50f4094acd7
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CATGetModemStatus
       
    15 // Description:
       
    16 // CATSelectNetworkMode
       
    17 
       
    18 
       
    19 #include "atselectnetworkmode.h"
       
    20 #include "mslogger.h"
       
    21 
       
    22 
       
    23 _LIT8(KATSelectNetworkMode,"AT+COPS=%d\r");
       
    24 // Class CATSelectNetworkMode
       
    25 // ---------------------------------------------------------------------------
       
    26 // CATSelectNetworkMode::NewL
       
    27 // other items were commented in a header
       
    28 // ---------------------------------------------------------------------------
       
    29 CATSelectNetworkMode* CATSelectNetworkMode::NewL(CGlobalPhonemanager& aGloblePhone, 
       
    30 	                                             CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    31 	{
       
    32 	CATSelectNetworkMode* self = new(ELeave) CATSelectNetworkMode(aGloblePhone,
       
    33 			                                                      aCtsyDispatcherCallback);
       
    34 	CleanupStack::PushL(self );
       
    35 	self->ConstructL();
       
    36 	CleanupStack::Pop(self );
       
    37 	return self ;
       
    38 	}
       
    39 // ---------------------------------------------------------------------------
       
    40 // CATSelectNetworkMode::CATSelectNetworkMode
       
    41 // other items were commented in a header
       
    42 // ---------------------------------------------------------------------------
       
    43 CATSelectNetworkMode::CATSelectNetworkMode(CGlobalPhonemanager& aGloblePhone, 
       
    44 	                                      CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    45 		:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
       
    46 	{
       
    47 	}
       
    48 // ---------------------------------------------------------------------------
       
    49 // CATSelectNetworkMode::ConstructL
       
    50 // other items were commented in a header
       
    51 // ---------------------------------------------------------------------------
       
    52 void CATSelectNetworkMode::ConstructL()
       
    53 	{
       
    54 	CAtCommandBase::ConstructL();
       
    55 	}
       
    56 // ---------------------------------------------------------------------------
       
    57 // CATSelectNetworkMode::~CATSelectNetworkMode
       
    58 // other items were commented in a header
       
    59 // ---------------------------------------------------------------------------
       
    60 CATSelectNetworkMode::~CATSelectNetworkMode()
       
    61 	{
       
    62 	}
       
    63 // ---------------------------------------------------------------------------
       
    64 // CATSelectNetworkMode::StartRequestL
       
    65 // other items were commented in a header
       
    66 // ---------------------------------------------------------------------------
       
    67 void CATSelectNetworkMode::StartRequest()
       
    68 	{
       
    69 	ExecuteCommand();
       
    70 	}
       
    71 // ---------------------------------------------------------------------------
       
    72 // CATSelectNetworkMode::ExecuteCommand
       
    73 // other items were commented in a header
       
    74 // ---------------------------------------------------------------------------
       
    75 void CATSelectNetworkMode::ExecuteCommand()
       
    76 	{
       
    77 	LOGTEXT(_L8("CATSelectNetworkMode::ExecuteCommand called"));
       
    78 	iTxBuffer.Format(KATSelectNetworkMode,iNetworkSelection);
       
    79 	Write();
       
    80 	}
       
    81 // ---------------------------------------------------------------------------
       
    82 // CATSelectNetworkMode::ParseResponseL
       
    83 // other items were commented in a header
       
    84 // ---------------------------------------------------------------------------
       
    85 void CATSelectNetworkMode::ParseResponseL(const TDesC8& /*aResponseBuf*/)
       
    86 	{
       
    87 	if (CurrentLine().Match(KLtsyOkString) == 0)
       
    88 		{
       
    89 		iError = KErrNone;
       
    90 		}
       
    91 	else
       
    92 		{
       
    93 		iError = KErrGeneral;
       
    94 		}
       
    95 	}
       
    96 // ---------------------------------------------------------------------------
       
    97 // CATSelectNetworkMode::SetNetworkSelection
       
    98 // other items were commented in a header
       
    99 // ---------------------------------------------------------------------------
       
   100 void CATSelectNetworkMode::SetNetworkSelection(const TInt aNetworkSelection)
       
   101 	{
       
   102 	iNetworkSelection = aNetworkSelection;
       
   103 	}
       
   104 // ---------------------------------------------------------------------------
       
   105 // CATSelectNetworkMode::EventSignal
       
   106 // other items were commented in a header
       
   107 // ---------------------------------------------------------------------------
       
   108 void CATSelectNetworkMode::EventSignal(TAtEventSource aEventSource, TInt aStatus)
       
   109 	{
       
   110 	if(KErrNone ==aStatus)
       
   111 		{
       
   112 		if(aEventSource == EReadCompletion)
       
   113 			{
       
   114 			aStatus = iError;
       
   115 			}
       
   116 		else
       
   117 			return;
       
   118 		}
       
   119 	CAtCommandBase::Complete();
       
   120 	iPhoneGlobals.iEventSignalActive = EFalse;
       
   121 	switch (iNetworkSelection)
       
   122 		{
       
   123 	case 0:
       
   124 		iCtsyDispatcherCallback.CallbackPhoneSetNetworkSelectionSettingComp(aStatus, 
       
   125 				                RMobilePhone::ENetworkSelectionAutomatic);
       
   126 		break;
       
   127 	case 1:
       
   128 		iCtsyDispatcherCallback.CallbackPhoneSetNetworkSelectionSettingComp(aStatus, 
       
   129 				                RMobilePhone::ENetworkSelectionManual);
       
   130 		break;
       
   131 	default:
       
   132 		iCtsyDispatcherCallback.CallbackPhoneSetNetworkSelectionSettingComp(aStatus, 
       
   133 				                RMobilePhone::ENetworkSelectionUnknown);
       
   134 		break;
       
   135 		}
       
   136 	}
       
   137 //
       
   138 // End of file
       
   139 
       
   140 
       
   141 
       
   142 
       
   143