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 |
|
|
43 |
#include "mslogger.h"
|
|
44 |
#include "atgprscontextconnect.h"
|
|
45 |
|
|
46 |
_LIT8(KATContextConnect, "ATD*99***%d#\r");
|
|
47 |
_LIT8(KLtsyGprsNoConnect, "NO CARRIER");
|
|
48 |
_LIT8(KLtsyGprsConnectStr, "CONNECT*");
|
|
49 |
_LIT8(KLtsyGprsConnect, "CONNECT");
|
|
50 |
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
// CATGprsContextConnect::NewL
|
|
53 |
//
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
CATGprsContextConnect* CATGprsContextConnect::NewL(CGlobalPhonemanager& aGloblePhone,
|
|
56 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
57 |
{
|
|
58 |
CATGprsContextConnect* self = new(ELeave) CATGprsContextConnect(aGloblePhone,
|
|
59 |
aCtsyDispatcherCallback);
|
|
60 |
CleanupStack::PushL(self );
|
|
61 |
self->ConstructL();
|
|
62 |
CleanupStack::Pop(self );
|
|
63 |
return self ;
|
|
64 |
}
|
|
65 |
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
// CATGprsContextConnect::CATGprsContextConnect
|
|
68 |
// other items were commented in a header
|
|
69 |
// ---------------------------------------------------------------------------
|
|
70 |
CATGprsContextConnect::CATGprsContextConnect(CGlobalPhonemanager& aGloblePhone,
|
|
71 |
CCtsyDispatcherCallback& aCtsyDispatcherCallback)
|
|
72 |
:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CATGprsContextConnect::ConstructL()
|
|
78 |
// other items were commented in a header
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
void CATGprsContextConnect::ConstructL()
|
|
81 |
{
|
|
82 |
CAtCommandBase::ConstructL();
|
|
83 |
iAtType = ELtsyAT_Packet_ConnectContext;
|
|
84 |
AddExpectStringL(KLtsyGprsConnectStr);
|
|
85 |
AddExpectStringL(KLtsyGprsNoConnect);
|
|
86 |
iReadTimeOut = 30;
|
|
87 |
}
|
|
88 |
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
// CATGprsContextConnect::~CATGprsContextConnect()
|
|
91 |
// other items were commented in a header
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
CATGprsContextConnect::~CATGprsContextConnect()
|
|
94 |
{
|
|
95 |
}
|
|
96 |
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
// CATGprsContextConnect::StartRequest()
|
|
99 |
// other items were commented in a header
|
|
100 |
// ---------------------------------------------------------------------------
|
|
101 |
void CATGprsContextConnect::StartRequest()
|
|
102 |
{
|
|
103 |
ExecuteCommand();
|
|
104 |
}
|
|
105 |
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
// CATGprsContextConnect::ExecuteCommand()
|
|
108 |
// other items were commented in a header
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
void CATGprsContextConnect::ExecuteCommand()
|
|
111 |
{
|
|
112 |
LOGTEXT(_L8("CATGprsContextConnect::Start called"));
|
|
113 |
LOGTEXT2(_L8("iCid=%d"),iContextId);
|
|
114 |
iTxBuffer.Format(KATContextConnect,iContextId);
|
|
115 |
Write();
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
// CATGprsContextConnect::SetContext
|
|
120 |
// other items were commented in a header
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
void CATGprsContextConnect::SetContext(const TInt aContextId)
|
|
123 |
{
|
|
124 |
iContextId = aContextId;
|
|
125 |
}
|
|
126 |
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
// CATGprsContextConnect::GetErrorValue
|
|
129 |
// other items were commented in a header
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
TInt CATGprsContextConnect::GetErrorValue()
|
|
132 |
{
|
|
133 |
return iError;
|
|
134 |
}
|
|
135 |
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
// CATGprsContextConnect::GetConnectionSpeed
|
|
138 |
// other items were commented in a header
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
TUint CATGprsContextConnect::GetConnectionSpeed()
|
|
141 |
{
|
|
142 |
return iConnectionSpeed;
|
|
143 |
}
|
|
144 |
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
// CATGprsContextConnect::ParseResponseL
|
|
147 |
// other items were commented in a header
|
|
148 |
// ---------------------------------------------------------------------------
|
|
149 |
void CATGprsContextConnect::ParseResponseL(const TDesC8& /*aResponseBuf*/)
|
|
150 |
{
|
|
151 |
RArray<TPtrC8> array;
|
|
152 |
CleanupClosePushL(array);
|
|
153 |
iParser->ParseRespondedBuffer(array,CurrentLine());
|
|
154 |
TInt Count = array.Count();
|
|
155 |
if (Count < 1)
|
|
156 |
{
|
|
157 |
CleanupStack::PopAndDestroy();
|
|
158 |
iError = KErrGeneral;
|
|
159 |
return ;
|
|
160 |
}
|
|
161 |
if( array[0].MatchF(KLtsyGprsConnect)==KErrNotFound)
|
|
162 |
{
|
|
163 |
CleanupStack::PopAndDestroy();
|
|
164 |
iError = KErrGeneral;
|
|
165 |
return ;
|
|
166 |
}
|
|
167 |
else
|
|
168 |
{
|
|
169 |
TUint val = 0;
|
|
170 |
TLex8 lex(array[1]);
|
|
171 |
lex.Val(val);
|
|
172 |
iConnectionSpeed = val;
|
|
173 |
CleanupStack::PopAndDestroy(&array);
|
|
174 |
iError = KErrNone;
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
// End of file
|