24
|
1 |
// Copyright (c) 2001-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 |
//
|
|
15 |
|
|
16 |
#include "ATGprsContextActivate.H"
|
|
17 |
#include "mSLOGGER.H"
|
|
18 |
#include <pcktcs.h>
|
|
19 |
#include "ATGprsConfig.h"
|
|
20 |
#include "ATIO.H"
|
|
21 |
#include "TSYCONFG.H"
|
|
22 |
#include "NOTIFY.H"
|
|
23 |
#include "ATSTD.H"
|
|
24 |
#include "ATGprsContextDeactivate.H"
|
|
25 |
#include "atgprscontextdelete.h" // for CATGprsContextDelete class
|
|
26 |
#include "gprsqos.h"
|
|
27 |
|
|
28 |
#include <commsdattypesv1_1.h>
|
|
29 |
|
|
30 |
/**
|
|
31 |
* @file
|
|
32 |
* This file implements the CGprsContext class. Used to implement the RPacketContext API.
|
|
33 |
*/
|
|
34 |
|
|
35 |
CGprs* CGprsContext::Parent()
|
|
36 |
{return iParent;};
|
|
37 |
|
|
38 |
CGprsContext* CGprsContext::NewL(CGprs* aParent,CATIO* aIo, CATInit* aInit, CPhoneGlobals* aPhoneGlobals, const TName& aName, TInt aCid, RPacketContext::TContextConfigGPRS* aContextConfigGPRS)
|
|
39 |
/**
|
|
40 |
* Standard 2 phase constructor.
|
|
41 |
*
|
|
42 |
* @param aTelObject pointer to parent.
|
|
43 |
* @param aIo pointer to communication object.
|
|
44 |
* @param aInit pointer to AT phone init object.
|
|
45 |
* @param aPhoneGlobals pointer to phone global wide states.
|
|
46 |
* @param aName new name for the context which this object will represent
|
|
47 |
* @param aCid context ID of the context which this object will represent
|
|
48 |
* @param aContextConfigGPRS configuration of the context which this object will represent
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
CGprsContext* gprs=new(ELeave) CGprsContext(aParent, aIo, aInit, aPhoneGlobals, aCid);
|
|
52 |
CleanupStack::PushL(gprs);
|
|
53 |
gprs->ConstructL(aName, aContextConfigGPRS);
|
|
54 |
CleanupStack::Pop();
|
|
55 |
return gprs;
|
|
56 |
}
|
|
57 |
|
|
58 |
|
|
59 |
CGprsContext::CGprsContext(CGprs* aParent, CATIO* aIo, CATInit* aInit, CPhoneGlobals* aPhoneGlobals, TInt aCid)
|
|
60 |
: CSubSessionExtBase(), iCid(aCid), iParent(aParent), iIo(aIo), iInit(aInit), iPhoneGlobals(aPhoneGlobals)
|
|
61 |
/**
|
|
62 |
* Constructor
|
|
63 |
*
|
|
64 |
* @param aParent pointer to parent.
|
|
65 |
* @param aIo pointer to communication object.
|
|
66 |
* @param aInit pointer to AT phone init object.
|
|
67 |
* @param aPhoneGlobals pointer to phone global wide states.
|
|
68 |
*/
|
|
69 |
{
|
|
70 |
}
|
|
71 |
|
|
72 |
|
|
73 |
void CGprsContext::ConstructL(const TName& aName, RPacketContext::TContextConfigGPRS* aContextConfigGPRS)
|
|
74 |
/**
|
|
75 |
* This function creates all objects on the heap that can leave.
|
|
76 |
* @param aName Name of context.
|
|
77 |
* @param aContextConfigV1 Default contest config.
|
|
78 |
*/
|
|
79 |
{
|
|
80 |
LOGTEXT(_L8("CGprsContext: Entered constructor"));
|
|
81 |
iConfigGPRS = *aContextConfigGPRS;
|
|
82 |
iInfo.iName.Copy(aName);
|
|
83 |
iATGprsContextActivate = CATGprsContextActivate::NewL(iCid, iIo, this, iInit, iPhoneGlobals);
|
|
84 |
iATGPRSSetConfig = CATGPRSSetConfig::NewL(iCid, iIo, this, iInit, iPhoneGlobals);
|
|
85 |
iATGPRSGetConfig = CATGPRSGetConfig::NewL(iCid, iIo, this, iInit, iPhoneGlobals);
|
|
86 |
iATGprsContextDeactivate = CATGprsContextDeactivate::NewL(iIo, this, iInit, iPhoneGlobals);
|
|
87 |
iATGprsContextDelete = CATGprsContextDelete::NewL(iIo, this, iInit, iPhoneGlobals);
|
|
88 |
}
|
|
89 |
|
|
90 |
|
|
91 |
CGprsContext::~CGprsContext()
|
|
92 |
/**
|
|
93 |
* Destructor
|
|
94 |
*/
|
|
95 |
{
|
|
96 |
LOGTEXT(_L8("CGprsContext: Entered destructor"));
|
|
97 |
iParent->RemoveContext(this);
|
|
98 |
iPhoneGlobals->iNotificationStore->RemoveClientFromLastEvents(this);
|
|
99 |
delete iATGprsContextDelete;
|
|
100 |
delete iATGprsContextActivate;
|
|
101 |
delete iATGPRSSetConfig;
|
|
102 |
delete iATGPRSGetConfig;
|
|
103 |
delete iATGprsContextDeactivate;
|
|
104 |
}
|
|
105 |
|
|
106 |
|
|
107 |
void CGprsContext::Init()
|
|
108 |
/**
|
|
109 |
* This is not used. Init is done from the CPhone class.
|
|
110 |
*/
|
|
111 |
{
|
|
112 |
LOGTEXT(_L8("CGprsContext: init()"));
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
CTelObject* CGprsContext::OpenNewObjectByNameL(const TDesC& /*aName*/)
|
|
117 |
/**
|
|
118 |
* This function is not used.
|
|
119 |
*/
|
|
120 |
{
|
|
121 |
LOGTEXT(_L8("CGprsContext::OpenNewObjectByNameL called"));
|
|
122 |
User::Leave(KErrNotSupported);
|
|
123 |
return NULL;
|
|
124 |
}
|
|
125 |
|
|
126 |
|
|
127 |
CTelObject* CGprsContext::OpenNewObjectL(TDes& aNewName)
|
|
128 |
/**
|
|
129 |
* This function returns a pointer to a new QoS profile objecft (CGprsQoS)
|
|
130 |
*/
|
|
131 |
{
|
|
132 |
GenerateNewProfileName(aNewName); // create a unique name for this qos profile
|
|
133 |
#if defined __LOGDEB__
|
|
134 |
TBuf8<40> tmpLog;
|
|
135 |
tmpLog.Copy(aNewName);
|
|
136 |
LOGTEXT2(_L8("CGprs::OpenNewObjectL(), %S"), &tmpLog);
|
|
137 |
#endif
|
|
138 |
CGprsQoS* qos = CGprsQoS::NewL(this, iCid, iIo, iInit, iPhoneGlobals, aNewName);
|
|
139 |
return qos;
|
|
140 |
}
|
|
141 |
|
|
142 |
|
|
143 |
CTelObject::TReqMode CGprsContext::ReqModeL(const TInt aIpc)
|
|
144 |
/**
|
|
145 |
* This function is called from the framework and checks the flow control for a IPC call.
|
|
146 |
* @param aIpc IPC call from client.
|
|
147 |
*/
|
|
148 |
{
|
|
149 |
CTelObject::TReqMode ret=0;
|
|
150 |
switch (aIpc)
|
|
151 |
{
|
|
152 |
case EPacketContextActivate:
|
|
153 |
case EPacketContextDeactivate:
|
|
154 |
case EPacketContextSetConfig:
|
|
155 |
case EPacketContextLoanCommPort:
|
|
156 |
ret = KReqModeFlowControlObeyed;
|
|
157 |
break;
|
|
158 |
|
|
159 |
case EPacketContextDelete:
|
|
160 |
case EPacketContextGetStatus:
|
|
161 |
case EPacketContextGetLastErrorCause:
|
|
162 |
case EPacketContextGetConfig:
|
|
163 |
case EPacketContextGetDataVolumeTransferred:
|
|
164 |
case EPacketContextRecoverCommPort:
|
|
165 |
break;
|
|
166 |
|
|
167 |
case EPacketContextNotifyConfigChanged:
|
|
168 |
case EPacketContextNotifyStatusChange:
|
|
169 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
170 |
break;
|
|
171 |
|
|
172 |
default:
|
|
173 |
User::Leave(KErrNotSupported);
|
|
174 |
break;
|
|
175 |
}
|
|
176 |
|
|
177 |
// Check if the data port is currently loaned. If it is and the requested IPC
|
|
178 |
// is flow controlled then block Etel calling the IPC by leaving with KErrInUse
|
|
179 |
if((ret&KReqModeFlowControlObeyed) && iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
|
|
180 |
{
|
|
181 |
LOGTEXT2(_L8("ReqModeL Leaving with KErrInUse as data port is loaned (aIpc=%d)"),aIpc);
|
|
182 |
User::Leave(KErrInUse);
|
|
183 |
}
|
|
184 |
|
|
185 |
return ret;
|
|
186 |
}
|
|
187 |
|
|
188 |
|
|
189 |
TInt CGprsContext::RegisterNotification(const TInt aIpc)
|
|
190 |
/**
|
|
191 |
* This function is called from the framework.
|
|
192 |
*
|
|
193 |
* @param aIpc IPC call from client.
|
|
194 |
*/
|
|
195 |
{
|
|
196 |
LOGTEXT2(_L8("CGprsContext::RegisterNotification called with aIpc=%d"),aIpc);
|
|
197 |
switch (aIpc)
|
|
198 |
{
|
|
199 |
case EPacketContextNotifyConfigChanged:
|
|
200 |
case EPacketContextNotifyStatusChange:
|
|
201 |
case EPacketContextNotifyDataTransferred:
|
|
202 |
return KErrNone;
|
|
203 |
default:
|
|
204 |
// Unknown or invalid IPC
|
|
205 |
LOGTEXT2(_L8("CGprsContext::RegisterNotification Error Unknown IPC, aIpc=%d"),aIpc);
|
|
206 |
return KErrNotSupported;
|
|
207 |
}
|
|
208 |
}
|
|
209 |
|
|
210 |
|
|
211 |
TInt CGprsContext::DeregisterNotification(const TInt aIpc)
|
|
212 |
/**
|
|
213 |
* This function is called when the there is no client listening to a notification anymore.
|
|
214 |
*
|
|
215 |
* @param aIpc IPC call from client.
|
|
216 |
*/
|
|
217 |
{
|
|
218 |
LOGTEXT2(_L8("CGprs::DeregisterNotification called with aIpc=%d"),aIpc);
|
|
219 |
switch (aIpc)
|
|
220 |
{
|
|
221 |
case EPacketContextNotifyConfigChanged:
|
|
222 |
case EPacketContextNotifyStatusChange:
|
|
223 |
case EPacketContextNotifyDataTransferred:
|
|
224 |
return KErrNone;
|
|
225 |
default:
|
|
226 |
// Unknown or invalid IPC
|
|
227 |
LOGTEXT2(_L8("CGprsContext::DeregisterNotification Error Unknown IPC, aIpc=%d"),aIpc);
|
|
228 |
return KErrNotSupported;
|
|
229 |
}
|
|
230 |
}
|
|
231 |
|
|
232 |
|
|
233 |
TInt CGprsContext::NumberOfSlotsL(const TInt aIpc)
|
|
234 |
{
|
|
235 |
TInt numberOfSlots=0;
|
|
236 |
switch (aIpc)
|
|
237 |
{
|
|
238 |
case EPacketContextNotifyConfigChanged:
|
|
239 |
case EPacketContextNotifyStatusChange:
|
|
240 |
case EPacketContextNotifyDataTransferred:
|
|
241 |
LOGTEXT(_L8("CGprsContext: Registered with 5 slots"));
|
|
242 |
numberOfSlots=5;
|
|
243 |
break;
|
|
244 |
default:
|
|
245 |
// Unknown or invalid IPC
|
|
246 |
LOGTEXT(_L8("CGprsContext: Number of Slots error, unknown IPC"));
|
|
247 |
User::Leave(KErrNotSupported);
|
|
248 |
break;
|
|
249 |
}
|
|
250 |
return numberOfSlots;
|
|
251 |
|
|
252 |
}
|
|
253 |
|
|
254 |
|
|
255 |
TInt CGprsContext::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage)
|
|
256 |
/**
|
|
257 |
* This function is called from the framework.
|
|
258 |
*
|
|
259 |
* @param aTsyReqHandle handle to client.
|
|
260 |
* @param aIpc IPC call from client.
|
|
261 |
* @param aPackage agruments with the IPC call.
|
|
262 |
*/
|
|
263 |
{
|
|
264 |
TAny* dataPtr=aPackage.Ptr1();
|
|
265 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
266 |
|
|
267 |
if(ShouldNotProcessIpcCall(aIpc))
|
|
268 |
{// If the context is in state deleted these calls should not be processed.
|
|
269 |
ReqCompleted(aTsyReqHandle, KErrAccessDenied);
|
|
270 |
return KErrNone;
|
|
271 |
}
|
|
272 |
if(ShouldNotProcessIpcCallWhenComportIsLoaned(aIpc))
|
|
273 |
{// If the comport is loaned out ipcs that generate a at command shall be returned with KErrAccesssDenied
|
|
274 |
ReqCompleted(aTsyReqHandle, KErrAccessDenied);
|
|
275 |
return KErrNone;
|
|
276 |
}
|
|
277 |
switch (aIpc)
|
|
278 |
{
|
|
279 |
case EPacketContextSetConfig:
|
|
280 |
return SetConfig(aTsyReqHandle, aPackage.Des1n());
|
|
281 |
case EPacketContextGetConfig:
|
|
282 |
return GetConfig(aTsyReqHandle, aPackage.Des1n());
|
|
283 |
case EPacketContextNotifyConfigChanged:
|
|
284 |
return NotifyConfigChanged(aTsyReqHandle, aPackage.Des1n());
|
|
285 |
case EPacketContextActivate:
|
|
286 |
return Activate(aTsyReqHandle);
|
|
287 |
case EPacketContextDeactivate:
|
|
288 |
return Deactivate(aTsyReqHandle);
|
|
289 |
case EPacketContextDelete:
|
|
290 |
return Delete(aTsyReqHandle);
|
|
291 |
case EPacketContextLoanCommPort:
|
|
292 |
return LoanCommPort(aTsyReqHandle,
|
|
293 |
REINTERPRET_CAST(RCall::TCommPort*, dataPtr));
|
|
294 |
case EPacketContextRecoverCommPort:
|
|
295 |
return RecoverCommPort(aTsyReqHandle);
|
|
296 |
case EPacketContextGetStatus:
|
|
297 |
return GetStatus(aTsyReqHandle,
|
|
298 |
REINTERPRET_CAST(RPacketContext::TContextStatus*, dataPtr));
|
|
299 |
case EPacketContextNotifyStatusChange:
|
|
300 |
return NotifyStatusChange(aTsyReqHandle,
|
|
301 |
REINTERPRET_CAST(RPacketContext::TContextStatus*, dataPtr));
|
|
302 |
case EPacketContextGetDataVolumeTransferred:
|
|
303 |
return GetDataVolumeTransferred(aTsyReqHandle,
|
|
304 |
REINTERPRET_CAST(RPacketContext::TDataVolume*, dataPtr));
|
|
305 |
case EPacketContextNotifyDataTransferred:
|
|
306 |
return NotifyDataTransferred(aTsyReqHandle,
|
|
307 |
REINTERPRET_CAST(RPacketContext::TDataVolume*, dataPtr),
|
|
308 |
REINTERPRET_CAST(RPacketContext::TNotifyDataTransferredRequest*, dataPtr2));
|
|
309 |
case EPacketContextGetLastErrorCause:
|
|
310 |
return GetLastErrorCause(aTsyReqHandle,
|
|
311 |
REINTERPRET_CAST(TInt*, dataPtr));
|
|
312 |
default:
|
|
313 |
return KErrNotSupported;
|
|
314 |
}
|
|
315 |
}
|
|
316 |
|
|
317 |
|
|
318 |
RPacketService::TContextInfo* CGprsContext::ContextInfo()
|
|
319 |
/**
|
|
320 |
* This function returns the current context info.
|
|
321 |
*/
|
|
322 |
{
|
|
323 |
return &iInfo;
|
|
324 |
}
|
|
325 |
|
|
326 |
|
|
327 |
TInt CGprsContext::Cid()
|
|
328 |
/**
|
|
329 |
* This function returns the context id.
|
|
330 |
*/
|
|
331 |
{
|
|
332 |
return iCid;
|
|
333 |
}
|
|
334 |
|
|
335 |
|
|
336 |
void CGprsContext::ContextInfo(RPacketService::TContextInfo* aInfo)
|
|
337 |
/**
|
|
338 |
* This function returns the current context info.
|
|
339 |
* @param aInfo context info that is returned.
|
|
340 |
*/
|
|
341 |
{
|
|
342 |
aInfo->iName.Copy(iInfo.iName);
|
|
343 |
aInfo->iStatus = iInfo.iStatus;
|
|
344 |
}
|
|
345 |
|
|
346 |
|
|
347 |
void CGprsContext::SetContextInfo(const RPacketService::TContextInfo* aContextInfo)
|
|
348 |
/**
|
|
349 |
* This function sets the current context info.
|
|
350 |
* @param aContextInfo context into to set.
|
|
351 |
*/
|
|
352 |
{
|
|
353 |
iInfo.iName.Copy(aContextInfo->iName);
|
|
354 |
iInfo.iStatus = aContextInfo->iStatus;
|
|
355 |
}
|
|
356 |
|
|
357 |
|
|
358 |
TDes* CGprsContext::ContextName()
|
|
359 |
/**
|
|
360 |
* This function returns the context name.
|
|
361 |
*/
|
|
362 |
|
|
363 |
{
|
|
364 |
return &iInfo.iName;
|
|
365 |
}
|
|
366 |
|
|
367 |
|
|
368 |
RPacketContext::TContextConfigGPRS* CGprsContext::Config()
|
|
369 |
/**
|
|
370 |
* This function returns the context configuration.
|
|
371 |
*
|
|
372 |
*/
|
|
373 |
|
|
374 |
{
|
|
375 |
return &iConfigGPRS;
|
|
376 |
}
|
|
377 |
|
|
378 |
|
|
379 |
void CGprsContext::SetConfig(const RPacketContext::TContextConfigGPRS* aContextConfigGPRS)
|
|
380 |
/**
|
|
381 |
* This function sets the context configuration.
|
|
382 |
* @param iContextConfigV10 Configuration to set.
|
|
383 |
*/
|
|
384 |
|
|
385 |
{
|
|
386 |
iConfigGPRS = *aContextConfigGPRS;
|
|
387 |
}
|
|
388 |
|
|
389 |
|
|
390 |
void CGprsContext::GenerateNewProfileName(TDes& aName)
|
|
391 |
/**
|
|
392 |
* This function generates a unique qos profile name and a free qosId number.
|
|
393 |
*
|
|
394 |
* @param aName New name of the profile that is generated.
|
|
395 |
*/
|
|
396 |
{
|
|
397 |
_LIT(KGprsName, "GPRS_QOS");
|
|
398 |
aName.Append(KGprsName);
|
|
399 |
aName.AppendNum(++iGprsQoSProfileCount);
|
|
400 |
}
|
|
401 |
|
|
402 |
TInt CGprsContext::CancelService(const TInt aIpc, const TTsyReqHandle aTsyReqHandle)
|
|
403 |
/**
|
|
404 |
* This function is called from the framework and cancels a outstanding request.
|
|
405 |
* @param aIpc The IPC to cancel.
|
|
406 |
* @param aTsyReqHandle the client handle to cancel.
|
|
407 |
*/
|
|
408 |
{
|
|
409 |
LOGTEXT(_L8("CGprsATContextTsy: - CancelService called"));
|
|
410 |
switch (aIpc)
|
|
411 |
{
|
|
412 |
case EPacketContextSetConfig:
|
|
413 |
return SetConfigCancel(aTsyReqHandle);
|
|
414 |
case EPacketContextGetConfig:
|
|
415 |
return GetConfigCancel(aTsyReqHandle);
|
|
416 |
case EPacketContextNotifyConfigChanged:
|
|
417 |
return NotifyConfigChangedCancel(aTsyReqHandle);
|
|
418 |
case EPacketContextActivate:
|
|
419 |
return ActivateCancel(aTsyReqHandle);
|
|
420 |
case EPacketContextDeactivate:
|
|
421 |
return DeactivateCancel(aTsyReqHandle);
|
|
422 |
case EPacketContextDelete:
|
|
423 |
return DeleteCancel(aTsyReqHandle);
|
|
424 |
case EPacketContextLoanCommPort:
|
|
425 |
return LoanCommPortCancel(aTsyReqHandle);
|
|
426 |
case EPacketContextRecoverCommPort:
|
|
427 |
return RecoverCommPortCancel(aTsyReqHandle);
|
|
428 |
case EPacketContextNotifyStatusChange:
|
|
429 |
return NotifyStatusChangeCancel(aTsyReqHandle);
|
|
430 |
case EPacketContextNotifyDataTransferred:
|
|
431 |
return NotifyDataTransferredCancel(aTsyReqHandle);
|
|
432 |
default:
|
|
433 |
return KErrNotSupported;
|
|
434 |
}
|
|
435 |
}
|
|
436 |
|
|
437 |
|
|
438 |
|
|
439 |
TInt CGprsContext::SetConfig(const TTsyReqHandle aTsyReqHandle,const TDesC8* aConfig)
|
|
440 |
/**
|
|
441 |
* Called from a client via ExtFunc.
|
|
442 |
* This function will start a chain of AT commands to the phone(AT+CGQMIN and AT+CGQREQ).
|
|
443 |
*
|
|
444 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
445 |
* @param aConfig Pointer to a RPacketContext::TContextConfigPckg.
|
|
446 |
*/
|
|
447 |
{
|
|
448 |
LOGTEXT(_L8("CGprsContext::SetConfig called"));
|
|
449 |
iATGPRSSetConfig->ExecuteCommand(aTsyReqHandle, (TAny*)aConfig);
|
|
450 |
return KErrNone;
|
|
451 |
}
|
|
452 |
|
|
453 |
|
|
454 |
TInt CGprsContext::SetConfigCancel(const TTsyReqHandle aTsyReqHandle)
|
|
455 |
/**
|
|
456 |
* Cancels a outstanding request. Called via CancelService.
|
|
457 |
*
|
|
458 |
* @param aTsyReqHandle The handle to cancel
|
|
459 |
*/
|
|
460 |
{
|
|
461 |
LOGTEXT(_L8("CGprsContext::SetConfigCancel called"));
|
|
462 |
iATGPRSSetConfig->CancelCommand(aTsyReqHandle);
|
|
463 |
return KErrNone;
|
|
464 |
}
|
|
465 |
|
|
466 |
|
|
467 |
TInt CGprsContext::GetConfig(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig)
|
|
468 |
/**
|
|
469 |
* Called from a client via ExtFunc.
|
|
470 |
* This function will start a chain of AT commands to the phone(AT+CGQREQ?, AT+CGDCONT? and AT+CGQMIN?)
|
|
471 |
* and query the settings in the phone.
|
|
472 |
*
|
|
473 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
474 |
* @param aConfig Pointer to a RPacketContext::TContextConfigPckg.
|
|
475 |
*/
|
|
476 |
{
|
|
477 |
LOGTEXT(_L8("CGprsContext::GetConfig called"));
|
|
478 |
iATGPRSGetConfig->ExecuteCommand(aTsyReqHandle, aConfig);
|
|
479 |
return KErrNone;
|
|
480 |
}
|
|
481 |
|
|
482 |
|
|
483 |
TInt CGprsContext::GetConfigCancel(const TTsyReqHandle aTsyReqHandle)
|
|
484 |
/**
|
|
485 |
* Cancels a outstanding request. Called via CancelService.
|
|
486 |
*
|
|
487 |
* @param aTsyReqHandle The handle to cancel
|
|
488 |
*/
|
|
489 |
{
|
|
490 |
LOGTEXT(_L8("CGprsContext::GetConfigCancel called"));
|
|
491 |
iATGPRSGetConfig->CancelCommand(aTsyReqHandle);
|
|
492 |
return KErrNone;
|
|
493 |
}
|
|
494 |
|
|
495 |
|
|
496 |
|
|
497 |
TInt CGprsContext::NotifyConfigChanged(const TTsyReqHandle aTsyReqHandle, TDes8* aConfig)
|
|
498 |
/**
|
|
499 |
* Called from a client via ExtFunc.
|
|
500 |
* This function will complete when EPacketContextConfigChange event is triggered.
|
|
501 |
*
|
|
502 |
* @param aTsyReqHandle request handle that is completed.
|
|
503 |
* @param aConfig Pointer to a RPacketContext::TContextConfigPckg
|
|
504 |
*/
|
|
505 |
{
|
|
506 |
LOGTEXT(_L8("CGprsContext::NotifyConfigChanged called"));
|
|
507 |
iPhoneGlobals->iNotificationStore->RegisterNotification(EPacketContextConfigChange, aTsyReqHandle, this, aConfig);
|
|
508 |
return KErrNone;
|
|
509 |
}
|
|
510 |
|
|
511 |
|
|
512 |
TInt CGprsContext::NotifyConfigChangedCancel(const TTsyReqHandle aTsyReqHandle)
|
|
513 |
/**
|
|
514 |
* Cancels a outstanding request. Called via CancelService.
|
|
515 |
* @param aTsyReqHandle The handle to cancel
|
|
516 |
*/
|
|
517 |
{
|
|
518 |
LOGTEXT(_L8("CGprsContext::NotifyConfigChangedCancel called"));
|
|
519 |
iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
|
|
520 |
return KErrNone;
|
|
521 |
}
|
|
522 |
|
|
523 |
|
|
524 |
TInt CGprsContext::Deactivate(const TTsyReqHandle aTsyReqHandle)
|
|
525 |
/**
|
|
526 |
* Called from a client via ExtFunc.
|
|
527 |
* This function will start the sending of a AT command(ATD*99# or ATD*99***1#).
|
|
528 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
529 |
*/
|
|
530 |
{
|
|
531 |
LOGTEXT(_L8("CGprsContext::Deactivate called"));
|
|
532 |
iIo->DropDtr(); // Drops DTR
|
|
533 |
RPacketService::TContextInfo iContextInfo;
|
|
534 |
ContextInfo(&iContextInfo);
|
|
535 |
iContextInfo.iStatus = RPacketContext::EStatusDeactivating;
|
|
536 |
SetContextInfo(&iContextInfo);
|
|
537 |
iPhoneGlobals->iNotificationStore->CheckNotification(this, EPacketContextStatusChanged);
|
|
538 |
|
|
539 |
// Can not call ExecuteCommand as we do not want the
|
|
540 |
// iATSetToOnlineCommandMode->StartEscapeSequence() to be called.
|
|
541 |
iATGprsContextDeactivate->Start(aTsyReqHandle, NULL);
|
|
542 |
return KErrNone;
|
|
543 |
}
|
|
544 |
|
|
545 |
|
|
546 |
TInt CGprsContext::DeactivateCancel(const TTsyReqHandle aTsyReqHandle)
|
|
547 |
/**
|
|
548 |
* Cancels a outstanding request. Called via CancelService.
|
|
549 |
*
|
|
550 |
* @param aTsyReqHandle The handle to cancel
|
|
551 |
*/
|
|
552 |
{
|
|
553 |
LOGTEXT(_L8("CGprsContext::DeactivateCancel called"));
|
|
554 |
iATGprsContextDeactivate->CancelCommand( aTsyReqHandle);
|
|
555 |
return KErrNone;
|
|
556 |
}
|
|
557 |
|
|
558 |
|
|
559 |
TInt CGprsContext::Activate(const TTsyReqHandle aTsyReqHandle)
|
|
560 |
/**
|
|
561 |
* Called from a client via ExtFunc.
|
|
562 |
* This function will start the sending of a AT command(AT+CGATT=1).
|
|
563 |
*
|
|
564 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
565 |
*/
|
|
566 |
|
|
567 |
{
|
|
568 |
LOGTEXT(_L8("CGprsContext::Activate called"));
|
|
569 |
RPacketService::TContextInfo iContextInfo;
|
|
570 |
iContextInfo = *ContextInfo();
|
|
571 |
iContextInfo.iStatus = RPacketContext::EStatusActivating;
|
|
572 |
SetContextInfo(&iContextInfo);
|
|
573 |
iPhoneGlobals->iNotificationStore->CheckNotification(this, EPacketContextStatusChanged);
|
|
574 |
iATGprsContextActivate->ExecuteCommand(aTsyReqHandle,NULL);
|
|
575 |
return KErrNone;
|
|
576 |
}
|
|
577 |
|
|
578 |
|
|
579 |
TInt CGprsContext::ActivateCancel(const TTsyReqHandle aTsyReqHandle)
|
|
580 |
/**
|
|
581 |
* Cancels a outstanding request. Called via CancelService.
|
|
582 |
*
|
|
583 |
* @param aTsyReqHandle The handle to cancel
|
|
584 |
*/
|
|
585 |
{
|
|
586 |
LOGTEXT(_L8("CGprsContext::ActivateCancel called"));
|
|
587 |
iATGprsContextActivate->CancelCommand(aTsyReqHandle);
|
|
588 |
return KErrNone;
|
|
589 |
}
|
|
590 |
|
|
591 |
|
|
592 |
TInt CGprsContext::Delete(const TTsyReqHandle aTsyReqHandle)
|
|
593 |
/**
|
|
594 |
* Called from a client via ExtFunc.
|
|
595 |
* This function will set a context as deleted, thus rendering it useless.
|
|
596 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
597 |
*/
|
|
598 |
{
|
|
599 |
LOGTEXT(_L8("CGprsContext::Delete called"));
|
|
600 |
if(iInfo.iStatus!=RPacketContext::EStatusUnknown && iInfo.iStatus!=RPacketContext::EStatusInactive)
|
|
601 |
{
|
|
602 |
//
|
|
603 |
// Complete with KErrGeneral as this context is not in a state
|
|
604 |
// which will allow a deletion
|
|
605 |
ReqCompleted(aTsyReqHandle, KErrGeneral);
|
|
606 |
}
|
|
607 |
else
|
|
608 |
{
|
|
609 |
//
|
|
610 |
// Start an AT command state machine which
|
|
611 |
// will delete the context from the phone
|
|
612 |
iATGprsContextDelete->ExecuteCommand(aTsyReqHandle,&iCid);
|
|
613 |
}
|
|
614 |
return KErrNone;
|
|
615 |
}
|
|
616 |
|
|
617 |
|
|
618 |
TInt CGprsContext::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
619 |
/**
|
|
620 |
* Cancels a outstanding request. Called via CancelService.
|
|
621 |
* @param aTsyReqHandle The handle to cancel
|
|
622 |
*/
|
|
623 |
{
|
|
624 |
LOGTEXT(_L8("CGprsContext::DeleteCancel called"));
|
|
625 |
iATGprsContextDelete->CancelCommand(aTsyReqHandle);
|
|
626 |
return KErrNone;
|
|
627 |
}
|
|
628 |
|
|
629 |
|
|
630 |
TInt CGprsContext::LoanCommPort(const TTsyReqHandle aTsyReqHandle,RCall::TCommPort* aDataPort)
|
|
631 |
/**
|
|
632 |
* Called from a client via ExtFunc.
|
|
633 |
* This function will stop the TSY from using the comport and loan it to the client.
|
|
634 |
*
|
|
635 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
636 |
* @param aDataPort Pointer to a RCall::TCommPort
|
|
637 |
*/
|
|
638 |
{
|
|
639 |
LOGTEXT(_L8("CGprsContext::LoanCommPort called"));
|
|
640 |
|
|
641 |
// Check that this context is active
|
|
642 |
if(ContextInfo()->iStatus != RPacketContext::EStatusActive)
|
|
643 |
{
|
|
644 |
ReqCompleted(aTsyReqHandle,KErrNotReady);
|
|
645 |
return KErrNone;
|
|
646 |
}
|
|
647 |
|
|
648 |
// Check we have not already loaned the port
|
|
649 |
if(iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
|
|
650 |
{
|
|
651 |
ReqCompleted(aTsyReqHandle,KErrEtelPortAlreadyLoaned);
|
|
652 |
return KErrNone;
|
|
653 |
}
|
|
654 |
|
|
655 |
TFileName csy;
|
|
656 |
TName port;
|
|
657 |
TInt ret=iPhoneGlobals->iConfiguration->ConfigModemString(TPtrC(KCDTypeNameCsyName),csy);
|
|
658 |
if (ret!=KErrNone)
|
|
659 |
{
|
|
660 |
ReqCompleted(aTsyReqHandle, ret);
|
|
661 |
return KErrNone;
|
|
662 |
}
|
|
663 |
ret=iPhoneGlobals->iConfiguration->ConfigModemString(TPtrC(KCDTypeNamePortName),port);
|
|
664 |
if (ret!=KErrNone)
|
|
665 |
{
|
|
666 |
ReqCompleted(aTsyReqHandle, ret);
|
|
667 |
return KErrNone;
|
|
668 |
}
|
|
669 |
aDataPort->iCsy.Copy(csy);
|
|
670 |
aDataPort->iPort.Copy(port);
|
|
671 |
|
|
672 |
iPhoneGlobals->iPhoneStatus.iDataPortLoaned = ETrue;
|
|
673 |
iPhoneGlobals->iNotificationStore->CheckNotification(this,EDataPortLoaned);
|
|
674 |
|
|
675 |
// Cancel all reads and writes on the serial port
|
|
676 |
iIo->Cancel();
|
|
677 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
678 |
return KErrNone;
|
|
679 |
}
|
|
680 |
|
|
681 |
|
|
682 |
TInt CGprsContext::LoanCommPortCancel(const TTsyReqHandle aTsyReqHandle)
|
|
683 |
/**
|
|
684 |
* Cancels a outstanding request. Called via CancelService.
|
|
685 |
*
|
|
686 |
* @param aTsyReqHandle The handle to cancel
|
|
687 |
*/
|
|
688 |
{
|
|
689 |
LOGTEXT(_L8("CGprsContext::LoanCommPortCancel called"));
|
|
690 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
691 |
return KErrNone;
|
|
692 |
}
|
|
693 |
|
|
694 |
|
|
695 |
TInt CGprsContext::RecoverCommPort(const TTsyReqHandle aTsyReqHandle)
|
|
696 |
/**
|
|
697 |
* Called from a client via ExtFunc.
|
|
698 |
* This function will enable the TSY to use the comport again.
|
|
699 |
*
|
|
700 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
701 |
* @param aDataPort Pointer to a RCall::TCommPort
|
|
702 |
*/
|
|
703 |
{
|
|
704 |
LOGTEXT(_L8("CGprsContext::RecoverCommPort called"));
|
|
705 |
if(iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
|
|
706 |
{
|
|
707 |
iIo->Read(); // Queue a read again on the comm port
|
|
708 |
iPhoneGlobals->iPhoneStatus.iDataPortLoaned = EFalse;
|
|
709 |
LOGTEXT2(_L8("Comm signals : %x (hex)"),iIo->Signals());
|
|
710 |
LOGTEXT2(_L8("Comm signals after ResetBuffers : %x (hex)"),iIo->Signals());
|
|
711 |
}
|
|
712 |
else
|
|
713 |
{
|
|
714 |
ReqCompleted(aTsyReqHandle,KErrEtelPortNotLoanedToClient);
|
|
715 |
return KErrNone;
|
|
716 |
}
|
|
717 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
718 |
return KErrNone;
|
|
719 |
}
|
|
720 |
|
|
721 |
|
|
722 |
TInt CGprsContext::RecoverCommPortCancel(const TTsyReqHandle aTsyReqHandle)
|
|
723 |
/**
|
|
724 |
* Cancels a outstanding request. Called via CancelService.
|
|
725 |
*
|
|
726 |
* @param aTsyReqHandle The handle to cancel
|
|
727 |
*/
|
|
728 |
{
|
|
729 |
LOGTEXT(_L8("CGprsContext::RecoverCommPortCancel called"));
|
|
730 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
731 |
return KErrNone;
|
|
732 |
}
|
|
733 |
|
|
734 |
|
|
735 |
TInt CGprsContext::GetStatus(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus)
|
|
736 |
/**
|
|
737 |
* Called from a client via ExtFunc.
|
|
738 |
* This function will return the current state of the CGprsContext object.
|
|
739 |
*
|
|
740 |
* @param aTsyReqHandle request handle that is completed when done with request.
|
|
741 |
* @param aContextStatus Pointer to a RPacketContext::TContextStatus.
|
|
742 |
*/
|
|
743 |
{
|
|
744 |
LOGTEXT(_L8("CGprsContext::GetStatus called"));
|
|
745 |
*aContextStatus = ContextInfo()->iStatus;
|
|
746 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
747 |
return KErrNone;
|
|
748 |
}
|
|
749 |
|
|
750 |
|
|
751 |
TInt CGprsContext::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus)
|
|
752 |
/**
|
|
753 |
* Called from a client via ExtFunc.
|
|
754 |
* This function will complete when EPacketContextStatusChanged event is triggered.
|
|
755 |
*
|
|
756 |
* @param aTsyReqHandle request handle that is completed.
|
|
757 |
* @param aConfig Pointer to a RPacketContext::TContextStatus
|
|
758 |
*/
|
|
759 |
{
|
|
760 |
LOGTEXT(_L8("CGprsContext::NotifyStatusChange called"));
|
|
761 |
iPhoneGlobals->iNotificationStore->RegisterNotification(EPacketContextStatusChange, aTsyReqHandle, this, aContextStatus);
|
|
762 |
return KErrNone;
|
|
763 |
}
|
|
764 |
|
|
765 |
|
|
766 |
TInt CGprsContext::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
767 |
/**
|
|
768 |
* Cancels a outstanding request. Called via CancelService.
|
|
769 |
*
|
|
770 |
* @param aTsyReqHandle The handle to cancel
|
|
771 |
*/
|
|
772 |
{
|
|
773 |
LOGTEXT(_L8("CGprsContext::NotifyStatusChangeCancel called"));
|
|
774 |
iPhoneGlobals->iNotificationStore->RemoveNotification(aTsyReqHandle);
|
|
775 |
return KErrNone;
|
|
776 |
}
|
|
777 |
|
|
778 |
|
|
779 |
TInt CGprsContext::GetDataVolumeTransferred(const TTsyReqHandle aTsyReqHandle,RPacketContext::TDataVolume* /*aVolume*/)
|
|
780 |
/**
|
|
781 |
* This function is not supported.
|
|
782 |
*
|
|
783 |
* @param aTsyReqHandle request handle that is completed.
|
|
784 |
*/
|
|
785 |
{
|
|
786 |
LOGTEXT(_L8("CGprsContext::GetDataVolumeTransferred called"));
|
|
787 |
ReqCompleted(aTsyReqHandle, KErrNotSupported); // Req67
|
|
788 |
return KErrNone;
|
|
789 |
}
|
|
790 |
|
|
791 |
|
|
792 |
TInt CGprsContext::NotifyDataTransferred(const TTsyReqHandle aTsyReqHandle, RPacketContext::TDataVolume* /*aVolume*/, RPacketContext::TNotifyDataTransferredRequest* /*aData*/)
|
|
793 |
/**
|
|
794 |
* This function is not supported.
|
|
795 |
*
|
|
796 |
* @param aTsyReqHandle request handle that is completed.
|
|
797 |
*/
|
|
798 |
{
|
|
799 |
LOGTEXT(_L8("CGprsContext::NotifyStatusChange called"));
|
|
800 |
ReqCompleted(aTsyReqHandle, KErrNotSupported); // Req68
|
|
801 |
return KErrNone;
|
|
802 |
}
|
|
803 |
|
|
804 |
|
|
805 |
TInt CGprsContext::NotifyDataTransferredCancel(const TTsyReqHandle aTsyReqHandle)
|
|
806 |
/**
|
|
807 |
* Cancels a outstanding notification. Called via CancelService.
|
|
808 |
*
|
|
809 |
* @param aTsyReqHandle The handle to cancel
|
|
810 |
*/
|
|
811 |
{
|
|
812 |
LOGTEXT(_L8("CGprsContext::NotifyDataTransferredCancel called"));
|
|
813 |
ReqCompleted(aTsyReqHandle, KErrCancel); // Req69
|
|
814 |
return KErrNone;
|
|
815 |
}
|
|
816 |
|
|
817 |
|
|
818 |
TInt CGprsContext::GetLastErrorCause(const TTsyReqHandle aTsyReqHandle,TInt* /*aError*/)
|
|
819 |
/**
|
|
820 |
* This function is not supported.
|
|
821 |
*
|
|
822 |
* @param aTsyReqHandle request handle that is completed.
|
|
823 |
*/
|
|
824 |
{
|
|
825 |
LOGTEXT(_L8("CGprsContext::GetLastErrorCause called"));
|
|
826 |
ReqCompleted(aTsyReqHandle,KErrNotSupported); // Req70
|
|
827 |
return KErrNone;
|
|
828 |
}
|
|
829 |
|
|
830 |
|
|
831 |
TBool CGprsContext::ShouldNotProcessIpcCall(TInt aIpc)
|
|
832 |
/**
|
|
833 |
* This function indicates if a IPC should not be handled.
|
|
834 |
* @param aIPC A IPC call number.
|
|
835 |
*/
|
|
836 |
{
|
|
837 |
if(iInfo.iStatus != RPacketContext::EStatusDeleted)
|
|
838 |
return EFalse;
|
|
839 |
|
|
840 |
switch(aIpc)
|
|
841 |
{
|
|
842 |
case EPacketContextSetConfig:
|
|
843 |
case EPacketContextGetConfig:
|
|
844 |
case EPacketContextNotifyConfigChanged:
|
|
845 |
case EPacketContextActivate:
|
|
846 |
case EPacketContextDeactivate:
|
|
847 |
case EPacketContextDelete:
|
|
848 |
case EPacketContextLoanCommPort:
|
|
849 |
case EPacketContextRecoverCommPort:
|
|
850 |
LOGTEXT(_L8("CGprsContext::ShouldNotProcessIpcCall, context deleted. This ipc is not legal"));
|
|
851 |
return ETrue;
|
|
852 |
default:
|
|
853 |
return EFalse;
|
|
854 |
}
|
|
855 |
}
|
|
856 |
|
|
857 |
|
|
858 |
TBool CGprsContext::ShouldNotProcessIpcCallWhenComportIsLoaned(TInt aIpc)
|
|
859 |
/**
|
|
860 |
* This function indicates if a IPC should not be handled when comport is loaned.
|
|
861 |
* @param aIPC A IPC call number.
|
|
862 |
*/
|
|
863 |
{
|
|
864 |
if(!iPhoneGlobals->iPhoneStatus.iDataPortLoaned)
|
|
865 |
return EFalse;
|
|
866 |
switch(aIpc)
|
|
867 |
{
|
|
868 |
case EPacketContextSetConfig:
|
|
869 |
case EPacketContextGetConfig:
|
|
870 |
case EPacketContextNotifyConfigChanged:
|
|
871 |
case EPacketContextActivate:
|
|
872 |
case EPacketContextDeactivate:
|
|
873 |
case EPacketContextDelete:
|
|
874 |
case EPacketContextLoanCommPort:
|
|
875 |
LOGTEXT(_L8("CGprsContext::ShouldNotProcessIpcCallWhenComportIsLoaned, comport loaned out. This ipc is not legal"));
|
|
876 |
return ETrue;
|
|
877 |
default:
|
|
878 |
return EFalse;
|
|
879 |
}
|
|
880 |
}
|
|
881 |
|
|
882 |
void CGprsContext::RemoveQoSProfileIfFound(CGprsQoS* aProfile)
|
|
883 |
/**
|
|
884 |
* This function removes a QoS profile from the list.
|
|
885 |
* @param aProfile The QoS profile to remove from linked list.
|
|
886 |
*/
|
|
887 |
{
|
|
888 |
#ifdef _DEBUG
|
|
889 |
TBuf8<KMaxName> tmpLog;
|
|
890 |
tmpLog.Copy(*(aProfile->GetProfileName())); // Convert 16bit string to 8bit so we can log it
|
|
891 |
LOGTEXT2(_L8("CGprsContext::RemoveQoSProfileIfFound called, %S"), &tmpLog);
|
|
892 |
#endif
|
|
893 |
CGprsQoSEntry* profileEntry;
|
|
894 |
TDblQueIter<CGprsQoSEntry> iter(iProfiles);
|
|
895 |
while (profileEntry=iter++, profileEntry)
|
|
896 |
{
|
|
897 |
if (profileEntry->iProfile == aProfile)
|
|
898 |
{
|
|
899 |
profileEntry->Deque();
|
|
900 |
delete profileEntry; // just deletes list entry, not the profile itself
|
|
901 |
break;
|
|
902 |
}
|
|
903 |
}
|
|
904 |
}
|
|
905 |
|
|
906 |
//
|
|
907 |
// CGprsQoSEntry class
|
|
908 |
//
|
|
909 |
|
|
910 |
CGprsQoSEntry::CGprsQoSEntry(CGprsQoS* aProfile)
|
|
911 |
: iProfile(aProfile)
|
|
912 |
/**
|
|
913 |
* Constructor
|
|
914 |
* @param aProfile QoS Profile to add to entry
|
|
915 |
*/
|
|
916 |
{}
|
|
917 |
|
|
918 |
|
|
919 |
CGprsQoSEntry::~CGprsQoSEntry()
|
|
920 |
/**
|
|
921 |
* Destructor
|
|
922 |
*/
|
|
923 |
{}
|
|
924 |
|
|
925 |
|
|
926 |
void CGprsQoSEntry::Deque()
|
|
927 |
/**
|
|
928 |
* Remove entry from TDblQue link
|
|
929 |
*/
|
|
930 |
{
|
|
931 |
iLink.Deque();
|
|
932 |
iLink.iPrev=iLink.iNext=NULL;
|
|
933 |
}
|