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 // This file implements the CATGprsSetProfile class and the CATGprsGetProfile. |
|
15 // This command allows the TE to specify a Quality of Service Profile that is |
|
16 // used when the MT sends an Activate PDP Context Request message to the network. |
|
17 // The set command specifies a profile for the context identified by the local context |
|
18 // identification parameter, <cid>. Since this is the same parameter that is used in the |
|
19 // +CGDCONT command, the +CGQREQ command is effectively an extension to the |
|
20 // +CGDCONT command. The QoS profile consists of a number of parameters, each of |
|
21 // which may be set to a separate value. |
|
22 // A special form of the set command, +CGQREQ= <cid> causes the requested profile for |
|
23 // context number <cid> to become undefined. |
|
24 // The read command returns the current settings for each defined context. |
|
25 // The test command returns values supported as a compound value. If the MT supports |
|
26 // several PDP types, the parameter value ranges for each PDP type are returned on a |
|
27 // separate line. |
|
28 // Defined values |
|
29 // <cid>: a numeric parameter which specifies a particular PDP context definition. |
|
30 // <precedence>: a numeric parameter which specifies the precedence class |
|
31 // <delay>: a numeric parameter which specifies the delay class |
|
32 // <reliability>: a numeric parameter which specifies the reliability class |
|
33 // <peak>: a numeric parameter which specifies the peak throughput class |
|
34 // <mean>: a numeric parameter which specifies the mean throughput class |
|
35 // If a value is omitted for a particular class then the value is considered to be |
|
36 // unspecified. |
|
37 // AT+CGQREQ=[<cid> [,<precedence >[,<delay> [,<reliability.> [,<peak>[,<mean>]]]]]] |
|
38 // other items were commented in a header |
|
39 |
|
40 #include <pcktcs.h> |
|
41 #include "atgprsqosprofile.h" |
|
42 #include <etelpckt.h> |
|
43 #include "mslogger.h" |
|
44 |
|
45 _LIT8(KCGQreq, "AT+CGQREQ=%d,%d,%d,%d,%d,%d\r"); |
|
46 |
|
47 // CATGprsSetProfileReq::NewL() |
|
48 CATGprsSetProfileReq* CATGprsSetProfileReq::NewL(CGlobalPhonemanager& aGloblePhone, |
|
49 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
50 { |
|
51 CATGprsSetProfileReq* self = new(ELeave) CATGprsSetProfileReq(aGloblePhone,aCtsyDispatcherCallback); |
|
52 CleanupStack::PushL(self ); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop(self ); |
|
55 return self ; |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CATGprsSetProfileReq::CATGprsSetProfileReq() |
|
60 // other items were commented in a header |
|
61 // --------------------------------------------------------------------------- |
|
62 CATGprsSetProfileReq::CATGprsSetProfileReq(CGlobalPhonemanager& aGloblePhone, |
|
63 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
64 :CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback) |
|
65 { |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CATGprsSetProfileReq::ConstructL() |
|
70 // other items were commented in a header |
|
71 // --------------------------------------------------------------------------- |
|
72 void CATGprsSetProfileReq::ConstructL() |
|
73 { |
|
74 CAtCommandBase::ConstructL(); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CATGprsSetProfileReq::~CATGprsSetProfileReq() |
|
79 // other items were commented in a header |
|
80 // --------------------------------------------------------------------------- |
|
81 CATGprsSetProfileReq::~CATGprsSetProfileReq() |
|
82 { |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CATGprsSetProfileReq::StartRequest() |
|
87 // other items were commented in a header |
|
88 // --------------------------------------------------------------------------- |
|
89 void CATGprsSetProfileReq::StartRequest() |
|
90 { |
|
91 ExecuteCommand(); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CATGprsSetProfileReq::ExecuteCommand() |
|
96 // other items were commented in a header |
|
97 // --------------------------------------------------------------------------- |
|
98 void CATGprsSetProfileReq::ExecuteCommand() |
|
99 { |
|
100 MakeupCGQREQ(); |
|
101 Write(); |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CATGprsSetProfileReq::SetContext() |
|
106 // other items were commented in a header |
|
107 // --------------------------------------------------------------------------- |
|
108 void CATGprsSetProfileReq::SetContext(const TInt aContextId) |
|
109 { |
|
110 iContextId = aContextId; |
|
111 TInt count = iPhoneGlobals.iContextList.Count(); |
|
112 TInt i; |
|
113 //Get the context from context list |
|
114 for(i = 0; i < count;i++) |
|
115 { |
|
116 if(iPhoneGlobals.iContextList[i]->iContextID == iContextId) |
|
117 { |
|
118 break; |
|
119 } |
|
120 } |
|
121 iQoSConfig = iPhoneGlobals.iContextList[i]->iQoSConfig; |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CATGprsSetProfileReq::ParseResponseL() |
|
126 // other items were commented in a header |
|
127 // --------------------------------------------------------------------------- |
|
128 void CATGprsSetProfileReq::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 // CATGprsSetProfileReq::EventSignal() |
|
142 // other items were commented in a header |
|
143 // --------------------------------------------------------------------------- |
|
144 void CATGprsSetProfileReq::EventSignal(TAtEventSource aEventSource, TInt aStatus) |
|
145 { |
|
146 if(KErrNone ==aStatus) |
|
147 { |
|
148 if(aEventSource == EReadCompletion) |
|
149 { |
|
150 aStatus = iError; |
|
151 } |
|
152 else |
|
153 return; |
|
154 } |
|
155 TInt count = iPhoneGlobals.iContextList.Count(); |
|
156 TInt i; |
|
157 //Get the context from context list |
|
158 for(i = 0; i < count;i++) |
|
159 { |
|
160 if(iPhoneGlobals.iContextList[i]->iContextID == iContextId) |
|
161 { |
|
162 break; |
|
163 } |
|
164 } |
|
165 |
|
166 CAtCommandBase::Complete(); |
|
167 if(KErrNone ==aStatus) |
|
168 { |
|
169 RPacketQoS::TQoSGPRSNegotiated QoSGPRSNegotiated; |
|
170 QoSGPRSNegotiated.iDelay = iPhoneGlobals.iContextList[i]->iQoSConfig.iReqDelay; |
|
171 QoSGPRSNegotiated.iMeanThroughput = iPhoneGlobals.iContextList[i]->iQoSConfig.iReqMeanThroughput; |
|
172 QoSGPRSNegotiated.iPeakThroughput = iPhoneGlobals.iContextList[i]->iQoSConfig.iReqPeakThroughput; |
|
173 QoSGPRSNegotiated.iPrecedence = iPhoneGlobals.iContextList[i]->iQoSConfig.iReqPrecedence; |
|
174 QoSGPRSNegotiated.iReliability = iPhoneGlobals.iContextList[i]->iQoSConfig.iReqReliability; |
|
175 iCtsyDispatcherCallback.CallbackPacketServicesNotifyQosProfileChangedGPRSInd(aStatus, |
|
176 iPhoneGlobals.iContextList[i]->iInfo.iName, |
|
177 QoSGPRSNegotiated); |
|
178 } |
|
179 iCtsyDispatcherCallback.CallbackPacketServicesSetPdpContextQosComp(aStatus, |
|
180 iPhoneGlobals.iContextList[i]->iInfo.iName); |
|
181 iPhoneGlobals.iEventSignalActive = EFalse; |
|
182 } |
|
183 |
|
184 /** |
|
185 * This Function creates the at set string for the AT+CGQREQ command. |
|
186 */ |
|
187 void CATGprsSetProfileReq::MakeupCGQREQ() |
|
188 { |
|
189 TInt precedence, delay, reliability, peakthru, meanthru = 0; |
|
190 |
|
191 switch (iQoSConfig.iReqPrecedence) |
|
192 { |
|
193 case RPacketQoS::EPriorityHighPrecedence: |
|
194 precedence = 1; // high precedence |
|
195 break; |
|
196 |
|
197 case RPacketQoS::EPriorityMediumPrecedence: |
|
198 precedence = 2; // normal precedence |
|
199 break; |
|
200 |
|
201 case RPacketQoS::EPriorityLowPrecedence: |
|
202 precedence = 3; // low precedence |
|
203 break; |
|
204 |
|
205 default: |
|
206 precedence = 0; // unspecified or unknown precedence |
|
207 break; |
|
208 }; |
|
209 |
|
210 switch (iQoSConfig.iReqDelay) |
|
211 { |
|
212 case RPacketQoS::EDelayClass1: |
|
213 delay = 1; |
|
214 break; |
|
215 |
|
216 case RPacketQoS::EDelayClass2: |
|
217 delay = 2; |
|
218 break; |
|
219 |
|
220 case RPacketQoS::EDelayClass3: |
|
221 delay = 3; |
|
222 break; |
|
223 |
|
224 case RPacketQoS::EDelayClass4: |
|
225 delay = 4; |
|
226 break; |
|
227 |
|
228 default: |
|
229 delay = 0; |
|
230 break; |
|
231 }; |
|
232 |
|
233 switch (iQoSConfig.iReqReliability) |
|
234 { |
|
235 case RPacketQoS::EReliabilityClass1: |
|
236 reliability = 1; |
|
237 break; |
|
238 |
|
239 case RPacketQoS::EReliabilityClass2: |
|
240 reliability = 2; |
|
241 break; |
|
242 |
|
243 case RPacketQoS::EReliabilityClass3: |
|
244 reliability = 3; |
|
245 break; |
|
246 |
|
247 case RPacketQoS::EReliabilityClass4: |
|
248 reliability = 4; |
|
249 break; |
|
250 |
|
251 case RPacketQoS::EReliabilityClass5: |
|
252 reliability = 5; |
|
253 break; |
|
254 |
|
255 default: |
|
256 reliability = 0; // unspecified or unknown reliability |
|
257 break; |
|
258 }; |
|
259 |
|
260 switch (iQoSConfig.iReqPeakThroughput) |
|
261 { |
|
262 case RPacketQoS::EPeakThroughput1000: |
|
263 peakthru = 1; |
|
264 break; |
|
265 |
|
266 case RPacketQoS::EPeakThroughput2000: |
|
267 peakthru = 2; |
|
268 break; |
|
269 |
|
270 case RPacketQoS::EPeakThroughput4000: |
|
271 peakthru = 3; |
|
272 break; |
|
273 |
|
274 case RPacketQoS::EPeakThroughput8000: |
|
275 peakthru = 4; |
|
276 break; |
|
277 |
|
278 case RPacketQoS::EPeakThroughput16000: |
|
279 peakthru = 5; |
|
280 break; |
|
281 |
|
282 case RPacketQoS::EPeakThroughput32000: |
|
283 peakthru = 6; |
|
284 break; |
|
285 |
|
286 case RPacketQoS::EPeakThroughput64000: |
|
287 peakthru = 7; |
|
288 break; |
|
289 |
|
290 case RPacketQoS::EPeakThroughput128000: |
|
291 peakthru = 8; |
|
292 break; |
|
293 |
|
294 case RPacketQoS::EPeakThroughput256000: |
|
295 peakthru = 9; |
|
296 break; |
|
297 |
|
298 default: |
|
299 peakthru = 0; // unspecified or unknown peak throughput |
|
300 break; |
|
301 }; |
|
302 |
|
303 switch (iQoSConfig.iReqMeanThroughput) |
|
304 { |
|
305 case RPacketQoS::EMeanThroughput100: |
|
306 meanthru = 2; |
|
307 break; |
|
308 |
|
309 case RPacketQoS::EMeanThroughput200: |
|
310 meanthru = 3; |
|
311 break; |
|
312 |
|
313 case RPacketQoS::EMeanThroughput500: |
|
314 meanthru = 4; |
|
315 break; |
|
316 |
|
317 case RPacketQoS::EMeanThroughput1000: |
|
318 meanthru = 5; |
|
319 break; |
|
320 |
|
321 case RPacketQoS::EMeanThroughput2000: |
|
322 meanthru = 6; |
|
323 break; |
|
324 |
|
325 case RPacketQoS::EMeanThroughput5000: |
|
326 meanthru = 7; |
|
327 break; |
|
328 |
|
329 case RPacketQoS::EMeanThroughput10000: |
|
330 meanthru = 8; |
|
331 break; |
|
332 |
|
333 case RPacketQoS::EMeanThroughput20000: |
|
334 meanthru = 9; |
|
335 break; |
|
336 |
|
337 case RPacketQoS::EMeanThroughput50000: |
|
338 meanthru = 10; |
|
339 break; |
|
340 |
|
341 case RPacketQoS::EMeanThroughput100000: |
|
342 meanthru = 11; |
|
343 break; |
|
344 |
|
345 case RPacketQoS::EMeanThroughput200000: |
|
346 meanthru = 12; |
|
347 break; |
|
348 case RPacketQoS::EMeanThroughput500000: |
|
349 meanthru = 13; |
|
350 break; |
|
351 |
|
352 case RPacketQoS::EMeanThroughput1000000: |
|
353 meanthru = 14; |
|
354 break; |
|
355 |
|
356 case RPacketQoS::EMeanThroughput2000000: |
|
357 meanthru = 15; |
|
358 break; |
|
359 |
|
360 case RPacketQoS::EMeanThroughput5000000: |
|
361 meanthru = 16; |
|
362 break; |
|
363 |
|
364 case RPacketQoS::EMeanThroughput10000000: |
|
365 meanthru = 17; |
|
366 break; |
|
367 |
|
368 case RPacketQoS::EMeanThroughput20000000: |
|
369 meanthru = 18; |
|
370 break; |
|
371 |
|
372 case RPacketQoS::EUnspecifiedMeanThroughput: |
|
373 case RPacketQoS::EMeanThroughput50000000: |
|
374 meanthru = 31; |
|
375 break; |
|
376 |
|
377 default: |
|
378 meanthru = 0; // unspecified or unknown mean throughput |
|
379 break; |
|
380 }; |
|
381 |
|
382 iTxBuffer.Format(KCGQreq,iContextId, |
|
383 precedence, |
|
384 delay, |
|
385 reliability, |
|
386 peakthru, |
|
387 meanthru); |
|
388 } |
|
389 |
|
390 // End of file |
|