cbsref/telephonyrefplugins/atltsy/atcommand/pktservice/src/atgprsdetach.cpp
branchRCL_3
changeset 65 630d2f34d719
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
       
     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 // The execution command is used to attach the MT to, or detach the MT from, the GPRS
       
    15 // service. After the command has completed, the MT remains in V.25ter command state.
       
    16 // If the MT is already in the requested state, the command is ignored and the OK
       
    17 // response is returned. If the requested state cannot be achieved, an ERROR or +CME
       
    18 // ERROR response is returned. Extended error responses are enabled by the +CMEE
       
    19 // command.
       
    20 // Any active PDP contexts will be automatically deactivated when the attachment state
       
    21 // changes to detached.
       
    22 // The read command returns the current GPRS service state.
       
    23 // The test command is used for requesting information on the supported GPRS service
       
    24 // states.
       
    25 // +CGATT= [<state>]
       
    26 // <state>: indicates the state of GPRS attachment
       
    27 // 0 ?detached
       
    28 // 1 ?attached
       
    29 // Other values are reserved and will result in an ERROR response to the
       
    30 // execution command.
       
    31 
       
    32 #include "mslogger.h"
       
    33 #include "atgprsdetach.h"
       
    34 
       
    35 _LIT8(KDetachCommand, "AT+CGATT=0\r");
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CATGprsDetach::NewL
       
    39 // other items were commented in a header
       
    40 // ---------------------------------------------------------------------------
       
    41 CATGprsDetach* CATGprsDetach::NewL(CGlobalPhonemanager& aGloblePhone, 
       
    42                                    CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    43 	{
       
    44 	CATGprsDetach* self = new(ELeave) CATGprsDetach(aGloblePhone,
       
    45 			                                        aCtsyDispatcherCallback);
       
    46 	CleanupStack::PushL(self );
       
    47 	self->ConstructL();
       
    48 	CleanupStack::Pop(self );
       
    49 	return self ;
       
    50 	}
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // CATGprsDetach::CATGprsDetach
       
    54 // other items were commented in a header
       
    55 // ---------------------------------------------------------------------------
       
    56 CATGprsDetach::CATGprsDetach(CGlobalPhonemanager& aGloblePhone, 
       
    57                              CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    58 		:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
       
    59 	{
       
    60 	}
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CATGprsDetach::ConstructL()
       
    64 // other items were commented in a header
       
    65 // ---------------------------------------------------------------------------
       
    66 void CATGprsDetach::ConstructL()
       
    67 	{
       
    68 	CAtCommandBase::ConstructL();
       
    69 	}
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CATGprsDetach::~CATGprsDetach()
       
    73 // other items were commented in a header
       
    74 // ---------------------------------------------------------------------------
       
    75 CATGprsDetach::~CATGprsDetach()
       
    76 	{
       
    77 	}
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CATGprsDetach::StartRequest()
       
    81 // other items were commented in a header
       
    82 // ---------------------------------------------------------------------------
       
    83 void CATGprsDetach::StartRequest()
       
    84 	{
       
    85 	ExecuteCommand();
       
    86 	}
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CATGprsDetach::ExecuteCommand()
       
    90 // other items were commented in a header
       
    91 // ---------------------------------------------------------------------------
       
    92 void CATGprsDetach::ExecuteCommand()
       
    93 	{
       
    94 	iTxBuffer.Copy(KDetachCommand);
       
    95 	Write();
       
    96 	}
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CATGprsDetach::ParseResponseL
       
   100 // other items were commented in a header
       
   101 // ---------------------------------------------------------------------------
       
   102 void CATGprsDetach::ParseResponseL(const TDesC8& /*aResponseBuf*/)
       
   103 	{
       
   104 	if (CurrentLine().Match(KLtsyOkString) == 0)
       
   105 		{
       
   106 		iError = KErrNone;
       
   107 		}
       
   108 	else
       
   109 		{
       
   110 		iError = KErrGeneral;
       
   111 		}
       
   112 	}
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CATGprsDetach::EventSignal
       
   116 // other items were commented in a header
       
   117 // ---------------------------------------------------------------------------
       
   118 void CATGprsDetach::EventSignal(TAtEventSource aEventSource, TInt aStatus)
       
   119 	{
       
   120 	if(KErrNone ==aStatus)
       
   121 		{
       
   122 		if(aEventSource == EReadCompletion)
       
   123 			{
       
   124 			aStatus = iError;
       
   125 			}
       
   126 		else
       
   127 			return;
       
   128 		}
       
   129 	iCtsyDispatcherCallback.CallbackPacketServicesPacketDetachComp(aStatus);
       
   130 	CAtCommandBase::Complete();
       
   131 	iPhoneGlobals.iEventSignalActive = EFalse;
       
   132 	}
       
   133 
       
   134 // End of file