24
|
1 |
// Copyright (c) 2008-2010 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 contains the implementation of the Similator TSY MBMS Packet Context functionality.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "Simlog.h"
|
|
23 |
#include "CSimPhone.h"
|
|
24 |
#include "CSimMbmsPacketContext.h"
|
|
25 |
#include "CSimPacketQoS.h"
|
|
26 |
#include "utils.h"
|
|
27 |
#include <e32math.h>
|
|
28 |
#include "CSimPacketService.h"
|
|
29 |
#include "CSimContextHelper.h"
|
|
30 |
|
|
31 |
CSimMbmsPacketContext* CSimMbmsPacketContext::NewL(CSimPhone* aPhone, CSimPacketService* aPacketService, const TDesC& aContextName)
|
|
32 |
/**
|
|
33 |
* Standard two phase constructor
|
|
34 |
*
|
|
35 |
* @param aPacketService Pointer to the Packet Service object (CSimPacketService)
|
|
36 |
* @param aContextName name for this packet context
|
|
37 |
* @return CSimMbmsPacketContext pointer to the packet context object created.
|
|
38 |
* @leave Leaves if no memory or object is not created for any reason.
|
|
39 |
*/
|
|
40 |
{
|
|
41 |
CSimMbmsPacketContext* packetContext = new(ELeave) CSimMbmsPacketContext(aPhone, aPacketService, aContextName);
|
|
42 |
CleanupStack::PushL(packetContext);
|
|
43 |
packetContext->ConstructL();
|
|
44 |
CleanupStack::Pop();
|
|
45 |
return packetContext;
|
|
46 |
}
|
|
47 |
|
|
48 |
CSimMbmsPacketContext::CSimMbmsPacketContext(CSimPhone* aPhone, CSimPacketService* aPacketService, const TName& aContextName)
|
|
49 |
:CSimPacketContext(aPhone,aPacketService,aContextName),iContextName(aContextName), iContextType(TPacketDataConfigBase::KConfigMBMS),
|
|
50 |
iPhone(aPhone),iPacketService(aPacketService)
|
|
51 |
/**
|
|
52 |
* Trivial Constructor. Initialises all the data members
|
|
53 |
*
|
|
54 |
* @param aPacketService Pointer to the Packet Service object (CSimPacketService)
|
|
55 |
* @param aContextName name for this packet context
|
|
56 |
*/
|
|
57 |
{
|
|
58 |
LOGPACKET1("CSimMbmsPacketContext: Entered constructor");
|
|
59 |
iNotifyConfigMBMS.iNotifyPending = EFalse;
|
|
60 |
iNotifyStatusChange.iNotifyPending = EFalse;
|
|
61 |
}
|
|
62 |
|
|
63 |
void CSimMbmsPacketContext::ConstructL()
|
|
64 |
/**
|
|
65 |
* Second phase of the 2-phase constructor.
|
|
66 |
* Constructs all the member data and retrieves all the data from the config file specific to this class.
|
|
67 |
*
|
|
68 |
* @leave Leaves no memory or any data member does not construct for any reason.
|
|
69 |
*/
|
|
70 |
{
|
|
71 |
LOGPACKET1("CSimMbmsPacketContext: Entered constructL function");
|
|
72 |
CSimPacketContext::ConstructL();
|
|
73 |
|
|
74 |
iMbmsSetConfigTimer = CSimTimer::NewL(iPhone);
|
|
75 |
iMbmsContextTimer = CSimTimer::NewL(iPhone);
|
|
76 |
iMbmsUpdateSessionTimer = CSimTimer::NewL(iPhone);
|
|
77 |
iMbmsContextInitTimer = CSimTimer::NewL(iPhone);
|
|
78 |
iMbmsGetSessionTimer = CSimTimer::NewL(iPhone);
|
|
79 |
|
|
80 |
iMbmsContextConfigParams = new (ELeave) CArrayFixFlat<TMbmsConfigParams>(KNumberofConfigs);
|
|
81 |
iSessionIdList = new (ELeave) CArrayFixFlat<TUint>(1);
|
|
82 |
iMbmsSessionList = new CArrayPtrFlat<CPcktListReadAllAttempt>(1);
|
|
83 |
|
|
84 |
const CTestConfigItem* item=NULL;
|
|
85 |
TInt ret=KErrNone;
|
|
86 |
|
|
87 |
/* Reading the MBMS Context configuration parameters */
|
|
88 |
TUint count=CfgFile()->ItemCount(KMBMSBroadcastMonitorList); //< Retrieves the Count of MBMS related information
|
|
89 |
|
|
90 |
for(TInt i=0;i<count;i++)
|
|
91 |
{
|
|
92 |
item = CfgFile()->Item(KMBMSBroadcastMonitorList,i); //< Retrieves the MBMS related information
|
|
93 |
|
|
94 |
TInt mnc =0;
|
|
95 |
TInt mcc =0;
|
|
96 |
TInt serviceId =0;
|
|
97 |
TInt accessBearer=0;
|
|
98 |
TInt serviceMode =0;
|
|
99 |
TInt activateCode =0;
|
|
100 |
TInt servicePriority=0;
|
|
101 |
if(!item)
|
|
102 |
break;
|
|
103 |
|
|
104 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,mcc);
|
|
105 |
if(ret!=KErrNone)
|
|
106 |
{
|
|
107 |
break;
|
|
108 |
}
|
|
109 |
|
|
110 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,mnc);
|
|
111 |
if(ret!=KErrNone)
|
|
112 |
{
|
|
113 |
break;
|
|
114 |
}
|
|
115 |
|
|
116 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,serviceId);
|
|
117 |
if(ret!=KErrNone)
|
|
118 |
{
|
|
119 |
break;
|
|
120 |
}
|
|
121 |
|
|
122 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,accessBearer);
|
|
123 |
if(ret!=KErrNone)
|
|
124 |
{
|
|
125 |
break;
|
|
126 |
}
|
|
127 |
|
|
128 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,serviceMode);
|
|
129 |
if(ret!=KErrNone)
|
|
130 |
{
|
|
131 |
break;
|
|
132 |
}
|
|
133 |
|
|
134 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,activateCode);
|
|
135 |
if(ret!=KErrNone)
|
|
136 |
{
|
|
137 |
break;
|
|
138 |
}
|
|
139 |
|
|
140 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,servicePriority);
|
|
141 |
if(ret!=KErrNone)
|
|
142 |
{
|
|
143 |
break;
|
|
144 |
}
|
|
145 |
|
|
146 |
TMbmsConfigParams mbmsConfigParams;
|
|
147 |
|
|
148 |
mbmsConfigParams.iMCC = mcc;
|
|
149 |
mbmsConfigParams.iMNC = mnc;
|
|
150 |
mbmsConfigParams.iServiceId = serviceId;
|
|
151 |
mbmsConfigParams.iAccessBearer = reinterpret_cast<TMbmsScope&> (accessBearer);
|
|
152 |
mbmsConfigParams.iServiceMode = reinterpret_cast<TMbmsServiceMode&> (serviceMode);
|
|
153 |
mbmsConfigParams.iServicePriority = reinterpret_cast<TMbmsServicePriority&> (servicePriority);
|
|
154 |
mbmsConfigParams.iActivateCode = activateCode;
|
|
155 |
|
|
156 |
iMbmsContextConfigParams->AppendL(mbmsConfigParams);
|
|
157 |
}
|
|
158 |
|
|
159 |
//iSessionIdList->AppendL(iNumOfSessionId);
|
|
160 |
iSessionIdList->InsertL(0,iNumOfSessionId);
|
|
161 |
|
|
162 |
/* Reading the list of session ids mentioned in the configuration file*/
|
|
163 |
/*item = CfgFile()->Item(KMBMSSessionIdList,0); //< Retrieves the MBMS related information
|
|
164 |
|
|
165 |
if(item != NULL)
|
|
166 |
{
|
|
167 |
TInt sessionId =0;
|
|
168 |
TInt numOfSessions =0;
|
|
169 |
|
|
170 |
ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,numOfSessions);
|
|
171 |
iSessionIdList->AppendL(numOfSessions);
|
|
172 |
|
|
173 |
for(TInt j=1;j<=numOfSessions;j++)
|
|
174 |
{
|
|
175 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,j,sessionId);
|
|
176 |
if(ret!=KErrNone)
|
|
177 |
{
|
|
178 |
break;
|
|
179 |
}
|
|
180 |
else
|
|
181 |
{
|
|
182 |
iSessionIdList->AppendL(sessionId);
|
|
183 |
}
|
|
184 |
}
|
|
185 |
}*/
|
|
186 |
}
|
|
187 |
|
|
188 |
void CSimMbmsPacketContext::Init()
|
|
189 |
/*
|
|
190 |
* Initialisation function; Not used in the CSimMbmsPacketContext class.
|
|
191 |
* but should be implemented as it is a pure virtual function of MTelObjectTSY.
|
|
192 |
*/
|
|
193 |
{}
|
|
194 |
|
|
195 |
CSimMbmsPacketContext::~CSimMbmsPacketContext()
|
|
196 |
/**
|
|
197 |
* Trivial Destructor
|
|
198 |
* Closes all CObject type objects and destroys all other objects created in the ConstructL()
|
|
199 |
*
|
|
200 |
*/
|
|
201 |
{
|
|
202 |
LOGPACKET1("CSimMbmsPacketContext: Entered destructor");
|
|
203 |
|
|
204 |
if (iMbmsSetConfigTimer != NULL)
|
|
205 |
{
|
|
206 |
delete iMbmsSetConfigTimer;
|
|
207 |
}
|
|
208 |
|
|
209 |
if(iMbmsContextTimer != NULL)
|
|
210 |
{
|
|
211 |
delete iMbmsContextTimer;
|
|
212 |
}
|
|
213 |
|
|
214 |
if(iMbmsUpdateSessionTimer != NULL)
|
|
215 |
{
|
|
216 |
delete iMbmsUpdateSessionTimer;
|
|
217 |
}
|
|
218 |
|
|
219 |
if(iMbmsContextInitTimer)
|
|
220 |
{
|
|
221 |
delete iMbmsContextInitTimer;
|
|
222 |
}
|
|
223 |
|
|
224 |
if(iMbmsGetSessionTimer)
|
|
225 |
{
|
|
226 |
delete iMbmsGetSessionTimer;
|
|
227 |
}
|
|
228 |
|
|
229 |
if(iMbmsContextConfigParams !=NULL)
|
|
230 |
{
|
|
231 |
iMbmsContextConfigParams->Delete(0,iMbmsContextConfigParams->Count());
|
|
232 |
delete iMbmsContextConfigParams;
|
|
233 |
}
|
|
234 |
|
|
235 |
if(iSessionIdList != NULL)
|
|
236 |
{
|
|
237 |
iSessionIdList->Delete(0,iSessionIdList->Count());
|
|
238 |
delete iSessionIdList;
|
|
239 |
}
|
|
240 |
|
|
241 |
if(iMbmsSessionList)
|
|
242 |
{
|
|
243 |
iMbmsSessionList->ResetAndDestroy();
|
|
244 |
}
|
|
245 |
delete iMbmsSessionList;
|
|
246 |
|
|
247 |
iPacketService->DecrementMbmsContextCount();
|
|
248 |
}
|
|
249 |
|
|
250 |
CTelObject* CSimMbmsPacketContext::OpenNewObjectByNameL(const TDesC& /*aName*/)
|
|
251 |
/**
|
|
252 |
* No Qos settings for the MBMS broadcast context
|
|
253 |
* This is not supported and if called, will leave.
|
|
254 |
*
|
|
255 |
* @param aName name of the QoS object to be opened
|
|
256 |
* @leave Leaves with KErrNotSupported if the name is not as expected.
|
|
257 |
* @ return NULL.
|
|
258 |
*/
|
|
259 |
{
|
|
260 |
LOGPACKET1("Unexpected call to CSimMbmsPacketContext: OpenNewObjectByName");
|
|
261 |
User::Leave(KErrNotSupported);
|
|
262 |
return NULL;
|
|
263 |
}
|
|
264 |
|
|
265 |
CTelObject* CSimMbmsPacketContext::OpenNewObjectL(TDes& /*aNewName*/)
|
|
266 |
/**
|
|
267 |
* No Qos settings for the MBMS broadcast context
|
|
268 |
* This is not supported and if called, will leave.
|
|
269 |
*
|
|
270 |
* @param aNewName new name of the object created
|
|
271 |
* @return NULL
|
|
272 |
* @leave Leaves if out of memory.
|
|
273 |
*/
|
|
274 |
{
|
|
275 |
LOGPACKET1("Unexpected call to CSimMbmsPacketContext: OpenNewObjectL");
|
|
276 |
User::Leave(KErrNotSupported);
|
|
277 |
return NULL;
|
|
278 |
}
|
|
279 |
|
|
280 |
CTelObject::TReqMode CSimMbmsPacketContext::ReqModeL(const TInt aIpc)
|
|
281 |
/**
|
|
282 |
* ReqModeL is called from the server's CTelObject::ReqAnalyserL
|
|
283 |
* in order to check the type of request it has.
|
|
284 |
*
|
|
285 |
* @param aIpc the ipc number that identifies the client request
|
|
286 |
* @return CTelObject::TReqMode The request mode to be used for this request
|
|
287 |
* @leave Leaves if not supported by this tsy
|
|
288 |
*/
|
|
289 |
{
|
|
290 |
LOGPACKET1("CSimMbmsPacketContext: ReqModeL");
|
|
291 |
CTelObject::TReqMode ret=0;
|
|
292 |
switch (aIpc)
|
|
293 |
{
|
|
294 |
case EPacketContextGetConfig:
|
|
295 |
case EPacketContextSetConfig:
|
|
296 |
case EPacketContextActivate:
|
|
297 |
case EPacketContextDeactivate:
|
|
298 |
case EPacketContextDelete:
|
|
299 |
case EPacketContextGetStatus:
|
|
300 |
case EPacketContextUpdateMbmsSessionList:
|
|
301 |
case EPacketContextInitialiseContext:
|
|
302 |
case EPacketGetMbmsSessionListPhase1:
|
|
303 |
case EPacketGetMbmsSessionListPhase2:
|
|
304 |
case EPacketContextGetLastErrorCause:
|
|
305 |
break;
|
|
306 |
|
|
307 |
case EPacketContextNotifyConfigChanged:
|
|
308 |
case EPacketContextNotifyStatusChange:
|
|
309 |
case EPacketContextNotifyDataTransferred:
|
|
310 |
ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately;
|
|
311 |
break;
|
|
312 |
default:
|
|
313 |
LOGPACKET1("CSimMbmsPacketContext: ReqModeL error, unknown IPC");
|
|
314 |
LOGPACKET1("CSimMbmsPacketContext: ReqModeL sending the request to CSimPacketContext");
|
|
315 |
ret = CSimPacketContext::ReqModeL(aIpc);
|
|
316 |
break;
|
|
317 |
}
|
|
318 |
return ret;
|
|
319 |
}
|
|
320 |
|
|
321 |
TInt CSimMbmsPacketContext::RegisterNotification(const TInt aIpc)
|
|
322 |
/**
|
|
323 |
* RegisterNotification is called when the server recognises that this notification
|
|
324 |
* is being posted for the first time on this sub-session object.
|
|
325 |
*
|
|
326 |
* It enables the TSY to "turn on" any regular notification messages that it may receive
|
|
327 |
* from the phone
|
|
328 |
*
|
|
329 |
* @param aIpc the ipc number that identifies the client request
|
|
330 |
* @return err KErrNone if fine
|
|
331 |
*/
|
|
332 |
{
|
|
333 |
LOGPACKET1("CSimMbmsPacketContext: RegisterNotification called");
|
|
334 |
switch (aIpc)
|
|
335 |
{
|
|
336 |
case EPacketContextNotifyConfigChanged:
|
|
337 |
case EPacketContextNotifyStatusChange:
|
|
338 |
case EPacketContextNotifyDataTransferred:
|
|
339 |
LOGPACKET1("CSimMbmsPacketContext: RegisterNotification");
|
|
340 |
return KErrNone;
|
|
341 |
default:
|
|
342 |
// Unknown or invalid IPC
|
|
343 |
LOGPACKET1("CSimMbmsPacketContext: Register error, unknown IPC");
|
|
344 |
LOGPACKET1("CSimMbmsPacketContext: Register sending the request to CSimPacketContext");
|
|
345 |
return CSimPacketContext::RegisterNotification(aIpc);
|
|
346 |
}
|
|
347 |
}
|
|
348 |
|
|
349 |
TInt CSimMbmsPacketContext::DeregisterNotification(const TInt aIpc)
|
|
350 |
/**
|
|
351 |
* DeregisterNotification is called when the server recognises that this notification
|
|
352 |
* will not be posted again because the last client to have a handle on this sub-session
|
|
353 |
* object has just closed the handle.
|
|
354 |
*
|
|
355 |
* It enables the TSY to "turn off" any regular notification messages that it may
|
|
356 |
* receive from the phone
|
|
357 |
*
|
|
358 |
* @param aIpc the ipc number that identifies the client request
|
|
359 |
* @return err KErrNone if fine
|
|
360 |
*/
|
|
361 |
{
|
|
362 |
LOGPACKET1("CSimMbmsPacketContext: DeregisterNotification called");
|
|
363 |
switch (aIpc)
|
|
364 |
{
|
|
365 |
case EPacketContextNotifyConfigChanged:
|
|
366 |
case EPacketContextNotifyStatusChange:
|
|
367 |
case EPacketContextNotifyDataTransferred:
|
|
368 |
LOGPACKET1("CSimMbmsPacketContext: DeregisterNotification");
|
|
369 |
return KErrNone;
|
|
370 |
default:
|
|
371 |
// Unknown or invalid IPC
|
|
372 |
LOGPACKET1("CSimMbmsPacketContext: Deregister error, unknown IPC");
|
|
373 |
LOGPACKET1("CSimMbmsPacketContext: Deregister sending the request to CSimPacketContext");
|
|
374 |
return CSimPacketContext::DeregisterNotification(aIpc);
|
|
375 |
}
|
|
376 |
}
|
|
377 |
|
|
378 |
TInt CSimMbmsPacketContext::NumberOfSlotsL(const TInt aIpc)
|
|
379 |
/**
|
|
380 |
* NumberOfSlotsL is called by the server when it is registering a new notification
|
|
381 |
* It enables the TSY to tell the server how many buffer slots to allocate for
|
|
382 |
* "repost immediately" notifications that may trigger before clients collect them
|
|
383 |
*
|
|
384 |
* @param aIpc the ipc number that identifies the client request
|
|
385 |
* @return err KErrNone if fine
|
|
386 |
*/
|
|
387 |
{
|
|
388 |
LOGPACKET1("CSimMbmsPacketContext: NumberOfSlotsL called");
|
|
389 |
TInt numberOfSlots=1;
|
|
390 |
switch (aIpc)
|
|
391 |
{
|
|
392 |
case EPacketContextNotifyConfigChanged:
|
|
393 |
case EPacketContextNotifyStatusChange:
|
|
394 |
case EPacketContextNotifyDataTransferred:
|
|
395 |
LOGPACKET1("CSimMbmsPacketContext: Registered with 5 slots");
|
|
396 |
numberOfSlots=5;
|
|
397 |
break;
|
|
398 |
default:
|
|
399 |
// Unknown or invalid IPC
|
|
400 |
LOGPACKET1("CSimMbmsPacketContext: Number of Slots error, unknown IPC");
|
|
401 |
LOGPACKET1("CSimMbmsPacketContext: Number of Slots: sending the request to CSimPacketContext");
|
|
402 |
return CSimPacketContext::NumberOfSlotsL(aIpc);
|
|
403 |
}
|
|
404 |
return numberOfSlots;
|
|
405 |
}
|
|
406 |
|
|
407 |
TInt CSimMbmsPacketContext::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,
|
|
408 |
const TDataPackage& aPackage)
|
|
409 |
/**
|
|
410 |
* ExtFunc is called by the server when it has a "extended", i.e. non-core ETel request
|
|
411 |
* for the TSY to process.
|
|
412 |
* A request handle, request type and request data are passed to the TSY
|
|
413 |
*
|
|
414 |
* @param aTsyReqHandle The request handle for completing the request
|
|
415 |
* @param aIpc Ipc representing the request
|
|
416 |
* @param aPackage any data associated with the request
|
|
417 |
* @return err KErrNone if request completes ok
|
|
418 |
*/
|
|
419 |
{
|
|
420 |
//< if this context has been deleted then the client can not do anything with it
|
|
421 |
//< if the client wants to use this class, the client must open a new object by
|
|
422 |
//< name with the name for this context and this will reactivate the context.
|
|
423 |
if(iDeleted && (aIpc != EPacketContextGetStatus))
|
|
424 |
{
|
|
425 |
ReqCompleted(aTsyReqHandle,KErrNotReady);
|
|
426 |
return KErrNone;
|
|
427 |
}
|
|
428 |
LOGPACKET1("CSimMbmsPacketContext: ExtFunc Called");
|
|
429 |
TAny* dataPtr=aPackage.Ptr1();
|
|
430 |
TAny* dataPtr2=aPackage.Ptr2();
|
|
431 |
|
|
432 |
switch (aIpc)
|
|
433 |
{
|
|
434 |
case EPacketContextGetConfig:
|
|
435 |
return GetConfig(aTsyReqHandle, aPackage.Des1n());
|
|
436 |
case EPacketContextGetConfigCancel:
|
|
437 |
return GetConfigCancel(aTsyReqHandle);
|
|
438 |
case EPacketContextSetConfig:
|
|
439 |
return SetConfig(aTsyReqHandle, aPackage.Des1n());
|
|
440 |
case EPacketContextSetConfigCancel:
|
|
441 |
return SetConfigCancel(aTsyReqHandle);
|
|
442 |
case EPacketContextActivate:
|
|
443 |
{ //< Ensures that theres only one context active as only one active context is
|
|
444 |
//<permitted at any one time
|
|
445 |
if(iIsActive)
|
|
446 |
{
|
|
447 |
LOGPACKET1("Trying to activate an already activated context");
|
|
448 |
ReqCompleted(aTsyReqHandle,KErrEtelCallAlreadyActive);
|
|
449 |
return KErrNone;
|
|
450 |
}
|
|
451 |
else
|
|
452 |
return Activate(aTsyReqHandle);
|
|
453 |
}
|
|
454 |
case EPacketContextActivateCancel:
|
|
455 |
return ActivateCancel(aTsyReqHandle);
|
|
456 |
case EPacketContextDeactivate:
|
|
457 |
return Deactivate(aTsyReqHandle);
|
|
458 |
case EPacketContextDeactivateCancel:
|
|
459 |
return DeactivateCancel(aTsyReqHandle);
|
|
460 |
case EPacketContextDelete:
|
|
461 |
return Delete(aTsyReqHandle);
|
|
462 |
case EPacketContextDeleteCancel:
|
|
463 |
return DeleteCancel(aTsyReqHandle);
|
|
464 |
case EPacketContextGetLastErrorCause:
|
|
465 |
return GetLastErrorCause(aTsyReqHandle,
|
|
466 |
REINTERPRET_CAST(TInt*, dataPtr));
|
|
467 |
case EPacketContextNotifyConfigChanged:
|
|
468 |
return NotifyConfigChanged(aTsyReqHandle, aPackage.Des1n());
|
|
469 |
case EPacketContextNotifyConfigChangedCancel:
|
|
470 |
return NotifyConfigChangedCancel(aTsyReqHandle);
|
|
471 |
case EPacketContextNotifyStatusChange:
|
|
472 |
return NotifyStatusChange(aTsyReqHandle,
|
|
473 |
REINTERPRET_CAST(RPacketContext::TContextStatus*, dataPtr));
|
|
474 |
case EPacketContextNotifyStatusChangeCancel:
|
|
475 |
return NotifyStatusChangeCancel(aTsyReqHandle);
|
|
476 |
case EPacketContextGetStatus:
|
|
477 |
return GetStatus(aTsyReqHandle,
|
|
478 |
REINTERPRET_CAST(RPacketContext::TContextStatus*, dataPtr));
|
|
479 |
case EPacketContextUpdateMbmsSessionList:
|
|
480 |
return UpdateMbmsSessionList(aTsyReqHandle,
|
|
481 |
REINTERPRET_CAST(TMbmsAction*, dataPtr),
|
|
482 |
REINTERPRET_CAST(TUint*, dataPtr2));
|
|
483 |
case EPacketContextInitialiseContext:
|
|
484 |
return InitialiseContext(aTsyReqHandle, aPackage.Des1n());
|
|
485 |
case EPacketContextInitialiseContextCancel:
|
|
486 |
return InitialiseContextCancel(aTsyReqHandle);
|
|
487 |
case EPacketGetMbmsSessionListPhase1:
|
|
488 |
return GetMbmsSessionsPhase1(aTsyReqHandle,
|
|
489 |
REINTERPRET_CAST(TClientId*, dataPtr),
|
|
490 |
REINTERPRET_CAST(TInt*, dataPtr2));
|
|
491 |
case EPacketGetMbmsSessionListPhase2:
|
|
492 |
return GetMbmsSessionsPhase2(aTsyReqHandle,
|
|
493 |
REINTERPRET_CAST(TClientId*, dataPtr), aPackage.Des2n());
|
|
494 |
default:
|
|
495 |
LOGPACKET1("CSimMbmsPacketContext: ExtFunc Unknown IPC");
|
|
496 |
LOGPACKET1("CSimMbmsPacketContext: sending the request to CSimPacketContext::ExtFunc Unknown IPC");
|
|
497 |
return CSimPacketContext::ExtFunc(aTsyReqHandle,aIpc,aPackage);
|
|
498 |
}
|
|
499 |
}
|
|
500 |
|
|
501 |
TInt CSimMbmsPacketContext::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle)
|
|
502 |
/**
|
|
503 |
* CancelService is called by the server when it is "cleaning-up" any still outstanding
|
|
504 |
* asynchronous requests before closing a client's sub-session.
|
|
505 |
* This will happen if a client closes its R-class handle without cancelling outstanding asynchronous requests.
|
|
506 |
*
|
|
507 |
* @param aTsyReqHandle The request handle for completing the request
|
|
508 |
* @param aIpc Ipc representing the request
|
|
509 |
* @return err KErrNone if request completes ok
|
|
510 |
*/
|
|
511 |
{
|
|
512 |
LOGPACKET1("CSimMbmsPacketContext: - CancelService called");
|
|
513 |
|
|
514 |
switch (aIpc)
|
|
515 |
{
|
|
516 |
case EPacketContextSetConfig:
|
|
517 |
return SetConfigCancel(aTsyReqHandle);
|
|
518 |
case EPacketContextGetConfig:
|
|
519 |
return GetConfigCancel(aTsyReqHandle);
|
|
520 |
case EPacketContextActivate:
|
|
521 |
return ActivateCancel(aTsyReqHandle);
|
|
522 |
case EPacketContextDeactivate:
|
|
523 |
return DeactivateCancel(aTsyReqHandle);
|
|
524 |
case EPacketContextDeleteCancel:
|
|
525 |
return DeleteCancel(aTsyReqHandle);
|
|
526 |
case EPacketContextNotifyConfigChanged:
|
|
527 |
return NotifyConfigChangedCancel(aTsyReqHandle);
|
|
528 |
case EPacketContextNotifyStatusChange:
|
|
529 |
return NotifyStatusChangeCancel(aTsyReqHandle);
|
|
530 |
case EPacketContextInitialiseContext:
|
|
531 |
return InitialiseContextCancel(aTsyReqHandle);
|
|
532 |
case EPacketGetMbmsSessionListPhase1:
|
|
533 |
case EPacketGetMbmsSessionListPhase2:
|
|
534 |
return GetMbmsSessionsCancel(aTsyReqHandle);
|
|
535 |
default:
|
|
536 |
LOGPACKET1("CSimMbmsPacketContext: - CancelService unknown IPC called");
|
|
537 |
LOGPACKET1("CSimMbmsPacketContext: sending the request to CSimPacketContext::ExtFunc Unknown IPC");
|
|
538 |
return CSimPacketContext::CancelService(aIpc,aTsyReqHandle);
|
|
539 |
}
|
|
540 |
}
|
|
541 |
|
|
542 |
void CSimMbmsPacketContext::TimerCallBack(TInt aId)
|
|
543 |
/**
|
|
544 |
* Timer callback function. When the timer goes off, it will call back into this
|
|
545 |
* function for further processing.
|
|
546 |
* param - aId indicates which Timer Event has occured.
|
|
547 |
*/
|
|
548 |
{
|
|
549 |
LOGPACKET1("CSimMbmsPacketContext: - TimerCallBack(TInt aId) called");
|
|
550 |
switch(aId)
|
|
551 |
{
|
|
552 |
case ETimerIdMbmsPcktContextSetConfig:
|
|
553 |
LOGPACKET1("CSimMbmsPacketContext: - TimerCallBack SetConfig called");
|
|
554 |
if(iSetConfigValues.iErrorValue == KErrNone)
|
|
555 |
{
|
|
556 |
iMbmsContextConfigParamsIndex = iSetConfigValues.iIndex ;
|
|
557 |
}
|
|
558 |
ReqCompleted(iSetConfigRequestHandle,iSetConfigValues.iErrorValue);
|
|
559 |
break;
|
|
560 |
case ETimerIdMbmsUpdateSessionId:
|
|
561 |
LOGPACKET1("CSimMbmsPacketContext: - TimerCallBack UpdateSessionID called");
|
|
562 |
if(iUpdateSessionHandle != NULL)
|
|
563 |
{
|
|
564 |
ReqCompleted(iUpdateSessionHandle,KErrNone);
|
|
565 |
}
|
|
566 |
break;
|
|
567 |
case ETimerIdPcktContextInitContext:
|
|
568 |
DoInitialiseContext();
|
|
569 |
break;
|
|
570 |
case ETimerIdPcktContextCreateTft:
|
|
571 |
CSimPacketContext::TimerCallBack(aId);
|
|
572 |
break;
|
|
573 |
default:
|
|
574 |
{
|
|
575 |
LOGPACKET1(">>CSimMbmsPacketContext::TimerCallBack Default Case for Context Events");
|
|
576 |
switch(iCurrentEvent)
|
|
577 |
{
|
|
578 |
case EMbmsContextEventNone:
|
|
579 |
LOGPACKET1("TimerCallBack - iCurrentEvent = [EMbmsContextEventNone]");
|
|
580 |
break;
|
|
581 |
case EMbmsContextEventActivate:
|
|
582 |
LOGPACKET1("TimerCallBack - iCurrentEvent = [EMbmsContextEventActivate]");
|
|
583 |
if(iState==RPacketContext::EStatusActivating)
|
|
584 |
{
|
|
585 |
TInt activateValue = iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iActivateCode;
|
|
586 |
TInt ret;
|
|
587 |
if(activateValue != KErrNone)
|
|
588 |
{ // Reject the Activation request.
|
|
589 |
ret=ChangeState(RPacketContext::EStatusInactive);
|
|
590 |
ReqCompleted(iActivateRequestHandle,KErrGprsActivationRejected);
|
|
591 |
iCurrentEvent=EMbmsContextEventNone;
|
|
592 |
}
|
|
593 |
else
|
|
594 |
{
|
|
595 |
ret=ChangeState(RPacketContext::EStatusActive);
|
|
596 |
ReqCompleted(iActivateRequestHandle,ret);
|
|
597 |
iCurrentEvent=EMbmsContextEventNone;
|
|
598 |
iIsActive = ETrue;
|
|
599 |
}
|
|
600 |
|
|
601 |
// Check for and complete any pending notifications
|
|
602 |
if(iNotifyConfigMBMS.iNotifyPending)
|
|
603 |
{
|
|
604 |
TMbmsConfigParams thisConfig = iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex);
|
|
605 |
iNotifyConfigMBMS.iNotifyPending=EFalse;
|
|
606 |
RPacketMbmsContext::TContextConfigMbmsV1 *tempConfig = (RPacketMbmsContext::TContextConfigMbmsV1*)iNotifyConfigMBMS.iNotifyData;
|
|
607 |
tempConfig->iTmgi.SetServiceId(thisConfig.iServiceId);
|
|
608 |
tempConfig->iTmgi.SetMCC(thisConfig.iMCC);
|
|
609 |
tempConfig->iTmgi.SetMNC(thisConfig.iMNC);
|
|
610 |
tempConfig->iMbmsAccessBearer= thisConfig.iAccessBearer;
|
|
611 |
tempConfig->iMbmsServicePriority = thisConfig.iServicePriority;
|
|
612 |
tempConfig->iMbmsServiceMode = thisConfig.iServiceMode;
|
|
613 |
ReqCompleted(iNotifyConfigMBMS.iNotifyHandle,KErrNone);
|
|
614 |
}
|
|
615 |
}
|
|
616 |
else
|
|
617 |
{
|
|
618 |
LOGPACKET1("Unexpected iState for iCurrentEvent[EMbmsContextEventActivate]");
|
|
619 |
}
|
|
620 |
break;
|
|
621 |
case EMbmsContextEventDeactivate:
|
|
622 |
LOGPACKET1("TimerCallBack - iCurrentEvent = [EMbmsContextEventDeactivate]");
|
|
623 |
if(((iState == RPacketContext::EStatusInactive) || (iState == RPacketContext::EStatusDeactivating)) &&
|
|
624 |
(iCurrentEvent==EMbmsContextEventDeactivate))
|
|
625 |
{
|
|
626 |
TInt ret=ChangeState(RPacketContext::EStatusInactive);
|
|
627 |
ReqCompleted(iDeactivateRequestHandle,ret);
|
|
628 |
iCurrentEvent=EMbmsContextEventNone;
|
|
629 |
iIsActive = EFalse;
|
|
630 |
}
|
|
631 |
else
|
|
632 |
{
|
|
633 |
LOGPACKET1("Unexpected iState for iCurrentEvent[EMbmsContextEventActivate]");
|
|
634 |
}
|
|
635 |
break;
|
|
636 |
case EMbmsContextEventDelete:
|
|
637 |
LOGPACKET1("TimerCallBack - iCurrentEvent = [EMbmsContextEventDelete]");
|
|
638 |
if(iState == RPacketContext::EStatusInactive && !iIsActive )
|
|
639 |
{
|
|
640 |
TInt ret = ChangeState(RPacketContext::EStatusDeleted);
|
|
641 |
ReqCompleted(iDeleteRequestHandle,ret);
|
|
642 |
iCurrentEvent=EMbmsContextEventNone;
|
|
643 |
}
|
|
644 |
else
|
|
645 |
{
|
|
646 |
ReqCompleted(iDeleteRequestHandle,KErrCorrupt); // KErrCorrupt is sent to indicate that the
|
|
647 |
//delete request is received when the context is Not inactive.
|
|
648 |
}
|
|
649 |
break;
|
|
650 |
default:
|
|
651 |
{
|
|
652 |
LOGPACKET1("CSimMbmsPacketContext::TimerCallBack");
|
|
653 |
LOGPACKET1("<<Unexpected iCurrentEvent @ TimerCallBack");
|
|
654 |
break;
|
|
655 |
}
|
|
656 |
}
|
|
657 |
}
|
|
658 |
}
|
|
659 |
}
|
|
660 |
|
|
661 |
TName CSimMbmsPacketContext::ContextName() const
|
|
662 |
/**
|
|
663 |
* Returns the context name to the requested client
|
|
664 |
*
|
|
665 |
* @return TName Name of the MBMS context
|
|
666 |
*/
|
|
667 |
{
|
|
668 |
LOGPACKET1("CSimMbmsPacketContext::ContextName called");
|
|
669 |
return iContextName;
|
|
670 |
}
|
|
671 |
|
|
672 |
const CTestConfigSection* CSimMbmsPacketContext::CfgFile()
|
|
673 |
/**
|
|
674 |
* Return a pointer to the Configuration File Section
|
|
675 |
*
|
|
676 |
* @return CTestConfigSection pointer to the configuration file section
|
|
677 |
*/
|
|
678 |
{
|
|
679 |
LOGPACKET1("CSimMbmsPacketContext::CfgFile called");
|
|
680 |
return iPacketService->CfgFile();
|
|
681 |
}
|
|
682 |
|
|
683 |
TInt CSimMbmsPacketContext::SetConfig(const TTsyReqHandle aTsyReqHandle,const TDesC8* aConfig)
|
|
684 |
/**
|
|
685 |
* Sets the MBMS configuration parameters and notifies if
|
|
686 |
* there is a pending notification for the config change.
|
|
687 |
*
|
|
688 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
689 |
* @param aConfig pointer containing the parameters to set to.
|
|
690 |
* @return KErrNone
|
|
691 |
*/
|
|
692 |
{
|
|
693 |
LOGPACKET1("CSimMbmsPacketContext::SetConfig called");
|
|
694 |
|
|
695 |
TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
|
|
696 |
TPacketDataConfigBase& configBaseV1 = (*configBase)();
|
|
697 |
iSetConfigRequestHandle = aTsyReqHandle;
|
|
698 |
TInt err = KErrCorrupt;
|
|
699 |
|
|
700 |
if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigMBMS)
|
|
701 |
{
|
|
702 |
TPckg<RPacketMbmsContext::TContextConfigMbmsV1>* configMBMSPckg = (TPckg<RPacketMbmsContext::TContextConfigMbmsV1>*)aConfig;
|
|
703 |
RPacketMbmsContext::TContextConfigMbmsV1& configMBMS = (*configMBMSPckg)();
|
|
704 |
|
|
705 |
TMbmsConfigParams mbmsConfigParams;
|
|
706 |
|
|
707 |
mbmsConfigParams.iMCC = configMBMS.iTmgi.GetMCC();
|
|
708 |
mbmsConfigParams.iMNC = configMBMS.iTmgi.GetMNC();
|
|
709 |
mbmsConfigParams.iServiceId = configMBMS.iTmgi.GetServiceId() ;
|
|
710 |
mbmsConfigParams.iAccessBearer = configMBMS.iMbmsAccessBearer;
|
|
711 |
mbmsConfigParams.iServiceMode = configMBMS.iMbmsServiceMode;
|
|
712 |
mbmsConfigParams.iServicePriority = configMBMS.iMbmsServicePriority;
|
|
713 |
|
|
714 |
TUint index;
|
|
715 |
for(index=0; index < iMbmsContextConfigParams->Count(); index++)
|
|
716 |
{
|
|
717 |
TMbmsConfigParams thisConfig = iMbmsContextConfigParams->At(index);
|
|
718 |
|
|
719 |
if ((mbmsConfigParams.iAccessBearer != thisConfig.iAccessBearer) ||
|
|
720 |
(mbmsConfigParams.iServiceMode != thisConfig.iServiceMode) ||
|
|
721 |
(mbmsConfigParams.iServicePriority != thisConfig.iServicePriority) ||
|
|
722 |
(mbmsConfigParams.iMCC != thisConfig.iMCC) ||
|
|
723 |
(mbmsConfigParams.iMNC != thisConfig.iMNC) ||
|
|
724 |
(mbmsConfigParams.iServiceId != thisConfig.iServiceId))
|
|
725 |
{
|
|
726 |
err = KErrCorrupt;
|
|
727 |
}
|
|
728 |
else
|
|
729 |
{
|
|
730 |
err = KErrNone;
|
|
731 |
//Check for and complete any pending notifications
|
|
732 |
if(iNotifyConfigMBMS.iNotifyPending)
|
|
733 |
{
|
|
734 |
iNotifyConfigMBMS.iNotifyPending=EFalse;
|
|
735 |
RPacketMbmsContext::TContextConfigMbmsV1 *tempConfig = (RPacketMbmsContext::TContextConfigMbmsV1*)iNotifyConfigMBMS.iNotifyData;
|
|
736 |
tempConfig->iTmgi.SetServiceId(thisConfig.iServiceId);
|
|
737 |
tempConfig->iTmgi.SetMCC(thisConfig.iMCC);
|
|
738 |
tempConfig->iTmgi.SetMNC(thisConfig.iMNC);
|
|
739 |
tempConfig->iMbmsAccessBearer= thisConfig.iAccessBearer;
|
|
740 |
tempConfig->iMbmsServicePriority = thisConfig.iServicePriority;
|
|
741 |
tempConfig->iMbmsServiceMode = thisConfig.iServiceMode;
|
|
742 |
ReqCompleted(iNotifyConfigMBMS.iNotifyHandle,KErrNone);
|
|
743 |
}
|
|
744 |
break;
|
|
745 |
}
|
|
746 |
}
|
|
747 |
iSetConfigValues.iErrorValue = err;
|
|
748 |
iSetConfigValues.iIndex = index;
|
|
749 |
}
|
|
750 |
else
|
|
751 |
{ // not expected to reach here in case of MBMS context
|
|
752 |
TUint index=0;
|
|
753 |
iSetConfigValues.iErrorValue = err;
|
|
754 |
iSetConfigValues.iIndex = index;
|
|
755 |
}
|
|
756 |
iMbmsSetConfigTimer->Start(RandTime(),this,ETimerIdMbmsPcktContextSetConfig);
|
|
757 |
|
|
758 |
return KErrNone;
|
|
759 |
}
|
|
760 |
|
|
761 |
TInt CSimMbmsPacketContext::SetConfigCancel(const TTsyReqHandle aTsyReqHandle)
|
|
762 |
/**
|
|
763 |
* Cancels the Setconfig request.
|
|
764 |
* This method will do nothing in this version of SimTSY.
|
|
765 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
766 |
* @return err KErrNone
|
|
767 |
*/
|
|
768 |
{
|
|
769 |
iMbmsSetConfigTimer->Cancel();
|
|
770 |
ReqCompleted(aTsyReqHandle, KErrCancel);
|
|
771 |
return KErrNone;
|
|
772 |
}
|
|
773 |
|
|
774 |
TInt CSimMbmsPacketContext::GetConfig(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig)
|
|
775 |
/**
|
|
776 |
* Retrieves and returns the MBMS context configuration
|
|
777 |
*
|
|
778 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
779 |
* @param aConfig pointer to the configuration params to retrieve
|
|
780 |
* @return KErrNone
|
|
781 |
*/
|
|
782 |
{
|
|
783 |
LOGPACKET1("CSimMbmsPacketContext::GetConfig called");
|
|
784 |
TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
|
|
785 |
TPacketDataConfigBase& configBaseV1 = (*configBase)();
|
|
786 |
|
|
787 |
if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigMBMS)
|
|
788 |
{
|
|
789 |
|
|
790 |
TPckg<RPacketMbmsContext::TContextConfigMbmsV1>* configMBMSPckg = (TPckg<RPacketMbmsContext::TContextConfigMbmsV1>*)aConfig;
|
|
791 |
RPacketMbmsContext::TContextConfigMbmsV1& configMBMS = (*configMBMSPckg)();
|
|
792 |
|
|
793 |
configMBMS.iTmgi.SetServiceId(iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iServiceId);
|
|
794 |
configMBMS.iTmgi.SetMCC(iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iMCC);
|
|
795 |
configMBMS.iTmgi.SetMNC(iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iMNC);
|
|
796 |
configMBMS.iMbmsAccessBearer = reinterpret_cast<TMbmsScope&>(iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iAccessBearer);
|
|
797 |
configMBMS.iMbmsServicePriority = reinterpret_cast<TMbmsServicePriority&>(iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iServicePriority);
|
|
798 |
configMBMS.iMbmsServiceMode = reinterpret_cast<TMbmsServiceMode&>(iMbmsContextConfigParams->At(iMbmsContextConfigParamsIndex).iServiceMode);
|
|
799 |
|
|
800 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
801 |
}
|
|
802 |
else
|
|
803 |
{
|
|
804 |
ReqCompleted(aTsyReqHandle,KErrNotSupported);
|
|
805 |
}
|
|
806 |
|
|
807 |
return KErrNone;
|
|
808 |
}
|
|
809 |
|
|
810 |
TInt CSimMbmsPacketContext::GetConfigCancel(const TTsyReqHandle /*aTsyReqHandle*/)
|
|
811 |
/**
|
|
812 |
* Cancels the Getconfig request.
|
|
813 |
* This method will do nothing in this version of SimTSY.
|
|
814 |
*
|
|
815 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
816 |
* @return err KErrNone
|
|
817 |
*/
|
|
818 |
{
|
|
819 |
LOGPACKET1("CSimMbmsPacketContext::GetConfigCancel called");
|
|
820 |
return KErrNone;
|
|
821 |
}
|
|
822 |
|
|
823 |
TInt CSimMbmsPacketContext::GetStatus(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus)
|
|
824 |
/**
|
|
825 |
* Retrieves and returns the current status of the MBMS context
|
|
826 |
*
|
|
827 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
828 |
* @param aContextStatus pointer to the status of the mbms packet context.
|
|
829 |
* @return KerrNone
|
|
830 |
*/
|
|
831 |
{
|
|
832 |
LOGPACKET1("CSimMbmsPacketContext::GetStatus called");
|
|
833 |
*aContextStatus = iState;
|
|
834 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
835 |
return KErrNone;
|
|
836 |
}
|
|
837 |
|
|
838 |
TInt CSimMbmsPacketContext::Activate(const TTsyReqHandle aTsyReqHandle)
|
|
839 |
/**
|
|
840 |
* Client calls this method to try to Activate a mbms context.
|
|
841 |
* In this method, we'll store the TsyReqHandle for later completion then call ActionEvent
|
|
842 |
* state machine to handle the event which will kick off a timer.
|
|
843 |
* The Actual Activation will take place in the TimerCallBack method.
|
|
844 |
*
|
|
845 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
846 |
* @return KErrNone
|
|
847 |
*/
|
|
848 |
{
|
|
849 |
iActivateRequestHandle = aTsyReqHandle;
|
|
850 |
TInt ret;
|
|
851 |
ret = ActionEvent(EMbmsContextEventActivate);
|
|
852 |
return ret;
|
|
853 |
}
|
|
854 |
|
|
855 |
TInt CSimMbmsPacketContext::ActivateCancel(const TTsyReqHandle aTsyReqHandle)
|
|
856 |
/**
|
|
857 |
* Client calls this method to try and cancel an Activate request.
|
|
858 |
* This will only complete successfully if and only if the Activate request
|
|
859 |
* has not completed.i.e. if we haven't already activated the context.
|
|
860 |
* Otherwise, the request will be completed with KErrNone
|
|
861 |
*
|
|
862 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
863 |
* @return KErrNone
|
|
864 |
*/
|
|
865 |
{
|
|
866 |
LOGPACKET1("CSimMbmsPacketContext::ActivateCancel called");
|
|
867 |
iMbmsContextTimer->Cancel();
|
|
868 |
if(((iState == RPacketContext::EStatusInactive) || (iState == RPacketContext::EStatusActivating)) &&
|
|
869 |
(iCurrentEvent==EMbmsContextEventActivate))
|
|
870 |
{
|
|
871 |
iCurrentEvent= EMbmsContextEventNone;
|
|
872 |
TInt ret = ChangeState(RPacketContext::EStatusInactive);
|
|
873 |
if(ret!= KErrNone)
|
|
874 |
{
|
|
875 |
ReqCompleted(aTsyReqHandle,ret);
|
|
876 |
}
|
|
877 |
else
|
|
878 |
{
|
|
879 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
880 |
}
|
|
881 |
}
|
|
882 |
else if (iState == RPacketContext::EStatusDeleted)
|
|
883 |
{
|
|
884 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
885 |
}
|
|
886 |
else
|
|
887 |
{
|
|
888 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
889 |
}
|
|
890 |
|
|
891 |
return KErrNone;
|
|
892 |
}
|
|
893 |
|
|
894 |
TInt CSimMbmsPacketContext::Deactivate(const TTsyReqHandle aTsyReqHandle)
|
|
895 |
/**
|
|
896 |
* Client calls this method to try to Deactivate an active context.
|
|
897 |
* In this method, we'll store the TsyReqHandle for later completion then call ActionEvent
|
|
898 |
* state machine to handle the event which will kick off a timer.
|
|
899 |
* The Actual Deactivation will take place in the TimerCallBack method.
|
|
900 |
*
|
|
901 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
902 |
* @return KErrNone
|
|
903 |
*/
|
|
904 |
{
|
|
905 |
LOGPACKET1("CSimMbmsPacketContext::Deactivate called");
|
|
906 |
iDeactivateRequestHandle = aTsyReqHandle;
|
|
907 |
TInt ret = ActionEvent(EMbmsContextEventDeactivate);
|
|
908 |
return ret;
|
|
909 |
}
|
|
910 |
|
|
911 |
TInt CSimMbmsPacketContext::DeactivateCancel(const TTsyReqHandle aTsyReqHandle)
|
|
912 |
/**
|
|
913 |
* Client calls this method to try and cancel a Deactivate request.
|
|
914 |
* This will only complete successfully if and only if the Deactivate request has not completed.
|
|
915 |
* i.e. if we haven't already deactivated the context.
|
|
916 |
* Otherwise, the request will be completed with KErrNone.
|
|
917 |
*
|
|
918 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
919 |
* @return KErrNone
|
|
920 |
*/
|
|
921 |
{
|
|
922 |
LOGPACKET1("CSimMbmsPacketContext::DeactivateCancel called");
|
|
923 |
iMbmsContextTimer->Cancel();
|
|
924 |
if(((iState == RPacketContext::EStatusInactive) || (iState == RPacketContext::EStatusDeactivating)) &&
|
|
925 |
(iCurrentEvent==EMbmsContextEventDeactivate))
|
|
926 |
{
|
|
927 |
iCurrentEvent= EMbmsContextEventNone;
|
|
928 |
TInt ret = ChangeState(RPacketContext::EStatusActive);
|
|
929 |
if(ret!= KErrNone)
|
|
930 |
{
|
|
931 |
ReqCompleted(aTsyReqHandle,ret);
|
|
932 |
}
|
|
933 |
else
|
|
934 |
{
|
|
935 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
936 |
}
|
|
937 |
}
|
|
938 |
else
|
|
939 |
{
|
|
940 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
941 |
}
|
|
942 |
|
|
943 |
return KErrNone;
|
|
944 |
}
|
|
945 |
|
|
946 |
TInt CSimMbmsPacketContext::ReActivate(CSimPacketService* aPacketService, const TName& aContextName)
|
|
947 |
/**
|
|
948 |
* This method is called by the packet Service to Re-Initialise a Deleted context.
|
|
949 |
* If the context is deleted then the client cannot retrieve any
|
|
950 |
* infomation or use the context in any way.
|
|
951 |
* In order for the client to use the context again, the client must
|
|
952 |
* open an object by name passing the name of this context as a pararemter.
|
|
953 |
*
|
|
954 |
* @param aPacketService pointer to the parent class CSimPacketService.
|
|
955 |
* @param aContextName Must be the same name as the name for this context.
|
|
956 |
* @return KErrNone if no problem in re-initialising this context.
|
|
957 |
*/
|
|
958 |
{
|
|
959 |
if(iContextName.Compare(aContextName) != KErrNone)
|
|
960 |
{
|
|
961 |
return KErrBadName;
|
|
962 |
}
|
|
963 |
|
|
964 |
iPacketService = aPacketService;
|
|
965 |
|
|
966 |
if(iDeleted)
|
|
967 |
{
|
|
968 |
TInt ret = ChangeState(RPacketContext::EStatusInactive);
|
|
969 |
if (ret != KErrNone)
|
|
970 |
{
|
|
971 |
return ret;
|
|
972 |
}
|
|
973 |
|
|
974 |
iDeleted = EFalse;
|
|
975 |
iMbmsContextConfigParamsIndex = 0;
|
|
976 |
iNotifyStatusChange.iNotifyPending = EFalse;
|
|
977 |
iNotifyConfigMBMS.iNotifyPending = EFalse;
|
|
978 |
}
|
|
979 |
return KErrNone;
|
|
980 |
}
|
|
981 |
|
|
982 |
TInt CSimMbmsPacketContext::Delete(const TTsyReqHandle aTsyReqHandle)
|
|
983 |
/**
|
|
984 |
* Client calls this method to try to Delete this context.
|
|
985 |
* In this method, we'll store the TsyReqHandle for later completion then call ActionEvent
|
|
986 |
* state machine to handle the event which will kick off a timer.
|
|
987 |
* The Actual Delete will take place in the TimerCallBack method.
|
|
988 |
*
|
|
989 |
* This request will only succeed if the context already exist (had been created) and also not
|
|
990 |
* previously deleted.
|
|
991 |
*
|
|
992 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
993 |
* @return KErrNone
|
|
994 |
*/
|
|
995 |
{
|
|
996 |
LOGPACKET1("CSimMbmsPacketContext::Delete called");
|
|
997 |
iDeleteRequestHandle = aTsyReqHandle;
|
|
998 |
TInt ret = ActionEvent(EMbmsContextEventDelete);
|
|
999 |
return ret;
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
TInt CSimMbmsPacketContext::DeleteCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1003 |
/**
|
|
1004 |
* Client calls this method to try and cancel a Delete context request.
|
|
1005 |
* This will only complete successfully if and only if the Delete request has not completed.
|
|
1006 |
* i.e. if we haven't already Deleted the context.
|
|
1007 |
*
|
|
1008 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
1009 |
* @return KErrNone
|
|
1010 |
*/
|
|
1011 |
{
|
|
1012 |
LOGPACKET1("CSimMbmsPacketContext::DeleteCancel called");
|
|
1013 |
iMbmsContextTimer->Cancel();
|
|
1014 |
if((iState == RPacketContext::EStatusInactive) && (iCurrentEvent==EMbmsContextEventDelete))
|
|
1015 |
{
|
|
1016 |
iCurrentEvent= EMbmsContextEventNone;
|
|
1017 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1018 |
}
|
|
1019 |
return KErrNone;
|
|
1020 |
}
|
|
1021 |
|
|
1022 |
TInt CSimMbmsPacketContext::GetLastErrorCause(const TTsyReqHandle aTsyReqHandle,TInt* /*aError*/)
|
|
1023 |
/**
|
|
1024 |
* This method is supported in only for the MBMS Packet Context
|
|
1025 |
*
|
|
1026 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1027 |
* @param aError pointer to the last error cause
|
|
1028 |
* @return KerrNone
|
|
1029 |
*/
|
|
1030 |
{
|
|
1031 |
LOGPACKET1("CSimMbmsPacketContext::GetLastErrorCause called");
|
|
1032 |
|
|
1033 |
ReqCompleted(aTsyReqHandle,iLastError);
|
|
1034 |
return KErrNone;
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
|
|
1038 |
TInt CSimMbmsPacketContext::NotifyConfigChanged(const TTsyReqHandle aTsyReqHandle, TDes8* aConfig)
|
|
1039 |
/**
|
|
1040 |
* Records a client interest in being notified of a change in the Context Configuration.
|
|
1041 |
*
|
|
1042 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1043 |
* @param aConfig pointer to the context config to store the config info when the config changes.
|
|
1044 |
* @return KErrNone
|
|
1045 |
*/
|
|
1046 |
{
|
|
1047 |
LOGPACKET1("CSimMbmsPacketContext::NotifyConfigChanged called");
|
|
1048 |
TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig;
|
|
1049 |
TPacketDataConfigBase& configBaseV1 = (*configBase)();
|
|
1050 |
|
|
1051 |
if(configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigMBMS)
|
|
1052 |
{
|
|
1053 |
__ASSERT_ALWAYS(!iNotifyConfigMBMS.iNotifyPending,SimPanic(ENotificationAlreadyPending));
|
|
1054 |
|
|
1055 |
iNotifyConfigMBMS.iNotifyPending = ETrue;
|
|
1056 |
iNotifyConfigMBMS.iNotifyHandle = aTsyReqHandle;
|
|
1057 |
iNotifyConfigMBMS.iNotifyData = &configBaseV1;
|
|
1058 |
}
|
|
1059 |
else
|
|
1060 |
{
|
|
1061 |
LOGPACKET1("CSimMbmsPacketContext::NotifyConfigChanged Unexpected config for MBMS context");
|
|
1062 |
}
|
|
1063 |
|
|
1064 |
return KErrNone;
|
|
1065 |
}
|
|
1066 |
|
|
1067 |
TInt CSimMbmsPacketContext::NotifyConfigChangedCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1068 |
/**
|
|
1069 |
* Cancel a client's interest in being notified when the context configuration changes
|
|
1070 |
* This is acheived simply by resetting the flag that indicates a notification is pending.
|
|
1071 |
*
|
|
1072 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
1073 |
* @return KErrNone
|
|
1074 |
*/
|
|
1075 |
{
|
|
1076 |
LOGPACKET1("CSimMbmsPacketContext::NotifyConfigChangedCancel called");
|
|
1077 |
if(iNotifyConfigMBMS.iNotifyPending &&
|
|
1078 |
iNotifyConfigMBMS.iNotifyHandle == aTsyReqHandle)
|
|
1079 |
{
|
|
1080 |
iNotifyConfigMBMS.iNotifyPending=EFalse;
|
|
1081 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1082 |
}
|
|
1083 |
else
|
|
1084 |
{
|
|
1085 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1086 |
}
|
|
1087 |
|
|
1088 |
return KErrNone;
|
|
1089 |
}
|
|
1090 |
|
|
1091 |
TInt CSimMbmsPacketContext::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus)
|
|
1092 |
/**
|
|
1093 |
* Record a client's interest in being notified of the state of the packet contexts.
|
|
1094 |
* First check that there isn't already a notification pending (the ETel Server should protect
|
|
1095 |
* against this) and then record the information necessary to complete the request later, when
|
|
1096 |
* the status does actually change.
|
|
1097 |
*
|
|
1098 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1099 |
* @param aContextStatus pointer to the packet context status
|
|
1100 |
* @return KErrNone
|
|
1101 |
*/
|
|
1102 |
{
|
|
1103 |
LOGPACKET1("CSimMbmsPacketContext::NotifyStatusChange called");
|
|
1104 |
__ASSERT_ALWAYS(!iNotifyStatusChange.iNotifyPending,SimPanic(ENotificationAlreadyPending));
|
|
1105 |
iNotifyStatusChange.iNotifyPending = ETrue;
|
|
1106 |
iNotifyStatusChange.iNotifyHandle = aTsyReqHandle;
|
|
1107 |
iNotifyStatusChange.iNotifyData = aContextStatus;
|
|
1108 |
return KErrNone;
|
|
1109 |
}
|
|
1110 |
|
|
1111 |
TInt CSimMbmsPacketContext::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1112 |
/**
|
|
1113 |
* Cancel a client's interest in being notified when the packet context status changes.
|
|
1114 |
* This is acheived simply by resetting the flag that indicates a notification is pending.
|
|
1115 |
*
|
|
1116 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
1117 |
* @return KErrNone
|
|
1118 |
*/
|
|
1119 |
{
|
|
1120 |
LOGPACKET1("CSimMbmsPacketContext::NotifyStatusChangeCancel called");
|
|
1121 |
if(iNotifyStatusChange.iNotifyPending)
|
|
1122 |
{
|
|
1123 |
iNotifyStatusChange.iNotifyPending=EFalse;
|
|
1124 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1125 |
}
|
|
1126 |
else
|
|
1127 |
{
|
|
1128 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1129 |
}
|
|
1130 |
return KErrNone;
|
|
1131 |
}
|
|
1132 |
|
|
1133 |
TInt CSimMbmsPacketContext::UpdateMbmsSessionList(const TTsyReqHandle aTsyReqHandle,TMbmsAction* aAction, TUint* aSessionId)
|
|
1134 |
/**
|
|
1135 |
* client's interest in updating the MBMS session's list.
|
|
1136 |
* This is achieved by updating the list maintained internally by the context
|
|
1137 |
*
|
|
1138 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1139 |
* @param aAction TMbmsAction - ADD/ REMOVE / REMOVE_ALL
|
|
1140 |
* @param aSessionId sessoinID to be used for the updation.
|
|
1141 |
* @return KErrNone
|
|
1142 |
*/
|
|
1143 |
{
|
|
1144 |
LOGPACKET1("CSimMbmsPacketContext::UpdateMbmsSessionList called");
|
|
1145 |
|
|
1146 |
TInt error=KErrNone;
|
|
1147 |
iUpdateSessionHandle = aTsyReqHandle;
|
|
1148 |
TKeyArrayFix key(0, ECmpTUint);
|
|
1149 |
TInt position =-1;
|
|
1150 |
|
|
1151 |
switch(*aAction)
|
|
1152 |
{
|
|
1153 |
case SIMTSY_PACKET_MBMS_ADD_ENTRIES:
|
|
1154 |
LOGPACKET1("CSimMbmsPacketContext::UpdateMbmsSessionList Action: ADD ");
|
|
1155 |
|
|
1156 |
// TRAP can contain multiple statments
|
|
1157 |
TRAP(error,iSessionIdList->AppendL(*aSessionId);
|
|
1158 |
//iSessionIdList->At(0) = ++iNumOfSessionId;
|
|
1159 |
iSessionIdList->Delete(0);
|
|
1160 |
iSessionIdList->InsertL(0,++iNumOfSessionId));
|
|
1161 |
|
|
1162 |
iMbmsUpdateSessionTimer->Start(RandTime(),this,ETimerIdMbmsUpdateSessionId);
|
|
1163 |
|
|
1164 |
if(error != KErrNone)
|
|
1165 |
{
|
|
1166 |
ReqCompleted(iUpdateSessionHandle,error);
|
|
1167 |
}
|
|
1168 |
break;
|
|
1169 |
|
|
1170 |
case SIMTSY_PACKET_MBMS_REM_ENTRIES:
|
|
1171 |
LOGPACKET1("CSimMbmsPacketContext::UpdateMbmsSessionList Action: REMOVE ");
|
|
1172 |
iSessionIdList->Find(*aSessionId,key,position);
|
|
1173 |
if(position != -1)
|
|
1174 |
{
|
|
1175 |
iSessionIdList->Delete(position);
|
|
1176 |
//iSessionIdList->At(0) = --iNumOfSessionId;
|
|
1177 |
TRAP(error, iSessionIdList->InsertL(0,--iNumOfSessionId));
|
|
1178 |
if(error != KErrNone)
|
|
1179 |
{
|
|
1180 |
ReqCompleted(iUpdateSessionHandle,error);
|
|
1181 |
}
|
|
1182 |
iMbmsUpdateSessionTimer->Start(RandTime(),this,ETimerIdMbmsUpdateSessionId);
|
|
1183 |
}
|
|
1184 |
else
|
|
1185 |
{
|
|
1186 |
error = KErrNotFound;
|
|
1187 |
ReqCompleted(iUpdateSessionHandle,error);
|
|
1188 |
}
|
|
1189 |
break;
|
|
1190 |
|
|
1191 |
case SIMTSY_PACKET_MBMS_REM_ALL_ENTRIES:
|
|
1192 |
LOGPACKET1("CSimMbmsPacketContext::UpdateMbmsSessionList Action: REMOVE_ALL ");
|
|
1193 |
iNumOfSessionId=0;
|
|
1194 |
//iSessionIdList->At(0) = iNumOfSessionId;
|
|
1195 |
TRAP(error, iSessionIdList->InsertL(0,iNumOfSessionId));
|
|
1196 |
if(error != KErrNone)
|
|
1197 |
{
|
|
1198 |
ReqCompleted(iUpdateSessionHandle,error);
|
|
1199 |
}
|
|
1200 |
iSessionIdList->Delete(1,iSessionIdList->Count()); // removing all session ids from the list
|
|
1201 |
ReqCompleted(aTsyReqHandle, KErrNone);
|
|
1202 |
break;
|
|
1203 |
|
|
1204 |
default:
|
|
1205 |
LOGPACKET1("CSimMbmsPacketContext::UpdateMbmsSessionList Action: Default ");
|
|
1206 |
ReqCompleted(aTsyReqHandle,KErrNotFound);
|
|
1207 |
break;
|
|
1208 |
}
|
|
1209 |
return KErrNone;
|
|
1210 |
}
|
|
1211 |
|
|
1212 |
TInt CSimMbmsPacketContext::UpdateMbmsSessionListCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1213 |
/**
|
|
1214 |
* client's interest in cancelling the updation the MBMS session's list.
|
|
1215 |
*
|
|
1216 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
1217 |
* @return KErrNone
|
|
1218 |
*/
|
|
1219 |
{
|
|
1220 |
LOGPACKET1("CSimMbmsPacketContext::UpdateMbmsSessionListCancel called");
|
|
1221 |
iMbmsUpdateSessionTimer->Cancel();
|
|
1222 |
if( iUpdateSessionHandle == aTsyReqHandle )
|
|
1223 |
{
|
|
1224 |
ReqCompleted(iUpdateSessionHandle,KErrCancel);
|
|
1225 |
iUpdateSessionHandle=NULL;
|
|
1226 |
}
|
|
1227 |
else
|
|
1228 |
{
|
|
1229 |
ReqCompleted(iUpdateSessionHandle,KErrNone);
|
|
1230 |
}
|
|
1231 |
return KErrNone;
|
|
1232 |
}
|
|
1233 |
|
|
1234 |
TInt CSimMbmsPacketContext::InitialiseContext(const TTsyReqHandle aTsyReqHandle, TDes8* aDataChannelV2Pckg)
|
|
1235 |
/**
|
|
1236 |
* client's interest in Initialising the context.
|
|
1237 |
*
|
|
1238 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1239 |
* @param aDataChannelV2Pckg the information to be filled once the initialisation is complete.
|
|
1240 |
* @return KErrNone
|
|
1241 |
*/
|
|
1242 |
{
|
|
1243 |
TCommSetupItem item = FindCommSettings();
|
|
1244 |
iInitContextData.iTsyReqHandle = aTsyReqHandle;
|
|
1245 |
iInitContextData.iChannel = aDataChannelV2Pckg;
|
|
1246 |
iMbmsContextInitTimer->Start(RandTime(), this, ETimerIdPcktContextInitContext);
|
|
1247 |
|
|
1248 |
return KErrNone;
|
|
1249 |
}
|
|
1250 |
|
|
1251 |
TInt CSimMbmsPacketContext::DoInitialiseContext()
|
|
1252 |
/* Function completes the request from the client for the initialisation of the context.
|
|
1253 |
* Called when the timer event occurs after receiving the InitialiseContext request.
|
|
1254 |
* returns KErrNone.
|
|
1255 |
*/
|
|
1256 |
{
|
|
1257 |
RPacketContext::TDataChannelV2Pckg* channel = (RPacketContext::TDataChannelV2Pckg*)iInitContextData.iChannel;
|
|
1258 |
RPacketContext::TDataChannelV2& channelV2 = (*channel)();
|
|
1259 |
|
|
1260 |
// Check that the data structure is supported by the simulated TSY version
|
|
1261 |
TInt err = iPhone->CheckSimTsyVersion(channelV2);
|
|
1262 |
if(err != KErrNone)
|
|
1263 |
{
|
|
1264 |
ReqCompleted(iInitContextData.iTsyReqHandle, err);
|
|
1265 |
return KErrNone;
|
|
1266 |
}
|
|
1267 |
|
|
1268 |
TCommSetupItem item = FindCommSettings();
|
|
1269 |
channelV2.iPort = item.iPortName;
|
|
1270 |
channelV2.iCsy = item.iCsyName;
|
|
1271 |
channelV2.iChannelId = item.iPortName;
|
|
1272 |
|
|
1273 |
ReqCompleted(iInitContextData.iTsyReqHandle, KErrNone);
|
|
1274 |
|
|
1275 |
return KErrNone;
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
TInt CSimMbmsPacketContext::InitialiseContextCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1279 |
/**
|
|
1280 |
* client's interest in cancelling the Initialisation of the MBMS Context.
|
|
1281 |
*
|
|
1282 |
* @param aTsyReqHandle Tsy Request handle for the client cancel request
|
|
1283 |
* @return KErrNone
|
|
1284 |
*/
|
|
1285 |
{
|
|
1286 |
iMbmsContextInitTimer->Cancel();
|
|
1287 |
ReqCompleted(aTsyReqHandle, KErrCancel);
|
|
1288 |
|
|
1289 |
return KErrNone;
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
TInt CSimMbmsPacketContext::GetMbmsSessionsPhase1(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TInt* aBufSize)
|
|
1293 |
/**
|
|
1294 |
* client's interest in retrieving the MBMS Session information.
|
|
1295 |
* This is the phase1 retrieval
|
|
1296 |
*
|
|
1297 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1298 |
* @param aClient ClientId from which the request is sent
|
|
1299 |
* @param aBufSize Size of the buffer to be allocated to retrieve the data in phase2.
|
|
1300 |
* @return KErrNone
|
|
1301 |
*/
|
|
1302 |
{
|
|
1303 |
LOGPACKET1("CSimMbmsPacketContext::GetMbmsSessionsPhase1 called");
|
|
1304 |
iGetMbmsSessionHandle = aTsyReqHandle;
|
|
1305 |
TInt ret=KErrNone;
|
|
1306 |
TInt leaveCode=KErrNone;
|
|
1307 |
TRAP(leaveCode, ret=ProcessGetMbmsSessionsPhase1L(aTsyReqHandle, aClient, aBufSize););
|
|
1308 |
if (leaveCode != KErrNone)
|
|
1309 |
{
|
|
1310 |
ReqCompleted(aTsyReqHandle,leaveCode);
|
|
1311 |
}
|
|
1312 |
return ret;
|
|
1313 |
}
|
|
1314 |
|
|
1315 |
TInt CSimMbmsPacketContext::ProcessGetMbmsSessionsPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
1316 |
TClientId* aClient,
|
|
1317 |
TInt* aBufSize)
|
|
1318 |
/**
|
|
1319 |
* The Actual function which does the phase1 retrieval.
|
|
1320 |
*
|
|
1321 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1322 |
* @param aClient ClientId from which the request is sent
|
|
1323 |
* @param aBufSize Size of the buffer to be allocated to retrieve the data in phase2.
|
|
1324 |
* @return KErrNone
|
|
1325 |
*/
|
|
1326 |
{
|
|
1327 |
// Retrieve MBMS session list,
|
|
1328 |
// Store the sessions and then return the size of the buffer to the client
|
|
1329 |
LOGPACKET1("CSimMbmsPacketContext::ProcessGetMbmsSessionsPhase1L called");
|
|
1330 |
RPacketMbmsContext::CMbmsSession* mbmsSession=RPacketMbmsContext::CMbmsSession::NewL();
|
|
1331 |
CleanupStack::PushL(mbmsSession);
|
|
1332 |
|
|
1333 |
for(TInt i=1;i<=iNumOfSessionId;i++)
|
|
1334 |
{
|
|
1335 |
mbmsSession->iSessionIdList.Append(iSessionIdList->At(i));
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
|
|
1339 |
// Store the streamed list and the client ID
|
|
1340 |
CPcktListReadAllAttempt* read = CPcktListReadAllAttempt::NewL(*aClient,aTsyReqHandle);
|
|
1341 |
CleanupStack::PushL(read);
|
|
1342 |
|
|
1343 |
HBufC8* iBuff=NULL;
|
|
1344 |
mbmsSession->ExternalizeL(iBuff);
|
|
1345 |
CleanupStack::PushL(iBuff);
|
|
1346 |
|
|
1347 |
CBufFlat* buf=CBufFlat::NewL(iBuff->Length());
|
|
1348 |
CleanupStack::PushL(buf);
|
|
1349 |
buf->InsertL(0,*iBuff);
|
|
1350 |
|
|
1351 |
read->iListBuf = buf;
|
|
1352 |
CleanupStack::Pop(buf);
|
|
1353 |
CleanupStack::PopAndDestroy(iBuff);
|
|
1354 |
|
|
1355 |
iMbmsSessionList->AppendL(read);
|
|
1356 |
CleanupStack::Pop(); // pop the CListReadAllAttempt
|
|
1357 |
|
|
1358 |
// return the CBufBase’s size to client
|
|
1359 |
*aBufSize=(read->iListBuf)->Size();
|
|
1360 |
CleanupStack::PopAndDestroy(mbmsSession);
|
|
1361 |
|
|
1362 |
// Complete first phase of list retrieval
|
|
1363 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1364 |
return KErrNone;
|
|
1365 |
}
|
|
1366 |
|
|
1367 |
TInt CSimMbmsPacketContext::GetMbmsSessionsPhase2(const TTsyReqHandle aTsyReqHandle,TClientId* aClient, TDes8* aBuf)
|
|
1368 |
/**
|
|
1369 |
* client's interest in retrieving the MBMS Session information.
|
|
1370 |
* This is the phase2 retrieval
|
|
1371 |
*
|
|
1372 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1373 |
* @param aClient ClientId from which the request is sent
|
|
1374 |
* @param aBuf Buffer allocated to retrieve the data.
|
|
1375 |
* @return KErrNone
|
|
1376 |
*/
|
|
1377 |
{
|
|
1378 |
LOGPACKET1("CSimMbmsPacketContext::GetMbmsSessionsPhase2 called");
|
|
1379 |
CPcktListReadAllAttempt* read=NULL;
|
|
1380 |
// Find the get Mbms monitored services from this client
|
|
1381 |
for (TInt i=0; i<iMbmsSessionList->Count(); ++i)
|
|
1382 |
{
|
|
1383 |
read = iMbmsSessionList->At(i);
|
|
1384 |
if ((read->iClient.iSessionHandle==aClient->iSessionHandle) &&
|
|
1385 |
(read->iClient.iSubSessionHandle==aClient->iSubSessionHandle))
|
|
1386 |
{
|
|
1387 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
1388 |
// Copy the streamed list to the client
|
|
1389 |
aBuf->Copy(bufPtr);
|
|
1390 |
delete read;
|
|
1391 |
iMbmsSessionList->Delete(i);
|
|
1392 |
ReqCompleted(aTsyReqHandle,KErrNone);
|
|
1393 |
return KErrNone;
|
|
1394 |
}
|
|
1395 |
}
|
|
1396 |
// Should handle error case of not finding the matching client from read all phase 1
|
|
1397 |
ReqCompleted(aTsyReqHandle,KErrBadHandle);
|
|
1398 |
return KErrNone;
|
|
1399 |
}
|
|
1400 |
|
|
1401 |
TInt CSimMbmsPacketContext::GetMbmsSessionsCancel(const TTsyReqHandle aTsyReqHandle)
|
|
1402 |
/**
|
|
1403 |
* client's interest in cancelling the MBMS Get session request.
|
|
1404 |
*
|
|
1405 |
* @param aTsyReqHandle Tsy Request handle for the client request
|
|
1406 |
* @return KErrNone
|
|
1407 |
*/
|
|
1408 |
{
|
|
1409 |
LOGPACKET1("CSimMbmsPacketContext::GetMbmsSessionsCancel called");
|
|
1410 |
// Remove the MBMS sessions from iMbmsSessionList
|
|
1411 |
|
|
1412 |
CPcktListReadAllAttempt* read=NULL;
|
|
1413 |
for (TInt i=0; i<iMbmsSessionList->Count(); ++i)
|
|
1414 |
{
|
|
1415 |
read = iMbmsSessionList->At(i);
|
|
1416 |
if (read->iReqHandle == aTsyReqHandle)
|
|
1417 |
{
|
|
1418 |
delete read;
|
|
1419 |
iMbmsSessionList->Delete(i);
|
|
1420 |
break;
|
|
1421 |
}
|
|
1422 |
}
|
|
1423 |
ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
1424 |
return KErrNone;
|
|
1425 |
}
|
|
1426 |
|
|
1427 |
TInt CSimMbmsPacketContext::ChangeState(RPacketContext::TContextStatus aNewState)
|
|
1428 |
/**
|
|
1429 |
* Attempt to change state.
|
|
1430 |
* First validate that the requested state change is ok. If it is then proceed to change
|
|
1431 |
* the state and complete any pending state change notification.
|
|
1432 |
*
|
|
1433 |
* @param aNewState the new state to change to
|
|
1434 |
* @return Error indication if change of state is successful or not
|
|
1435 |
*/
|
|
1436 |
{
|
|
1437 |
LOGPACKET2("CSimMbmsPacketContext::ChangeState [newState=%d]", aNewState);
|
|
1438 |
__ASSERT_ALWAYS(aNewState!=RPacketContext::EStatusUnknown,SimPanic(ECallStatusUnknownIllegal));
|
|
1439 |
|
|
1440 |
if(iState==aNewState)
|
|
1441 |
return KErrNone;
|
|
1442 |
|
|
1443 |
TInt ret=KErrGeneral;
|
|
1444 |
const struct TMbmsContextStateChangeValidity* stateChangePnt=KMbmsContextStateChangeValidity;
|
|
1445 |
while(stateChangePnt->iOldState!=KMbmsContextStateTableTerminator)
|
|
1446 |
{
|
|
1447 |
if(stateChangePnt->iOldState == RPacketContext::EStatusReceiving && stateChangePnt->iNewState == RPacketContext::EStatusActive)
|
|
1448 |
{
|
|
1449 |
iLastError = KErrMbmsNotSupported;
|
|
1450 |
}
|
|
1451 |
else if(stateChangePnt->iOldState == RPacketContext::EStatusReceiving && stateChangePnt->iNewState == RPacketContext::EStatusSuspended)
|
|
1452 |
{
|
|
1453 |
iLastError = KErrMbmsServicePreempted;
|
|
1454 |
}
|
|
1455 |
else if(stateChangePnt->iOldState == RPacketContext::EStatusSuspended && stateChangePnt->iNewState == RPacketContext::EStatusActive)
|
|
1456 |
{
|
|
1457 |
iLastError = KErrMbmsServiceUnavailable;
|
|
1458 |
}
|
|
1459 |
if((stateChangePnt->iOldState==iState) && (stateChangePnt->iNewState==aNewState))
|
|
1460 |
{
|
|
1461 |
ret=stateChangePnt->iError;
|
|
1462 |
break;
|
|
1463 |
}
|
|
1464 |
stateChangePnt++;
|
|
1465 |
}
|
|
1466 |
|
|
1467 |
if(ret!=KErrNone)
|
|
1468 |
return ret;
|
|
1469 |
|
|
1470 |
//Request permission from the phone to change the state of the packet connection
|
|
1471 |
ret = iPacketService->ChangeState(ConvertToPacketServiceStatus(aNewState));
|
|
1472 |
if(ret!=KErrNone)
|
|
1473 |
return ret;
|
|
1474 |
|
|
1475 |
// Actually change the state.
|
|
1476 |
iState=aNewState;
|
|
1477 |
|
|
1478 |
// Check for a pending line state notification.
|
|
1479 |
if(iNotifyStatusChange.iNotifyPending)
|
|
1480 |
{
|
|
1481 |
iNotifyStatusChange.iNotifyPending = EFalse;
|
|
1482 |
*(RPacketContext::TContextStatus*)iNotifyStatusChange.iNotifyData = iState;
|
|
1483 |
ReqCompleted(iNotifyStatusChange.iNotifyHandle,KErrNone);
|
|
1484 |
}
|
|
1485 |
|
|
1486 |
LOGPACKET1("<<CSimMbmsPacketContext::ChangeState Completed");
|
|
1487 |
return KErrNone;
|
|
1488 |
}
|
|
1489 |
|
|
1490 |
TInt CSimMbmsPacketContext::ActionEvent(TMbmsContextEvent aEvent)
|
|
1491 |
/**
|
|
1492 |
* Entry point when an event has occured that may advance the state machine.
|
|
1493 |
* The aEvent parameter describes the event.
|
|
1494 |
*
|
|
1495 |
* This function contains the main state machine for the packet Context.
|
|
1496 |
*
|
|
1497 |
* @param aEvent The Packet Context event to handle
|
|
1498 |
* @return value represents the error state caused by the attempted state machine jump.
|
|
1499 |
*/
|
|
1500 |
{
|
|
1501 |
LOGPACKET1("<<CSimMbmsPacketContext::ActionEvent Completed");
|
|
1502 |
TInt ret=KErrNone;
|
|
1503 |
__ASSERT_ALWAYS(iState!=RPacketContext::EStatusUnknown,SimPanic(ECallStatusUnknownIllegal));
|
|
1504 |
|
|
1505 |
switch(aEvent)
|
|
1506 |
{
|
|
1507 |
case EMbmsContextEventActivate:
|
|
1508 |
LOGPACKET1("CSimMbmsPacketContext::ActionEvent = [EMbmsContextEventActivate]");
|
|
1509 |
if(iState==RPacketContext::EStatusInactive)
|
|
1510 |
{
|
|
1511 |
iCurrentEvent=EMbmsContextEventActivate;
|
|
1512 |
ret = ChangeState(RPacketContext::EStatusActivating);
|
|
1513 |
iMbmsContextTimer->Start(RandTime(),this);
|
|
1514 |
}
|
|
1515 |
else
|
|
1516 |
{
|
|
1517 |
ReqCompleted(iActivateRequestHandle, KErrGprsActivationRejected);
|
|
1518 |
}
|
|
1519 |
break;
|
|
1520 |
|
|
1521 |
case EMbmsContextEventDeactivate:
|
|
1522 |
LOGPACKET1("CSimMbmsPacketContext::ActionEvent = [EMbmsContextEventDeactivate]");
|
|
1523 |
if(iState==RPacketContext::EStatusActive || iState==RPacketContext::EStatusActivating)
|
|
1524 |
{
|
|
1525 |
iCurrentEvent=EMbmsContextEventDeactivate;
|
|
1526 |
ret = ChangeState(RPacketContext::EStatusDeactivating);
|
|
1527 |
iMbmsContextTimer->Start(RandTime(),this);
|
|
1528 |
}
|
|
1529 |
else
|
|
1530 |
{
|
|
1531 |
ReqCompleted(iDeactivateRequestHandle, KErrNone);
|
|
1532 |
}
|
|
1533 |
break;
|
|
1534 |
|
|
1535 |
case EMbmsContextEventDelete:
|
|
1536 |
LOGPACKET1("CSimMbmsPacketContext::ActionEvent = [EMbmsContextEventDelete]");
|
|
1537 |
iDeleted = ETrue;
|
|
1538 |
if(iState==RPacketContext::EStatusInactive)
|
|
1539 |
{
|
|
1540 |
iCurrentEvent=EMbmsContextEventDelete;
|
|
1541 |
iMbmsContextTimer->Start(RandTime(),this);
|
|
1542 |
}
|
|
1543 |
else
|
|
1544 |
ReqCompleted(iDeleteRequestHandle, KErrInUse);
|
|
1545 |
break;
|
|
1546 |
default:
|
|
1547 |
LOGPACKET1("CSimMbmsPacketContext::ActionEvent = [Default Case]");
|
|
1548 |
break;
|
|
1549 |
}
|
|
1550 |
return ret;
|
|
1551 |
}
|
|
1552 |
|
|
1553 |
RPacketService::TStatus CSimMbmsPacketContext::ConvertToPacketServiceStatus(RPacketContext::TContextStatus aNewState)
|
|
1554 |
/**
|
|
1555 |
* Converts Packet Context Status (RPacketContext::TContextStatus) to
|
|
1556 |
* Packet Service Status (RPacketService::TStatus)
|
|
1557 |
*
|
|
1558 |
* @param aNewState the Context status to convert to packet service status
|
|
1559 |
* @return RPacketService::TStatus The packet service status conversion
|
|
1560 |
*/
|
|
1561 |
{
|
|
1562 |
LOGPACKET1("CSimMbmsPacketContext::ConvertToPacketServiceStatus called");
|
|
1563 |
RPacketService::TStatus serviceStatus;
|
|
1564 |
switch (aNewState)
|
|
1565 |
{
|
|
1566 |
case RPacketContext::EStatusInactive:
|
|
1567 |
case RPacketContext::EStatusActivating:
|
|
1568 |
case RPacketContext::EStatusDeleted:
|
|
1569 |
serviceStatus = RPacketService::EStatusAttached;
|
|
1570 |
break;
|
|
1571 |
case RPacketContext::EStatusActive:
|
|
1572 |
case RPacketContext::EStatusDeactivating:
|
|
1573 |
serviceStatus = RPacketService::EStatusActive;
|
|
1574 |
break;
|
|
1575 |
case RPacketContext::EStatusSuspended:
|
|
1576 |
serviceStatus = RPacketService::EStatusSuspended;
|
|
1577 |
break;
|
|
1578 |
default:
|
|
1579 |
serviceStatus = RPacketService::EStatusUnattached;
|
|
1580 |
break;
|
|
1581 |
}
|
|
1582 |
return serviceStatus;
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
TInt CSimMbmsPacketContext::RandTime()
|
|
1586 |
/*
|
|
1587 |
* Function that generates time(in seconds) at random for the SimTSY
|
|
1588 |
* Maximum of four seconds; zero seconds also included just to simulate the
|
|
1589 |
* synchronous call scenario
|
|
1590 |
*/
|
|
1591 |
{
|
|
1592 |
LOGPACKET1("CSimMbmsPacketContext::RandTime called");
|
|
1593 |
TInt ranT= Math::Random()%4;
|
|
1594 |
return(ranT);
|
|
1595 |
}
|