44
|
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 activate or deactivate the specified PDP context (s).
|
|
15 |
// After the command has completed, the MT remains in V.25ter command state. If any
|
|
16 |
// PDP context is already in the requested state, the state for that context remains
|
|
17 |
// unchanged.
|
|
18 |
// If the requested state for any specified context cannot be achieved, an ERROR or +CME
|
|
19 |
// ERROR response is returned. Extended error responses are enabled by the +CMEE
|
|
20 |
// command.
|
|
21 |
// If the MT is not GPRS attached when the activation form of the command is executed,
|
|
22 |
// the MT first performs a GPRS attach and them attempts to activate the specified
|
|
23 |
// contexts. If the attach fails then the MT responds with ERROR or, if extended error
|
|
24 |
// responses are enabled, with the appropriate failure-to-attach error message.
|
|
25 |
// If no <cid>s are specified the activation form of the command activates all defined
|
|
26 |
// contexts.
|
|
27 |
// If no <cid>s are specified the deactivation form of the command deactivates all active
|
|
28 |
// contexts.
|
|
29 |
// Two PDP contexts can be activated through Wavecom software.
|
|
30 |
// The read command returns the current activation states for all the defined PDP
|
|
31 |
// contexts.
|
|
32 |
// The test command is used for requesting information on the supported PDP context
|
|
33 |
// activation states.
|
|
34 |
// Defined Values
|
|
35 |
// <state>: indicates the state of PDP context activation
|
|
36 |
// 0 ?deactivated
|
|
37 |
// 1 ?activated
|
|
38 |
// Other values are reserved and will result in an ERROR response to the
|
|
39 |
// execution command.
|
|
40 |
// <cid>: a numeric parameter which specifies a particular PDP context.
|
|
41 |
// other items were commented in a header
|
|
42 |
// other items were commented in a header
|
|
43 |
|
|
44 |
#include "mslogger.h"
|
|
45 |
#include "atgprscontextdeactivate.h"
|
|
46 |
|
|
47 |
_LIT8(KATContextDeactivate, "AT+CGACT=0,%d\r");
|
|
48 |
const TInt KDefaultDeactivateTimeout = 30;
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// CATGprsContextDeactivate::NewL
|
|
52 |
//
|
|
53 |
// ---------------------------------------------------------------------------
|
|
54 |
CATGprsContextDeactivate* CATGprsContextDeactivate::NewL(CGlobalPhonemanager& aGloblePhone,
|
|
55 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
56 |
{
|
|
57 |
CATGprsContextDeactivate* self = new(ELeave) CATGprsContextDeactivate(aGloblePhone,
|
|
58 |
aCtsyDispatcherCallback);
|
|
59 |
CleanupStack::PushL(self );
|
|
60 |
self->ConstructL();
|
|
61 |
CleanupStack::Pop(self );
|
|
62 |
return self ;
|
|
63 |
}
|
|
64 |
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
// CATGprsContextDeactivate::CATGprsContextDeactivate
|
|
67 |
// other items were commented in a header
|
|
68 |
// ---------------------------------------------------------------------------
|
|
69 |
CATGprsContextDeactivate::CATGprsContextDeactivate(CGlobalPhonemanager& aGloblePhone,
|
|
70 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
71 |
:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
|
|
72 |
{
|
|
73 |
iReadTimeOut = KDefaultDeactivateTimeout;
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CATGprsContextDeactivate::ConstructL()
|
|
78 |
// other items were commented in a header
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
void CATGprsContextDeactivate::ConstructL()
|
|
81 |
{
|
|
82 |
CAtCommandBase::ConstructL();
|
|
83 |
iAtType = ELtsyAT_Packet_DeactivateContext;
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// CATGprsContextDeactivate::~CATGprsContextDeactivate()
|
|
88 |
// other items were commented in a header
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
CATGprsContextDeactivate::~CATGprsContextDeactivate()
|
|
91 |
{
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// CATGprsContextDeactivate::StartRequest()
|
|
96 |
// other items were commented in a header
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
void CATGprsContextDeactivate::StartRequest()
|
|
99 |
{
|
|
100 |
ExecuteCommand();
|
|
101 |
}
|
|
102 |
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
// CATGprsContextDeactivate::ExecuteCommand()
|
|
105 |
// other items were commented in a header
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
void CATGprsContextDeactivate::ExecuteCommand()
|
|
108 |
{
|
|
109 |
LOGTEXT2(_L8("iCid=%d"),iContextId);
|
|
110 |
// Send the AT+CGACT=0,x command to the phone
|
|
111 |
iTxBuffer.Format(KATContextDeactivate,iContextId);
|
|
112 |
Write();
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------------------------
|
|
116 |
// CATGprsContextDeactivate::SetContext
|
|
117 |
// other items were commented in a header
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
void CATGprsContextDeactivate::SetContext(const TInt aContextId)
|
|
120 |
{
|
|
121 |
iContextId = aContextId;
|
|
122 |
}
|
|
123 |
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
// CATGprsContextDeactivate::ParseResponseL
|
|
126 |
// other items were commented in a header
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
void CATGprsContextDeactivate::ParseResponseL(const TDesC8& /*aResponseBuf*/)
|
|
129 |
{
|
|
130 |
if (CurrentLine().Match(KLtsyOkString) == 0)
|
|
131 |
{
|
|
132 |
iError = KErrNone;
|
|
133 |
}
|
|
134 |
else
|
|
135 |
{
|
|
136 |
iError = KErrGeneral;
|
|
137 |
}
|
|
138 |
}
|
|
139 |
|
|
140 |
// ---------------------------------------------------------------------------
|
|
141 |
// CATGprsContextDeactivate::EventSignal
|
|
142 |
// other items were commented in a header
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
void CATGprsContextDeactivate::EventSignal(TAtEventSource aEventSource, TInt aStatus)
|
|
145 |
{
|
|
146 |
if((KErrNone ==aStatus)&&(aEventSource == EWriteCompletion))
|
|
147 |
{
|
|
148 |
return;
|
|
149 |
}
|
|
150 |
TInt count = iPhoneGlobals.iContextList.Count();
|
|
151 |
TInt i;
|
|
152 |
//Get the context from context list
|
|
153 |
for(i = 0; i < count;i++)
|
|
154 |
{
|
|
155 |
if(iPhoneGlobals.iContextList[i]->iContextID == iContextId)
|
|
156 |
{
|
|
157 |
break;
|
|
158 |
}
|
|
159 |
}
|
|
160 |
if((KErrNone ==aStatus)&&(aEventSource == EReadCompletion)&&(iError==KErrNone))
|
|
161 |
{
|
|
162 |
iPhoneGlobals.iContextList[i]->iInfo.iStatus = RPacketContext::EStatusInactive;
|
|
163 |
TContextMisc contextMisc;
|
|
164 |
contextMisc.iStatus = RPacketContext::EStatusInactive;
|
|
165 |
iPhoneGlobals.iPhoneStatus.iMode = RPhone::EModeOnlineCommand;
|
|
166 |
iCtsyDispatcherCallback.CallbackPacketServicesNotifyPdpContextStatusChangeInd(iError,
|
|
167 |
iPhoneGlobals.iContextList[i]->iInfo.iName,
|
|
168 |
contextMisc);
|
|
169 |
}
|
|
170 |
iCtsyDispatcherCallback.CallbackPacketServicesDeactivatePdpContextComp(iError,
|
|
171 |
iPhoneGlobals.iContextList[i]->iInfo.iName);
|
|
172 |
CAtCommandBase::Complete();
|
|
173 |
iPhoneGlobals.iEventSignalActive = EFalse;
|
|
174 |
}
|
|
175 |
|
|
176 |
// End of file
|