|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Base class for SUPL subsessions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32base.h> |
|
22 #include <s32mem.h> |
|
23 |
|
24 #include "epos_suplterminalipc.h" |
|
25 #include "epos_suplterminalerrors.h" |
|
26 #include "epos_csuplprotocolmanagerbase.h" |
|
27 #include "epos_suplterminalqop.h" |
|
28 #include "epos_suplterminal.h" |
|
29 #include "epos_csuplsessionmanager.h" |
|
30 #include "epos_csuplglobal.h" |
|
31 #include "epos_csuplserverpanic.h" |
|
32 #include "epos_csuplipcsubsession.h" |
|
33 #include "epos_suplparameters.h" |
|
34 #include "epos_csuplsettings.h" |
|
35 #include "epos_csuplsettingsinternal.h" |
|
36 #include "epos_csuplsettingparams.h" |
|
37 |
|
38 // CONSTANTS |
|
39 //#ifdef _DEBUG |
|
40 _LIT(KTraceFileName, "SUPL_GW::epos_csuplipcsubsession.cpp"); |
|
41 //#endif |
|
42 |
|
43 // ==================== LOCAL FUNCTIONS ==================== |
|
44 |
|
45 inline TPositionInfo& PositionInfo(HBufC8* aBuffer) |
|
46 { |
|
47 DEBUG_TRACE("PositionInfo", __LINE__) |
|
48 return reinterpret_cast<TPositionInfo&> |
|
49 (const_cast<TUint8&>(*aBuffer->Ptr())); |
|
50 } |
|
51 |
|
52 inline TDes& ServerAddress(HBufC8* aBuffer) |
|
53 { |
|
54 DEBUG_TRACE("ServerAddress", __LINE__) |
|
55 return reinterpret_cast<TDes&> |
|
56 (const_cast<TUint8&>(*aBuffer->Ptr())); |
|
57 } |
|
58 |
|
59 inline TSuplTriggerFireInfo& TriggerInfo(HBufC8* aBuffer) |
|
60 { |
|
61 DEBUG_TRACE("TriggerInfo", __LINE__) |
|
62 return reinterpret_cast<TSuplTriggerFireInfo&> |
|
63 (const_cast<TUint8&>(*aBuffer->Ptr())); |
|
64 } |
|
65 |
|
66 |
|
67 // ================= MEMBER FUNCTIONS ======================= |
|
68 |
|
69 // C++ default constructor can NOT contain any code, that |
|
70 // might leave. |
|
71 // |
|
72 CSuplIPCSubSession::CSuplIPCSubSession() |
|
73 { |
|
74 } |
|
75 |
|
76 // EPOC default constructor can leave. |
|
77 void CSuplIPCSubSession::ConstructL(CSuplSessionManager& aSessnMgr, |
|
78 CSUPLProtocolManagerBase::TSuplReqType aReqType, |
|
79 TInt aIpcSessionId, |
|
80 RSuplTerminalSubSession::TSuplServiceType aSuplService) |
|
81 { |
|
82 DEBUG_TRACE("CSuplIPCSubSession::ConstructL", __LINE__) |
|
83 iSuplService = aSuplService; |
|
84 iSuplSession = aSessnMgr.CreateNewSessionL(aReqType, aIpcSessionId, aSuplService); |
|
85 iSuplSessnReq = CSuplSessionRequest::NewL(aSessnMgr, iSuplSession, this); |
|
86 iReqType=0; |
|
87 if(!iSuplSession) |
|
88 User::Leave(KErrGeneral); |
|
89 } |
|
90 |
|
91 // Two-phased constructor. |
|
92 CSuplIPCSubSession* CSuplIPCSubSession::NewLC(CSuplSessionManager& aSessnMgr, |
|
93 CSUPLProtocolManagerBase::TSuplReqType aReqType, |
|
94 TInt aIpcSessionId, |
|
95 RSuplTerminalSubSession::TSuplServiceType aSuplService) |
|
96 { |
|
97 DEBUG_TRACE("CSuplIPCSubSession::NewLC", __LINE__) |
|
98 CSuplIPCSubSession* self = new (ELeave) CSuplIPCSubSession(); |
|
99 CleanupClosePushL(*self); |
|
100 TInt err=KErrNone; |
|
101 TRAP(err, self->ConstructL(aSessnMgr, aReqType, aIpcSessionId, aSuplService)); |
|
102 if(err!=KErrNone) |
|
103 { |
|
104 DEBUG_TRACE("CSuplIPCSubSession::Could Not Create Session", __LINE__) |
|
105 return NULL; |
|
106 } |
|
107 return self; |
|
108 } |
|
109 |
|
110 // Destructor |
|
111 CSuplIPCSubSession::~CSuplIPCSubSession() |
|
112 { |
|
113 DEBUG_TRACE("CSuplIPCSubSession::~CSuplIPCSubSession", __LINE__) |
|
114 delete iSuplSessnReq; |
|
115 if( iPositionBuffer ) |
|
116 delete iPositionBuffer; |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------- |
|
120 // CSuplIPCSubSession::ServiceL |
|
121 // |
|
122 // (other items were commented in a header). |
|
123 // --------------------------------------------------------- |
|
124 // |
|
125 void CSuplIPCSubSession::ServiceL(const RMessage2& aMessage) |
|
126 { |
|
127 DEBUG_TRACE("CSuplIPCSubSession::ServiceL", __LINE__) |
|
128 |
|
129 switch (aMessage.Function()) |
|
130 { |
|
131 case ESuplTerminalSubssnSyncRunsession: |
|
132 { |
|
133 iReqType=ESuplTerminalSubssnSyncRunsession; |
|
134 iMessage=aMessage; |
|
135 HandleRunSessionL(aMessage); |
|
136 } |
|
137 break; |
|
138 case ESuplTerminalSubssnAsyncRunsession: |
|
139 { |
|
140 iMessage=aMessage; |
|
141 iReqType=ESuplTerminalSubssnAsyncRunsession; |
|
142 HandleRunSessionL(aMessage); |
|
143 } |
|
144 break; |
|
145 case ESuplTerminalSubssnAsyncRunsessionWithQop: |
|
146 { |
|
147 iMessage=aMessage; |
|
148 iReqType=ESuplTerminalSubssnAsyncRunsessionWithQop; |
|
149 HandleRunSessionL(aMessage); |
|
150 } |
|
151 break; |
|
152 case ESuplTerminalSubssnSyncRunsessionWithQop: |
|
153 { |
|
154 iMessage=aMessage; |
|
155 iReqType=ESuplTerminalSubssnSyncRunsessionWithQop; |
|
156 HandleRunSessionL(aMessage); |
|
157 } |
|
158 break; |
|
159 case ESuplTerminalSubssnSyncRunsessionWithServernameQop: |
|
160 { |
|
161 iMessage=aMessage; |
|
162 iReqType=ESuplTerminalSubssnSyncRunsessionWithServernameQop; |
|
163 HandleRunSessionL(aMessage); |
|
164 } |
|
165 break; |
|
166 case ESuplTerminalSubssnASyncRunsessionWithServernameQop: |
|
167 { |
|
168 iMessage=aMessage; |
|
169 iReqType=ESuplTerminalSubssnASyncRunsessionWithServernameQop; |
|
170 HandleRunSessionL(aMessage); |
|
171 } |
|
172 break; |
|
173 case ESuplTerminalSubssnSyncRunsessionServernameWithoutQop: |
|
174 { |
|
175 iMessage=aMessage; |
|
176 iReqType=ESuplTerminalSubssnSyncRunsessionServernameWithoutQop; |
|
177 HandleRunSessionL(aMessage); |
|
178 } |
|
179 break; |
|
180 case ESuplTerminalSubssnASyncRunsessionServernameWithoutQop: |
|
181 { |
|
182 iMessage=aMessage; |
|
183 iReqType=ESuplTerminalSubssnASyncRunsessionServernameWithoutQop; |
|
184 HandleRunSessionL(aMessage); |
|
185 } |
|
186 break; |
|
187 |
|
188 case ESuplTerminalSubssnGetServerAddress: |
|
189 HandleGetServerAddressL(aMessage); |
|
190 break; |
|
191 |
|
192 case ESuplTerminalSubssnGetPosition: |
|
193 HandleGetPositionL(aMessage); |
|
194 break; |
|
195 |
|
196 case ESuplTerminalSubssnCancelRunsession: |
|
197 HandleRunSessionCancelRequestL(aMessage); |
|
198 break; |
|
199 |
|
200 case ESuplTerminalSubssnStartPeriodicTrigger: |
|
201 { |
|
202 iMessage=aMessage; |
|
203 iReqType=ESuplTerminalSubssnStartPeriodicTrigger; |
|
204 HandlePeriodicTriggerSessionL(aMessage); |
|
205 } |
|
206 break; |
|
207 |
|
208 case ESuplTerminalSubssnStartPeriodicTriggerWithServer: |
|
209 { |
|
210 iMessage=aMessage; |
|
211 iReqType=ESuplTerminalSubssnStartPeriodicTriggerWithServer; |
|
212 HandlePeriodicTriggerSessionWithServernameL(aMessage); |
|
213 } |
|
214 break; |
|
215 |
|
216 case ESuplTerminalSubssnStopTriggerSession: |
|
217 { |
|
218 iReqType = ESuplTerminalSubssnStopTriggerSession; |
|
219 HandleStopTriggerringSessionL(aMessage); |
|
220 break; |
|
221 } |
|
222 case ESuplTerminalSubssnNotifyTriggerFired: |
|
223 { |
|
224 iMessage=aMessage; |
|
225 iReqType = ESuplTerminalSubssnNotifyTriggerFired; |
|
226 HandleNotifyTriggerFiredL(aMessage); |
|
227 break; |
|
228 } |
|
229 default: |
|
230 User::Leave(KErrNotSupported); |
|
231 } |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------- |
|
235 // CSuplIPCSubSession::NotifyServerShutdown |
|
236 // |
|
237 // (other items were commented in a header). |
|
238 // --------------------------------------------------------- |
|
239 // |
|
240 void CSuplIPCSubSession::NotifyServerShutdown() |
|
241 { |
|
242 } |
|
243 |
|
244 // --------------------------------------------------------- |
|
245 // CSuplIPCSubSession::DestroySession |
|
246 // |
|
247 // (other items were commented in a header). |
|
248 // --------------------------------------------------------- |
|
249 // |
|
250 void CSuplIPCSubSession::DestroySession(CSuplSessionManager& aSessnMgr) |
|
251 { |
|
252 DEBUG_TRACE("CSuplIPCSubSession::DestryoSession", __LINE__) |
|
253 TInt errCode = aSessnMgr.DestroySession(iSuplSession); |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------- |
|
257 // CSuplIPCSubSession::HandleRunSessionL |
|
258 // |
|
259 // (other items were commented in a header). |
|
260 // --------------------------------------------------------- |
|
261 // |
|
262 void CSuplIPCSubSession::HandleRunSessionL(const RMessage2& aMessage) |
|
263 { |
|
264 DEBUG_TRACE("CSuplIPCSubSession::HandleRunSessionL", __LINE__) |
|
265 |
|
266 if (iSuplSessnReq->IsActive()) |
|
267 { |
|
268 SuplGlobal::RequestComplete(aMessage, KErrAlreadyExists); |
|
269 } |
|
270 |
|
271 TInt setCaps = aMessage.Int0(); |
|
272 TBool firstReq = EFalse; |
|
273 |
|
274 if (setCaps & 0x1000 ) |
|
275 firstReq = ETrue; |
|
276 |
|
277 setCaps &= 0x00FF; |
|
278 |
|
279 if(iReqType==ESuplTerminalSubssnAsyncRunsession||iReqType==ESuplTerminalSubssnSyncRunsession) |
|
280 iSuplSessnReq->MakeSuplSessionRequestL(iSuplSession, aMessage.Int0(), aMessage.Int1(), firstReq); |
|
281 else |
|
282 if(iReqType==ESuplTerminalSubssnSyncRunsessionWithQop) |
|
283 { |
|
284 HBufC8* qopBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
285 |
|
286 TUint bufferSize = qopBuf->Size(); |
|
287 |
|
288 TSuplTerminalQop& qop = reinterpret_cast |
|
289 <TSuplTerminalQop&>(const_cast<TUint8&>(*qopBuf->Ptr())); |
|
290 |
|
291 iSuplSessnReq->MakeSuplSessionRequestL(iSuplSession, aMessage.Int0(), aMessage.Int1(),qop, firstReq); |
|
292 CleanupStack::PopAndDestroy(qopBuf); |
|
293 } |
|
294 else |
|
295 if(iReqType==ESuplTerminalSubssnAsyncRunsessionWithQop) |
|
296 { |
|
297 HBufC8* clientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
298 |
|
299 TSuplTerminalQop& qop1=reinterpret_cast<TSuplTerminalQop&> |
|
300 (const_cast<TUint8&>(*clientBuf->Ptr())); |
|
301 |
|
302 iSuplSessnReq->MakeSuplSessionRequestL(iSuplSession, aMessage.Int0(), aMessage.Int1(),qop1, firstReq); |
|
303 |
|
304 CleanupStack::PopAndDestroy(clientBuf); |
|
305 } |
|
306 else |
|
307 if(iReqType==ESuplTerminalSubssnSyncRunsessionWithServernameQop||iReqType==ESuplTerminalSubssnASyncRunsessionWithServernameQop) |
|
308 { |
|
309 HBufC8* clientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
310 |
|
311 TSuplParameters& suplStruct=reinterpret_cast<TSuplParameters&> |
|
312 (const_cast<TUint8&>(*clientBuf->Ptr())); |
|
313 |
|
314 iSuplSessnReq->MakeSuplSessionRequestL(iSuplSession, suplStruct.HslpAddress, suplStruct.FallBack, aMessage.Int0(), aMessage.Int1(),suplStruct.qop, firstReq); |
|
315 |
|
316 CleanupStack::PopAndDestroy(clientBuf); |
|
317 } |
|
318 else |
|
319 if(iReqType==ESuplTerminalSubssnSyncRunsessionServernameWithoutQop||iReqType==ESuplTerminalSubssnASyncRunsessionServernameWithoutQop) |
|
320 { |
|
321 HBufC8* clientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
322 |
|
323 TSuplParameters& suplStruct1=reinterpret_cast<TSuplParameters&> |
|
324 (const_cast<TUint8&>(*clientBuf->Ptr())); |
|
325 |
|
326 iSuplSessnReq->MakeSuplSessionRequestL(iSuplSession, suplStruct1.HslpAddress, suplStruct1.FallBack, aMessage.Int0(), aMessage.Int1(), firstReq); |
|
327 |
|
328 CleanupStack::PopAndDestroy(clientBuf); |
|
329 } |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------- |
|
333 // CSuplIPCSubSession::HandleGetPositionL |
|
334 // |
|
335 // (other items were commented in a header). |
|
336 // --------------------------------------------------------- |
|
337 // |
|
338 void CSuplIPCSubSession::HandleGetPositionL(const RMessage2& aMessage) |
|
339 { |
|
340 DEBUG_TRACE("CSuplIPCSubSession::HandleGetPositionL", __LINE__) |
|
341 TInt err; |
|
342 if (iSuplSession) |
|
343 { |
|
344 delete iPositionBuffer; |
|
345 iPositionBuffer = NULL; |
|
346 HBufC8* clientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage, 0); |
|
347 CleanupStack::Pop(clientBuf); |
|
348 iPositionBuffer = clientBuf; |
|
349 TPositionInfo& info = PositionInfo(iPositionBuffer); |
|
350 TUint32 classType = info.PositionClassType(); |
|
351 TUint32 generic = EPositionGenericInfoClass; |
|
352 |
|
353 if (classType & generic) |
|
354 { |
|
355 HPositionGenericInfo& hGeneric = static_cast <HPositionGenericInfo&> (info); |
|
356 err=iSuplSession->GetPosition(hGeneric); |
|
357 } |
|
358 else |
|
359 { |
|
360 err=iSuplSession->GetPosition(info); |
|
361 } |
|
362 } |
|
363 else |
|
364 err = KErrNotFound; |
|
365 |
|
366 CompleteGetPositionRequest(aMessage, err); |
|
367 } |
|
368 |
|
369 // --------------------------------------------------------- |
|
370 // CSuplIPCSubSession::HandleGetServerAddressL |
|
371 // |
|
372 // (other items were commented in a header). |
|
373 // --------------------------------------------------------- |
|
374 // |
|
375 void CSuplIPCSubSession::HandleGetServerAddressL(const RMessage2& aMessage) |
|
376 { |
|
377 DEBUG_TRACE("CSuplIPCSubSession::HandleGetServerAddressL", __LINE__) |
|
378 TInt err; |
|
379 if (iSuplSession) |
|
380 { |
|
381 delete iPositionBuffer; |
|
382 iPositionBuffer = NULL; |
|
383 HBufC8* clientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage, 0); |
|
384 CleanupStack::Pop(clientBuf); |
|
385 iPositionBuffer = clientBuf; |
|
386 TDes& info = ServerAddress(iPositionBuffer); |
|
387 |
|
388 // Please check this call... Need Tbuf16 as a parameter |
|
389 err = iSuplSession->GetServerAddressL(info); |
|
390 |
|
391 CompleteGetServerAddress(aMessage, err); |
|
392 } |
|
393 else |
|
394 err = KErrNotFound; |
|
395 } |
|
396 |
|
397 //---------------------------------------------------------------------------------------------------------- |
|
398 |
|
399 // --------------------------------------------------------- |
|
400 // CSuplIPCSubSession::HandleRunSessionCancelRequestL |
|
401 // |
|
402 // (other items were commented in a header). |
|
403 // --------------------------------------------------------- |
|
404 // |
|
405 void CSuplIPCSubSession::HandleRunSessionCancelRequestL(const RMessage2& aMessage) |
|
406 { |
|
407 DEBUG_TRACE("CSuplIPCSubSession::HandleCancelRequestL", __LINE__) |
|
408 |
|
409 if (!iSuplSessnReq->IsActive() |
|
410 ||!(iReqType==ESuplTerminalSubssnAsyncRunsession |
|
411 || iReqType==ESuplTerminalSubssnAsyncRunsessionWithQop |
|
412 || iReqType==ESuplTerminalSubssnASyncRunsessionWithServernameQop |
|
413 || iReqType==ESuplTerminalSubssnASyncRunsessionServernameWithoutQop)) |
|
414 { |
|
415 User::Leave(KErrNotFound); |
|
416 } |
|
417 iSuplSessnReq->CancelRunSessionRequest(); |
|
418 SuplGlobal::RequestComplete(aMessage, KErrNone); |
|
419 CompleteRunSession(KErrCancel); |
|
420 } |
|
421 |
|
422 // --------------------------------------------------------- |
|
423 // CSuplIPCSubSession::CompleteRunSession |
|
424 // |
|
425 // (other items were commented in a header). |
|
426 // --------------------------------------------------------- |
|
427 // |
|
428 void CSuplIPCSubSession::CompleteRunSession(TInt aReason) |
|
429 { |
|
430 DEBUG_TRACE("CSuplIPCSubSession::CompleteRunSession", __LINE__) |
|
431 if (!iMessage.IsNull()) |
|
432 { |
|
433 iMessage.Complete(aReason); |
|
434 } |
|
435 } |
|
436 |
|
437 // --------------------------------------------------------- |
|
438 // CSuplIPCSubSession::CompleteTriggerRunSession |
|
439 // |
|
440 // (other items were commented in a header). |
|
441 // --------------------------------------------------------- |
|
442 // |
|
443 void CSuplIPCSubSession::CompleteTriggerRunSession(TInt aReason) |
|
444 { |
|
445 DEBUG_TRACE("CSuplIPCSubSession::CompleteTriggerRunSession", __LINE__) |
|
446 if (!iMessage.IsNull()) |
|
447 { |
|
448 iMessage.Complete(aReason); |
|
449 } |
|
450 } |
|
451 |
|
452 // --------------------------------------------------------- |
|
453 // CSuplIPCSubSession::CompleteGetPositionRequest |
|
454 // |
|
455 // (other items were commented in a header). |
|
456 // --------------------------------------------------------- |
|
457 // |
|
458 void CSuplIPCSubSession::CompleteGetPositionRequest( |
|
459 const RMessage2& aMessage, |
|
460 TInt aReason) |
|
461 { |
|
462 DEBUG_TRACE("CSuplIPCSubSession::CompleteGetPositionRequest", __LINE__) |
|
463 if (aReason == KErrNone) |
|
464 { |
|
465 TInt err = PackPositionData(aMessage); |
|
466 // err - client cannot receive result data |
|
467 //CompleteRunSession((err != KErrNone) ? err : aReason); |
|
468 if (err != KErrNone) |
|
469 aMessage.Complete(err); |
|
470 else |
|
471 aMessage.Complete(aReason); |
|
472 } |
|
473 else |
|
474 { |
|
475 //CompleteRunSession(aReason); |
|
476 aMessage.Complete(aReason); |
|
477 } |
|
478 delete iPositionBuffer; |
|
479 iPositionBuffer = NULL; |
|
480 iReqType=0; |
|
481 } |
|
482 |
|
483 // --------------------------------------------------------- |
|
484 // CSuplIPCSubSession::CompleteTriggerFiredNotifyRequest |
|
485 // |
|
486 // (other items were commented in a header). |
|
487 // --------------------------------------------------------- |
|
488 // |
|
489 void CSuplIPCSubSession::CompleteTriggerFiredNotifyRequest(TInt aReason) |
|
490 { |
|
491 DEBUG_TRACE("CSuplIPCSubSession::CompleteGetPositionRequest", __LINE__) |
|
492 if (aReason == KErrNone) |
|
493 PackTriggerData(iMessage); |
|
494 |
|
495 if (!iMessage.IsNull()) |
|
496 { |
|
497 iMessage.Complete(aReason); |
|
498 } |
|
499 delete iPositionBuffer; |
|
500 iPositionBuffer = NULL; |
|
501 } |
|
502 |
|
503 // --------------------------------------------------------- |
|
504 // CSuplIPCSubSession::CompleteGetServerAddress |
|
505 // |
|
506 // (other items were commented in a header). |
|
507 // --------------------------------------------------------- |
|
508 // |
|
509 void CSuplIPCSubSession::CompleteGetServerAddress(const RMessage2& aMessage, TInt aReason) |
|
510 { |
|
511 DEBUG_TRACE("CSuplIPCSubSession::CompleteGetServerAddress", __LINE__) |
|
512 if (aReason == KErrNone) |
|
513 { |
|
514 TInt err = PackServerAddressData(aMessage); |
|
515 // err - client cannot receive result data |
|
516 //CompleteRunSession((err != KErrNone) ? err : aReason); |
|
517 if (err != KErrNone) |
|
518 aMessage.Complete(err); |
|
519 else |
|
520 aMessage.Complete(aReason); |
|
521 } |
|
522 else |
|
523 { |
|
524 //CompleteRunSession(aReason); |
|
525 aMessage.Complete(aReason); |
|
526 } |
|
527 delete iPositionBuffer; |
|
528 iPositionBuffer = NULL; |
|
529 iReqType=0; |
|
530 } |
|
531 |
|
532 //------------------------------------------------------------------------------------------------ |
|
533 // --------------------------------------------------------- |
|
534 // CSuplIPCSubSession::PackPositionData |
|
535 // |
|
536 // (other items were commented in a header). |
|
537 // --------------------------------------------------------- |
|
538 // |
|
539 |
|
540 TInt CSuplIPCSubSession::PackPositionData(const RMessage2& aMessage) |
|
541 { |
|
542 DEBUG_TRACE("CSuplIPCSubSession::PackPositionData", __LINE__) |
|
543 TPositionInfo& info = PositionInfo(iPositionBuffer); |
|
544 |
|
545 TPtr8 ptrToBuffer = iPositionBuffer->Des(); |
|
546 return SuplGlobal::Write(aMessage, 0, ptrToBuffer); |
|
547 } |
|
548 |
|
549 // --------------------------------------------------------- |
|
550 // CSuplIPCSubSession::PackServerAddressData |
|
551 // |
|
552 // (other items were commented in a header). |
|
553 // --------------------------------------------------------- |
|
554 // |
|
555 TInt CSuplIPCSubSession::PackServerAddressData(const RMessage2& aMessage) |
|
556 { |
|
557 DEBUG_TRACE("CSuplIPCSubSession::PackServerAddressData", __LINE__) |
|
558 TDes& info = ServerAddress(iPositionBuffer); |
|
559 |
|
560 TPtr8 ptrToBuffer = iPositionBuffer->Des(); |
|
561 return SuplGlobal::Write(aMessage, 0, ptrToBuffer); |
|
562 } |
|
563 |
|
564 //--------------------------------------------------------------------------------------------------- |
|
565 // --------------------------------------------------------- |
|
566 // CSuplIPCSubSession::PackTriggerData |
|
567 // |
|
568 // (other items were commented in a header). |
|
569 // --------------------------------------------------------- |
|
570 // |
|
571 |
|
572 TInt CSuplIPCSubSession::PackTriggerData(const RMessage2& aMessage) |
|
573 { |
|
574 DEBUG_TRACE("CSuplIPCSubSession::PackTriggerData", __LINE__) |
|
575 TSuplTriggerFireInfo& info = TriggerInfo(iPositionBuffer); |
|
576 |
|
577 TPtr8 ptrToBuffer = iPositionBuffer->Des(); |
|
578 return SuplGlobal::Write(aMessage, 2, ptrToBuffer); |
|
579 } |
|
580 |
|
581 // --------------------------------------------------------- |
|
582 // CSuplIPCSubSession::ProtocolHUnloaded |
|
583 // |
|
584 // (other items were commented in a header). |
|
585 // --------------------------------------------------------- |
|
586 // |
|
587 void CSuplIPCSubSession::ProtocolHUnloaded() //change here --- Subhra |
|
588 { |
|
589 DEBUG_TRACE("CSuplIPCSubSession::ProtocolHUnloaded", __LINE__) |
|
590 iSuplSessnReq->Cancel(); |
|
591 iSuplSessnReq->ProtocolHUnloaded(); |
|
592 CompleteRunSession(KErrCompletion); |
|
593 iSuplSession = NULL; |
|
594 } |
|
595 |
|
596 // --------------------------------------------------------- |
|
597 // CSuplIPCSubSession::HandlePeriodicTriggerSessionWithServernameL |
|
598 // |
|
599 // (other items were commented in a header). |
|
600 // --------------------------------------------------------- |
|
601 // |
|
602 void CSuplIPCSubSession::HandlePeriodicTriggerSessionWithServernameL(const RMessage2& aMessage) |
|
603 { |
|
604 DEBUG_TRACE("CSuplIPCSubSession::HandlePeriodicTriggerSessionWithServernameL", __LINE__) |
|
605 |
|
606 if (!aMessage.HasCapability(ECapabilityCommDD)) |
|
607 { |
|
608 DEBUG_TRACE("HandlePeriodicTriggerSessionL, Client doesnt have CommDD capability", __LINE__) |
|
609 SuplGlobal::RequestComplete(aMessage, KErrPermissionDenied); |
|
610 } |
|
611 |
|
612 if (iSuplSessnReq->IsActive()) |
|
613 { |
|
614 DEBUG_TRACE("HandlePeriodicTriggerSessionWithServernameL, session active", __LINE__) |
|
615 SuplGlobal::RequestComplete(aMessage, KErrAlreadyExists); |
|
616 } |
|
617 |
|
618 TInt setCaps = aMessage.Int0(); |
|
619 TInt requestId = aMessage.Int1(); |
|
620 |
|
621 DEBUG_TRACE("HandlePeriodicTriggerSessionWithServernameL, copying client buffer", __LINE__) |
|
622 HBufC8* clientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
623 DEBUG_TRACE("HandlePeriodicTriggerSessionWithServernameL, copy client buffer complete", __LINE__) |
|
624 |
|
625 TSuplParameters& suplStruct=reinterpret_cast<TSuplParameters&> |
|
626 (const_cast<TUint8&>(*clientBuf->Ptr())); |
|
627 |
|
628 iSuplSessnReq->MakeSuplSessionTriggerringRequestL( |
|
629 iSuplSession, |
|
630 suplStruct.PeriodicTrigger, |
|
631 suplStruct.HslpAddress, |
|
632 suplStruct.FallBack, |
|
633 setCaps, |
|
634 requestId); |
|
635 |
|
636 CleanupStack::PopAndDestroy(clientBuf); |
|
637 } |
|
638 |
|
639 // --------------------------------------------------------- |
|
640 // CSuplIPCSubSession::HandlePeriodicTriggerSessionL |
|
641 // |
|
642 // (other items were commented in a header). |
|
643 // --------------------------------------------------------- |
|
644 // |
|
645 void CSuplIPCSubSession::HandlePeriodicTriggerSessionL(const RMessage2& aMessage) |
|
646 { |
|
647 DEBUG_TRACE("CSuplIPCSubSession::HandlePeriodicTriggerSessionL", __LINE__) |
|
648 |
|
649 if (!aMessage.HasCapability(ECapabilityCommDD)) |
|
650 { |
|
651 DEBUG_TRACE("HandlePeriodicTriggerSessionL, Client doesnt have CommDD capability", __LINE__) |
|
652 SuplGlobal::RequestComplete(aMessage, KErrPermissionDenied); |
|
653 } |
|
654 |
|
655 if (iSuplSessnReq->IsActive()) |
|
656 { |
|
657 DEBUG_TRACE("HandlePeriodicTriggerSessionL, session active", __LINE__) |
|
658 SuplGlobal::RequestComplete(aMessage, KErrAlreadyExists); |
|
659 } |
|
660 |
|
661 TInt setCaps = aMessage.Int0(); |
|
662 TInt requestId = aMessage.Int1(); |
|
663 |
|
664 DEBUG_TRACE("HandlePeriodicTriggerSessionL, copying client buffer", __LINE__) |
|
665 HBufC8* pTriggerBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
666 DEBUG_TRACE("HandlePeriodicTriggerSessionL, copy client buffer complete", __LINE__) |
|
667 TUint bufferSize = pTriggerBuf->Size(); |
|
668 |
|
669 TSuplTerminalPeriodicTrigger& pTrigger = reinterpret_cast |
|
670 <TSuplTerminalPeriodicTrigger&>(const_cast<TUint8&>(*pTriggerBuf->Ptr())); |
|
671 |
|
672 iSuplSessnReq->MakeSuplSessionTriggerringRequestL( |
|
673 iSuplSession, |
|
674 pTrigger, |
|
675 setCaps, |
|
676 requestId |
|
677 ); |
|
678 |
|
679 CleanupStack::PopAndDestroy(pTriggerBuf); |
|
680 } |
|
681 |
|
682 // --------------------------------------------------------- |
|
683 // CSuplIPCSubSession::HandleStopTriggerringSessionL |
|
684 // |
|
685 // (other items were commented in a header). |
|
686 // --------------------------------------------------------- |
|
687 // |
|
688 void CSuplIPCSubSession::HandleStopTriggerringSessionL(const RMessage2& aMessage) |
|
689 { |
|
690 DEBUG_TRACE("CSuplIPCSubSession::HandleStopTriggerringSessionL", __LINE__) |
|
691 |
|
692 if (!iSuplSessnReq->IsActive()||(iReqType!=ESuplTerminalSubssnStopTriggerSession)) |
|
693 { |
|
694 User::Leave(KErrNotFound); |
|
695 } |
|
696 iSuplSessnReq->CancelTriggerringRequest(); |
|
697 SuplGlobal::RequestComplete(aMessage, KErrNone); |
|
698 CompleteTriggerRunSession(KErrCancel); |
|
699 } |
|
700 |
|
701 // --------------------------------------------------------- |
|
702 // CSuplIPCSubSession::HandleNotifyTriggerFiredL |
|
703 // |
|
704 // (other items were commented in a header). |
|
705 // --------------------------------------------------------- |
|
706 // |
|
707 void CSuplIPCSubSession::HandleNotifyTriggerFiredL(const RMessage2& aMessage) |
|
708 { |
|
709 DEBUG_TRACE("CSuplIPCSubSession::HandlerNotifyTriggerFired", __LINE__) |
|
710 |
|
711 if (iSuplSessnReq->IsActive()) |
|
712 { |
|
713 SuplGlobal::RequestComplete(aMessage, KErrAlreadyExists); |
|
714 } |
|
715 |
|
716 HBufC8* fireInfoBuf = SuplGlobal::CopyClientBuffer8LC(aMessage,2); |
|
717 TUint bufferSize = fireInfoBuf->Size(); |
|
718 |
|
719 delete iPositionBuffer; |
|
720 iPositionBuffer = NULL; |
|
721 |
|
722 iPositionBuffer = fireInfoBuf; |
|
723 |
|
724 TSuplTriggerFireInfo& fireInfo = reinterpret_cast |
|
725 <TSuplTriggerFireInfo&>(const_cast<TUint8&>(*fireInfoBuf->Ptr())); |
|
726 |
|
727 iSuplSessnReq->NotifyTriggerFiredRequestL(iSuplSession,fireInfo); |
|
728 |
|
729 CleanupStack::Pop(fireInfoBuf); |
|
730 } |
|
731 |
|
732 // End of File |