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 "atgprscontextactivate.h" |
|
45 |
|
46 _LIT8(KATContextActivate, "AT+CGACT=1,%d\r"); |
|
47 const TInt KLtsyGprsContextActivateTimeOut = 30; |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CATGprsContextActivate::NewL |
|
51 // |
|
52 // --------------------------------------------------------------------------- |
|
53 CATGprsContextActivate* CATGprsContextActivate::NewL(CGlobalPhonemanager& aGloblePhone, |
|
54 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
55 { |
|
56 CATGprsContextActivate* self = new(ELeave) CATGprsContextActivate(aGloblePhone, |
|
57 aCtsyDispatcherCallback); |
|
58 CleanupStack::PushL(self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop(self ); |
|
61 return self ; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CATGprsContextActivate::CATGprsContextActivate |
|
66 // other items were commented in a header |
|
67 // --------------------------------------------------------------------------- |
|
68 CATGprsContextActivate::CATGprsContextActivate(CGlobalPhonemanager& aGloblePhone, |
|
69 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
70 :CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback) |
|
71 { |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CATGprsContextActivate::ConstructL() |
|
76 // other items were commented in a header |
|
77 // --------------------------------------------------------------------------- |
|
78 void CATGprsContextActivate::ConstructL() |
|
79 { |
|
80 CAtCommandBase::ConstructL(); |
|
81 iAtType = ELtsyAT_Packet_ActivateContext; |
|
82 iReadTimeOut = KLtsyGprsContextActivateTimeOut; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CATGprsContextActivate::~CATGprsContextActivate() |
|
87 // other items were commented in a header |
|
88 // --------------------------------------------------------------------------- |
|
89 CATGprsContextActivate::~CATGprsContextActivate() |
|
90 { |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CATGprsContextActivate::StartRequest() |
|
95 // other items were commented in a header |
|
96 // --------------------------------------------------------------------------- |
|
97 void CATGprsContextActivate::StartRequest() |
|
98 { |
|
99 ExecuteCommand(); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CATGprsContextActivate::ExecuteCommand() |
|
104 // other items were commented in a header |
|
105 // --------------------------------------------------------------------------- |
|
106 void CATGprsContextActivate::ExecuteCommand() |
|
107 { |
|
108 LOGTEXT(_L8("CATGprsContextActivate::Start called")); |
|
109 LOGTEXT2(_L8("iCid=%d"),iContextId); |
|
110 iTxBuffer.Format(KATContextActivate,iContextId); |
|
111 Write(); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // CATGprsContextActivate::SetContext |
|
116 // other items were commented in a header |
|
117 // --------------------------------------------------------------------------- |
|
118 void CATGprsContextActivate::SetContext(const TInt aContextId) |
|
119 { |
|
120 iContextId = aContextId; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // CATGprsContextActivate::GetErrorValue |
|
125 // other items were commented in a header |
|
126 // --------------------------------------------------------------------------- |
|
127 TInt CATGprsContextActivate::GetErrorValue() |
|
128 { |
|
129 return iError; |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // CATGprsContextActivate::ParseResponseL |
|
134 // other items were commented in a header |
|
135 // --------------------------------------------------------------------------- |
|
136 void CATGprsContextActivate::ParseResponseL(const TDesC8& /*aResponseBuf*/) |
|
137 { |
|
138 if (CurrentLine().Match(KLtsyOkString) == 0) |
|
139 { |
|
140 iError = KErrNone; |
|
141 } |
|
142 else |
|
143 { |
|
144 iError = KErrGeneral; |
|
145 } |
|
146 } |
|
147 |
|
148 // End of file |
|