|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // A collection of etel driver strategies |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include <e32def.h> |
|
24 |
|
25 #include "ceteldrivercontext.h" |
|
26 #include "eteldriverstrategies.h" |
|
27 #include "spudteldebuglogger.h" |
|
28 #include "pdpfsmnmspace.h" |
|
29 |
|
30 #include <pcktcs.h> |
|
31 using namespace ConnectionServ; |
|
32 |
|
33 // |
|
34 // TOpenStrategy |
|
35 // |
|
36 /** Executes next asynchronous step in a strategy. |
|
37 |
|
38 @param aContext - pdp context |
|
39 @param aStatus - request status of this step |
|
40 */ |
|
41 void TOpenStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
42 { |
|
43 SPUDTEL_FNLOG("TOpenStrategy::Next()"); |
|
44 |
|
45 TInt err = KErrNone; |
|
46 |
|
47 switch(aContext.StrategyStep()) |
|
48 { |
|
49 case EStartStep: |
|
50 { |
|
51 aContext.Phone().Initialise (*aStatus); |
|
52 aContext.SetStrategyStep(EInitPhoneStep); |
|
53 break; |
|
54 } |
|
55 |
|
56 case EInitPhoneStep: |
|
57 { |
|
58 aContext.SetStrategyStep(EFinishStep); |
|
59 break; |
|
60 } |
|
61 |
|
62 default: |
|
63 // incorrect step |
|
64 SPUDTEL_ERROR_LOG0(_L("Incorrect step")); |
|
65 ASSERT(EFalse); |
|
66 err = KErrNotSupported; |
|
67 break; |
|
68 |
|
69 } // switch |
|
70 |
|
71 if(err || (EFinishStep == aContext.StrategyStep())) |
|
72 { |
|
73 User::RequestComplete( aStatus, err); |
|
74 } |
|
75 } |
|
76 |
|
77 |
|
78 /** |
|
79 Notifies SPUD FSM about execution results. |
|
80 |
|
81 @param aContext - pdp context |
|
82 @param aCompletionStatus - completion request status |
|
83 */ |
|
84 void TOpenStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus) |
|
85 { |
|
86 if(aCompletionStatus == KErrNone) |
|
87 { |
|
88 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPhoneOpened")); |
|
89 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPhoneOpened); |
|
90 } |
|
91 else |
|
92 { |
|
93 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPhoneOpenedFailed")); |
|
94 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPhoneOpenedFailed, aCompletionStatus.Int()); |
|
95 } |
|
96 } |
|
97 |
|
98 /** Cancels last asynchronous request to eTel |
|
99 |
|
100 @param aContext - pdp context |
|
101 */ |
|
102 void TOpenStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
103 { |
|
104 switch(aContext.StrategyStep()) |
|
105 { |
|
106 case EInitPhoneStep: |
|
107 { |
|
108 SPUDTEL_INFO_LOG(_L("Cancel Phone::InitialiseCancel")); |
|
109 aContext.Phone().InitialiseCancel(); |
|
110 break; |
|
111 } |
|
112 |
|
113 default: |
|
114 // there're NO outstanding async requests |
|
115 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TOpenStrategy::CancelAsyncRequest")); |
|
116 ASSERT(EFalse); |
|
117 break; |
|
118 } |
|
119 } |
|
120 |
|
121 |
|
122 // |
|
123 // TContextDeleteStrategy |
|
124 // |
|
125 /** Executes next asynchronous step in a strategy. |
|
126 |
|
127 @param aContext - pdp context |
|
128 @param aStatus - request status of this step |
|
129 */ |
|
130 void TContextDeleteStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
131 { |
|
132 SPUDTEL_FNLOG("TContextDeleteStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus)"); |
|
133 |
|
134 TInt err = KErrNone; |
|
135 |
|
136 // steps: |
|
137 // -- cancel notifications |
|
138 // -- deactivate context |
|
139 // -- close QoS only for Primary & secondary, for MBMS just skip |
|
140 // -- close context |
|
141 // -- delete context |
|
142 switch(aContext.StrategyStep()) |
|
143 { |
|
144 case EStartStep: |
|
145 { |
|
146 // cancel associated notifications |
|
147 // -- StatusChangeNotifier |
|
148 // -- QoSChangeNotifier |
|
149 // -- ConfigChangeNotifier |
|
150 aContext.StopNotifications(); |
|
151 |
|
152 if (aContext.ContextType() != SpudMan::EMbms) |
|
153 { |
|
154 if (aContext.PacketContext().SubSessionHandle()) |
|
155 { |
|
156 aContext.PacketContext().Deactivate(*aStatus); |
|
157 aContext.SetStrategyStep (EDeactivateStep); |
|
158 } |
|
159 else |
|
160 { |
|
161 aContext.SetStrategyStep(EDeactivateStep); |
|
162 User::RequestComplete(aStatus, err); |
|
163 } |
|
164 } |
|
165 else |
|
166 { |
|
167 if (aContext.MbmsPacketContext().SubSessionHandle()) |
|
168 { |
|
169 aContext.MbmsPacketContext().Deactivate(*aStatus); |
|
170 aContext.SetStrategyStep (EDeactivateStep); |
|
171 } |
|
172 else |
|
173 { |
|
174 aContext.SetStrategyStep(EDeleteContextStep); |
|
175 User::RequestComplete(aStatus, err); |
|
176 } |
|
177 } |
|
178 break; |
|
179 } |
|
180 |
|
181 case EDeactivateStep: |
|
182 { |
|
183 if (aContext.ContextType() != SpudMan::EMbms) |
|
184 { |
|
185 if (aContext.PacketQoS().SubSessionHandle()) |
|
186 { |
|
187 aContext.PacketQoS().Close(); |
|
188 } |
|
189 |
|
190 if (aContext.PacketContext().SubSessionHandle()) |
|
191 { |
|
192 aContext.PacketContext().Delete(*aStatus); |
|
193 aContext.SetStrategyStep(EDeleteContextStep); |
|
194 } |
|
195 else |
|
196 { |
|
197 // jump to next step |
|
198 aContext.SetStrategyStep(EDeleteContextStep); |
|
199 User::RequestComplete( aStatus, err); |
|
200 } |
|
201 } |
|
202 else |
|
203 { |
|
204 if (aContext.MbmsPacketContext().SubSessionHandle()) |
|
205 { |
|
206 aContext.MbmsPacketContext().Delete(*aStatus); |
|
207 aContext.SetStrategyStep(EDeleteContextStep); |
|
208 } |
|
209 else |
|
210 { |
|
211 // jump to next step |
|
212 aContext.SetStrategyStep(EDeleteContextStep); |
|
213 User::RequestComplete( aStatus, err); |
|
214 } |
|
215 } |
|
216 break; |
|
217 } |
|
218 |
|
219 |
|
220 case EDeleteContextStep: |
|
221 { |
|
222 if (aContext.ContextType() != SpudMan::EMbms) |
|
223 { |
|
224 aContext.PacketContext().Close(); |
|
225 } |
|
226 else |
|
227 { |
|
228 aContext.MbmsPacketContext().Close(); |
|
229 } |
|
230 // clear the name |
|
231 aContext.Name().Zero(); |
|
232 aContext.SetStrategyStep (EFinishStep); |
|
233 break; |
|
234 } |
|
235 |
|
236 default: |
|
237 // incorrect step |
|
238 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
239 ASSERT(EFalse); |
|
240 err = KErrNotSupported; |
|
241 break; |
|
242 |
|
243 } // switch |
|
244 |
|
245 if(err || (EFinishStep == aContext.StrategyStep())) |
|
246 { |
|
247 User::RequestComplete( aStatus, err); |
|
248 } |
|
249 |
|
250 } |
|
251 |
|
252 |
|
253 /** |
|
254 Notifies SPUD FSM about execution results. |
|
255 |
|
256 @param aContext - pdp context |
|
257 @param aCompletionStatus - completion request status |
|
258 */ |
|
259 void TContextDeleteStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus) |
|
260 { |
|
261 aContext.PdpFsmInterface().Set(aContext.Id(), RPacketContext::EStatusDeleted); |
|
262 |
|
263 if(aCompletionStatus == KErrNone) |
|
264 { |
|
265 SPUDTEL_INFO_LOG(_L("Notifying FSM: EContextDeleted")); |
|
266 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EContextDeleted); |
|
267 } |
|
268 else |
|
269 { |
|
270 SPUDTEL_INFO_LOG(_L("Notifying FSM: EContextDeletedFailed")); |
|
271 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EContextDeletedFailed, aCompletionStatus.Int()); |
|
272 } |
|
273 } |
|
274 |
|
275 /** Cancels last asynchronous request to eTel |
|
276 |
|
277 @param aContext - pdp context |
|
278 */ |
|
279 void TContextDeleteStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
280 { |
|
281 SPUDTEL_FNLOG("TContextDeleteStrategy::CancelAsyncRequest()"); |
|
282 |
|
283 // When there is no sub-session, the strategy will not call DeactivateContext, but will be in the EDeactivateStep state |
|
284 // In this case we don't want to cancel the deactivate request |
|
285 if (aContext.iStatus != KRequestPending) |
|
286 { |
|
287 return; |
|
288 } |
|
289 |
|
290 switch(aContext.StrategyStep()) |
|
291 { |
|
292 case EDeactivateStep: |
|
293 { |
|
294 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextDeactivate")); |
|
295 aContext.PacketContext().CancelAsyncRequest(EPacketContextDeactivate); |
|
296 break; |
|
297 } |
|
298 |
|
299 case EDeleteContextStep: |
|
300 { |
|
301 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextDelete")); |
|
302 aContext.PacketContext().CancelAsyncRequest(EPacketContextDelete); |
|
303 break; |
|
304 } |
|
305 |
|
306 default: |
|
307 // there're NO outstanding async requests |
|
308 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
309 ASSERT(EFalse); |
|
310 break; |
|
311 } |
|
312 } |
|
313 |
|
314 |
|
315 // |
|
316 // TCreate1ryPdpContextStrategy |
|
317 // |
|
318 /** Executes next asynchronous step in a strategy. |
|
319 |
|
320 @param aContext - pdp context |
|
321 @param aStatus - request status of this step |
|
322 */ |
|
323 void TCreate1ryPdpContextStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
324 { |
|
325 SPUDTEL_FNLOG("TCreate1ryPdpContextStrategy::Next()"); |
|
326 |
|
327 TInt err = KErrNone; |
|
328 |
|
329 // possible steps: |
|
330 // -- open new context |
|
331 // -- open new QoS |
|
332 // -- initialise context |
|
333 switch(aContext.StrategyStep()) |
|
334 { |
|
335 case EStartStep: |
|
336 { |
|
337 err = aContext.PacketContext().OpenNewContext (aContext.PacketService(), aContext.Name()); |
|
338 if (err) |
|
339 { |
|
340 SPUDTEL_ERROR_LOG(_L("PacketContextOpenNewContext returned %d"), err); |
|
341 break; |
|
342 } |
|
343 |
|
344 aContext.PacketContext().InitialiseContext(*aStatus, aContext.DataChannelV2Pckg()); |
|
345 aContext.SetStrategyStep (EInitialiseContextStep); |
|
346 break; |
|
347 } |
|
348 |
|
349 case EInitialiseContextStep: |
|
350 { |
|
351 // get packet config from fsm |
|
352 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.ContextPacketDataConfigBase()); |
|
353 // async set config |
|
354 aContext.PacketContext().SetConfig (*aStatus, aContext.ContextConfig()); |
|
355 // set next step |
|
356 aContext.SetStrategyStep (ESetConfigStep); |
|
357 break; |
|
358 } |
|
359 |
|
360 case ESetConfigStep: |
|
361 { |
|
362 // QoS name is not used anywhere |
|
363 TName newName; |
|
364 err = aContext.PacketQoS().OpenNewQoS (aContext.PacketContext(), newName); |
|
365 if (err) |
|
366 { |
|
367 SPUDTEL_ERROR_LOG(_L("PacketQoS OpenNewQoS returned %d"), err); |
|
368 break; |
|
369 } |
|
370 |
|
371 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
372 RPacketQoS::TQoSR5Requested r5; |
|
373 aContext.PdpFsmInterface().Get (aContext.Id(), r5); |
|
374 aContext.QosRequested() = r5; |
|
375 #else |
|
376 RPacketQoS::TQoSR99_R4Requested r4; |
|
377 aContext.PdpFsmInterface().Get (aContext.Id(), r4); |
|
378 aContext.QosRequested() = r4; |
|
379 #endif |
|
380 // SYMBIAN_NETWORKING_UMTSR5 |
|
381 |
|
382 |
|
383 #ifdef _DEBUG |
|
384 aContext.DumpReqProfileParameters (); |
|
385 #endif |
|
386 aContext.PacketQoS().SetProfileParameters (*aStatus, aContext.QosRequestedPckg()); |
|
387 aContext.SetStrategyStep (ESetProfileParamsStep); |
|
388 break; |
|
389 } |
|
390 |
|
391 case ESetProfileParamsStep: |
|
392 { |
|
393 aContext.SetStrategyStep (EFinishStep); |
|
394 break; |
|
395 } |
|
396 |
|
397 default: |
|
398 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
399 ASSERT(EFalse); |
|
400 err = KErrNotSupported; |
|
401 break; |
|
402 } |
|
403 |
|
404 if(err || (EFinishStep == aContext.StrategyStep())) |
|
405 { |
|
406 User::RequestComplete( aStatus, err); |
|
407 } |
|
408 |
|
409 } |
|
410 |
|
411 |
|
412 /** |
|
413 Notifies SPUD FSM about execution results. |
|
414 |
|
415 @param aContext - pdp context |
|
416 @param aCompletionStatus - completion request status |
|
417 */ |
|
418 void TCreate1ryPdpContextStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus) |
|
419 { |
|
420 if(aCompletionStatus == KErrNone) |
|
421 { |
|
422 SPUDTEL_INFO_LOG(_L("Notifying FSM: E1ryPdpContextCreated")); |
|
423 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E1ryPdpContextCreated); |
|
424 } |
|
425 else |
|
426 { |
|
427 SPUDTEL_INFO_LOG(_L("Notifying FSM: E1ryPdpContextCreatedFailed")); |
|
428 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E1ryPdpContextCreatedFailed, aCompletionStatus.Int()); |
|
429 } |
|
430 } |
|
431 |
|
432 /** Cancels last asynchronous request to eTel |
|
433 |
|
434 @param aContext - pdp context |
|
435 */ |
|
436 void TCreate1ryPdpContextStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
437 { |
|
438 SPUDTEL_FNLOG("TCreate1ryPdpContextStrategy::CancelAsyncRequest()"); |
|
439 |
|
440 switch(aContext.StrategyStep()) |
|
441 { |
|
442 case ESetConfigStep: |
|
443 { |
|
444 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextSetConfig")); |
|
445 aContext.PacketContext().CancelAsyncRequest(EPacketContextSetConfig); |
|
446 break; |
|
447 } |
|
448 |
|
449 case ESetProfileParamsStep: |
|
450 { |
|
451 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSSetProfileParams")); |
|
452 aContext.PacketQoS().CancelAsyncRequest(EPacketQoSSetProfileParams); |
|
453 break; |
|
454 } |
|
455 |
|
456 case EInitialiseContextStep: |
|
457 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextActivate")); |
|
458 aContext.PacketContext().CancelAsyncRequest(EPacketContextActivateCancel); |
|
459 break; |
|
460 |
|
461 default: |
|
462 // there're NO outstanding async requests |
|
463 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
464 ASSERT(EFalse); |
|
465 break; |
|
466 } |
|
467 } |
|
468 |
|
469 |
|
470 // |
|
471 // TCreate2ryPdpContextStrategy |
|
472 // |
|
473 /** Executes next asynchronous step in a strategy. |
|
474 |
|
475 @param aContext - pdp context |
|
476 @param aStatus - request status of this step |
|
477 */ |
|
478 void TCreate2ryPdpContextStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
479 { |
|
480 SPUDTEL_FNLOG("TCreate2ryPdpContextStrategy::Next()"); |
|
481 |
|
482 TInt err = KErrNone; |
|
483 |
|
484 // possible steps: |
|
485 // -- open new secondary context |
|
486 // -- open new QoS |
|
487 // -- initialise context |
|
488 switch(aContext.StrategyStep()) |
|
489 { |
|
490 case EStartStep: |
|
491 { |
|
492 const TName& existingContextName = aContext.ExistingContextName(); |
|
493 aContext.PacketContext().OpenNewSecondaryContext(aContext.PacketService(), existingContextName, aContext.Name()); |
|
494 aContext.PacketContext().InitialiseContext(*aStatus, aContext.DataChannelV2Pckg()); |
|
495 aContext.SetStrategyStep (EInitialiseContextStep); |
|
496 break; |
|
497 } |
|
498 case EInitialiseContextStep: |
|
499 { |
|
500 // QoS name is not used anywhere |
|
501 TName newName; |
|
502 err = aContext.PacketQoS().OpenNewQoS (aContext.PacketContext(), newName); |
|
503 if (err) |
|
504 { |
|
505 SPUDTEL_ERROR_LOG(_L("PacketQoS OpenNewQoS returned %d"), err); |
|
506 break; |
|
507 } |
|
508 aContext.SetStrategyStep (EFinishStep); |
|
509 break; |
|
510 } |
|
511 |
|
512 default: |
|
513 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
514 ASSERT(EFalse); |
|
515 err = KErrNotSupported; |
|
516 break; |
|
517 } |
|
518 |
|
519 if(err || (EFinishStep == aContext.StrategyStep())) |
|
520 { |
|
521 User::RequestComplete( aStatus, err); |
|
522 } |
|
523 |
|
524 } |
|
525 |
|
526 |
|
527 /** |
|
528 Notifies SPUD FSM about execution results. |
|
529 |
|
530 @param aContext - pdp context |
|
531 @param aCompletionStatus - completion request status |
|
532 */ |
|
533 void TCreate2ryPdpContextStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
534 { |
|
535 if(aCompletionStatus == KErrNone) |
|
536 { |
|
537 SPUDTEL_INFO_LOG(_L("Notifying FSM: E2ryPdpContextCreated")); |
|
538 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E2ryPdpContextCreated); |
|
539 } |
|
540 else |
|
541 { |
|
542 SPUDTEL_INFO_LOG(_L("Notifying FSM: E2ryPdpContextCreatedFailed")); |
|
543 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::E2ryPdpContextCreatedFailed, aCompletionStatus.Int()); |
|
544 } |
|
545 } |
|
546 |
|
547 /** Cancels last asynchronous request to eTel |
|
548 |
|
549 @param aContext - pdp context |
|
550 */ |
|
551 void TCreate2ryPdpContextStrategy::CancelAsyncRequest(CEtelDriverContext& /*aContext*/) |
|
552 { |
|
553 SPUDTEL_FNLOG("TCreate2ryPdpContextStrategy::CancelAsyncRequest()"); |
|
554 SPUDTEL_ERROR_LOG0(_L("ERROR: No outstanding requests")); |
|
555 } |
|
556 |
|
557 |
|
558 // |
|
559 // TSetQoSStrategy |
|
560 // |
|
561 /** Executes next asynchronous step in a strategy. |
|
562 |
|
563 @param aContext - pdp context |
|
564 @param aStatus - request status of this step |
|
565 */ |
|
566 void TSetQoSStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
567 { |
|
568 SPUDTEL_FNLOG("TSetQoSStrategy::Next()"); |
|
569 |
|
570 TInt err = KErrNone; |
|
571 |
|
572 // possible steps: |
|
573 // -- set QoS profile parameters |
|
574 switch(aContext.StrategyStep()) |
|
575 { |
|
576 case EStartStep: |
|
577 { |
|
578 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
579 RPacketQoS::TQoSR5Requested req; |
|
580 #else |
|
581 RPacketQoS::TQoSR99_R4Requested req; |
|
582 #endif |
|
583 // SYMBIAN_NETWORKING_UMTSR5 |
|
584 |
|
585 aContext.PdpFsmInterface().Get (aContext.Id(), req); |
|
586 aContext.QosRequested() = req; |
|
587 |
|
588 |
|
589 #ifdef _DEBUG |
|
590 aContext.DumpReqProfileParameters (); |
|
591 #endif |
|
592 aContext.PacketQoS().SetProfileParameters (*aStatus, aContext.QosRequestedPckg()); |
|
593 aContext.SetStrategyStep (ESetProfileParamsStep); |
|
594 break; |
|
595 } |
|
596 |
|
597 case ESetProfileParamsStep: |
|
598 { |
|
599 aContext.SetStrategyStep (EFinishStep); |
|
600 break; |
|
601 } |
|
602 |
|
603 default: |
|
604 { |
|
605 // unexpected |
|
606 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
607 ASSERT(EFalse); |
|
608 err = KErrNotSupported; |
|
609 break; |
|
610 } |
|
611 } |
|
612 |
|
613 if(err || (EFinishStep == aContext.StrategyStep())) |
|
614 { |
|
615 User::RequestComplete( aStatus, err); |
|
616 } |
|
617 |
|
618 } |
|
619 |
|
620 |
|
621 /** |
|
622 FSM completion notification |
|
623 and setting QoSR99_R4Negotiated in spud FSM |
|
624 */ |
|
625 void TSetQoSStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
626 { |
|
627 if(aCompletionStatus == KErrNone) |
|
628 { |
|
629 SPUDTEL_INFO_LOG(_L("Notifying FSM: EQoSSet")); |
|
630 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EQoSSet); |
|
631 } |
|
632 else |
|
633 { |
|
634 SPUDTEL_INFO_LOG(_L("Notifying FSM: EQoSSetFailed")); |
|
635 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EQoSSetFailed, aCompletionStatus.Int()); |
|
636 } |
|
637 } |
|
638 |
|
639 /** Cancels last asynchronous request to eTel |
|
640 |
|
641 @param aContext - pdp context |
|
642 */ |
|
643 void TSetQoSStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
644 { |
|
645 switch(aContext.StrategyStep()) |
|
646 { |
|
647 case ESetProfileParamsStep: |
|
648 { |
|
649 aContext.PacketQoS().CancelAsyncRequest(EPacketQoSSetProfileParams); |
|
650 SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketQoSSetProfileParams")); |
|
651 break; |
|
652 } |
|
653 |
|
654 default: |
|
655 // there're NO outstanding async requests |
|
656 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TSetQoSStrategy::CancelAsyncRequest")); |
|
657 ASSERT(EFalse); |
|
658 break; |
|
659 } |
|
660 } |
|
661 |
|
662 |
|
663 // |
|
664 // TSetTftStrategy |
|
665 // |
|
666 /** Executes next asynchronous step in a strategy. |
|
667 |
|
668 @param aContext - pdp context |
|
669 @param aStatus - request status of this step |
|
670 */ |
|
671 void TSetTftStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
672 { |
|
673 SPUDTEL_FNLOG("TSetTftStrategy::Next()"); |
|
674 |
|
675 TInt err = KErrNone; |
|
676 |
|
677 // possible steps: |
|
678 // -- add filters |
|
679 switch(aContext.StrategyStep()) |
|
680 { |
|
681 case EStartStep: |
|
682 { |
|
683 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftOperationCode()); |
|
684 switch(aContext.TftOperationCode()) |
|
685 { |
|
686 case KAddFilters: |
|
687 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftInfo()); |
|
688 SPUDTELVERBOSE_INFO_LOG1(_L("TftOperationCode - Add Filters"), aContext.TftInfo().FilterCount()); |
|
689 // Set strategy assumes that TFT has to be created on a first place |
|
690 SPUDTELVERBOSE_INFO_LOG(_L("Creating TFT...")); |
|
691 if (aContext.ContextType() != SpudMan::EMbms) |
|
692 { |
|
693 aContext.PacketContext().CreateNewTFT(*aStatus, aContext.TftInfo().FilterCount()); |
|
694 } |
|
695 else |
|
696 { |
|
697 aContext.MbmsPacketContext().CreateNewTFT(*aStatus, aContext.TftInfo().FilterCount()); |
|
698 } |
|
699 aContext.SetStrategyStep (ECreateNewTFTStep); |
|
700 break; |
|
701 |
|
702 case KRemoveFilters: |
|
703 err = KErrNotSupported; |
|
704 SPUDTEL_ERROR_LOG(_L("TftOperationCode - Remove is not supported in a Set strategy, return %d"), err); |
|
705 break; |
|
706 |
|
707 case KDeleteTFT: |
|
708 err = KErrNotSupported; |
|
709 SPUDTEL_ERROR_LOG(_L("TftOperationCode - Delete is not supported in a Set strategy, return %d"), err); |
|
710 break; |
|
711 |
|
712 default: |
|
713 // wrong case |
|
714 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
715 ASSERT(EFalse); |
|
716 err = KErrNotSupported; |
|
717 break; |
|
718 } |
|
719 break; |
|
720 } |
|
721 |
|
722 case ECreateNewTFTStep: |
|
723 { |
|
724 TInt err1st = aContext.FirstFilterV2(); |
|
725 if(err1st == KErrNone) |
|
726 { |
|
727 if (aContext.ContextType() != SpudMan::EMbms) |
|
728 { |
|
729 aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
730 } |
|
731 else |
|
732 { |
|
733 aContext.MbmsPacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
734 } |
|
735 aContext.SetStrategyStep (EAddTftStep); |
|
736 } |
|
737 else // done |
|
738 { |
|
739 // internal check |
|
740 ASSERT((aContext.TftRequested() <= aContext.TftInfo().FilterCount())); |
|
741 aContext.SetStrategyStep (EFinishStep); |
|
742 } |
|
743 |
|
744 break; |
|
745 } |
|
746 |
|
747 case EAddTftStep: |
|
748 { |
|
749 TInt errV2 = aContext.NextFilterV2(); |
|
750 if(errV2 == KErrNone) |
|
751 { |
|
752 if (aContext.ContextType() != SpudMan::EMbms) |
|
753 { |
|
754 aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
755 } |
|
756 else |
|
757 { |
|
758 aContext.MbmsPacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
759 } |
|
760 aContext.SetStrategyStep (EAddTftStep); |
|
761 } |
|
762 else // done |
|
763 { |
|
764 // internal check |
|
765 ASSERT((aContext.TftRequested() <= aContext.TftInfo().FilterCount())); |
|
766 aContext.SetStrategyStep (EFinishStep); |
|
767 } |
|
768 |
|
769 break; |
|
770 } |
|
771 |
|
772 default: |
|
773 // unexpected |
|
774 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
775 ASSERT(EFalse); |
|
776 err = KErrNotSupported; |
|
777 break; |
|
778 } |
|
779 |
|
780 if(err || (EFinishStep == aContext.StrategyStep())) |
|
781 { |
|
782 User::RequestComplete( aStatus, err); |
|
783 } |
|
784 |
|
785 } |
|
786 |
|
787 /** |
|
788 Notifies SPUD FSM about execution results. |
|
789 |
|
790 @param aContext - pdp context |
|
791 @param aCompletionStatus - completion request status |
|
792 */ |
|
793 void TSetTftStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
794 { |
|
795 if(aCompletionStatus == KErrNone) |
|
796 { |
|
797 SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftSet")); |
|
798 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftSet); |
|
799 } |
|
800 else |
|
801 { |
|
802 SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftSetFailed")); |
|
803 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftSetFailed, aCompletionStatus.Int()); |
|
804 } |
|
805 } |
|
806 |
|
807 /** Cancels last asynchronous request to eTel |
|
808 |
|
809 @param aContext - pdp context |
|
810 */ |
|
811 void TSetTftStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
812 { |
|
813 switch(aContext.StrategyStep()) |
|
814 { |
|
815 case ECreateNewTFTStep: |
|
816 { |
|
817 aContext.PacketQoS().CancelAsyncRequest(EPacketContextCreateNewTFT); |
|
818 SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextCreateNewTFT")); |
|
819 break; |
|
820 } |
|
821 |
|
822 case EAddTftStep: |
|
823 { |
|
824 aContext.PacketQoS().CancelAsyncRequest(EPacketContextAddPacketFilter); |
|
825 SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextAddPacketFilter")); |
|
826 break; |
|
827 } |
|
828 |
|
829 default: |
|
830 // unexpected |
|
831 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TSetTftStrategy::CancelAsyncRequest")); |
|
832 ASSERT(EFalse); |
|
833 break; |
|
834 } |
|
835 } |
|
836 |
|
837 |
|
838 // |
|
839 // TChangeTftStrategy |
|
840 // |
|
841 /** Executes next asynchronous step in a strategy. |
|
842 |
|
843 @param aContext - pdp context |
|
844 @param aStatus - request status of this step |
|
845 */ |
|
846 void TChangeTftStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
847 { |
|
848 SPUDTEL_FNLOG("TChangeTftStrategy::Next()"); |
|
849 |
|
850 TInt err = KErrNone; |
|
851 |
|
852 // special case. |
|
853 if(EStartStep == aContext.StrategyStep()) |
|
854 { |
|
855 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftOperationCode()); |
|
856 switch(aContext.TftOperationCode()) |
|
857 { |
|
858 case KAddFilters: |
|
859 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftInfo()); |
|
860 SPUDTELVERBOSE_INFO_LOG1(_L("TftOperationCode - Add Filters"), aContext.TftInfo().FilterCount()); |
|
861 aContext.SetStrategyStep (EAddFirstTftStep); |
|
862 break; |
|
863 |
|
864 case KRemoveFilters: |
|
865 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.TftInfo()); |
|
866 SPUDTELVERBOSE_INFO_LOG1(_L("TftOperationCode - Remove %d Filters"), aContext.TftInfo().FilterCount()); |
|
867 aContext.SetStrategyStep (ERemoveFirstTftStep); |
|
868 break; |
|
869 |
|
870 case KDeleteTFT: |
|
871 SPUDTELVERBOSE_INFO_LOG(_L("TftOperationCode - Delete TFT")); |
|
872 // delete old TFT |
|
873 aContext.PacketContext().DeleteTFT(*aStatus); |
|
874 aContext.SetStrategyStep (EDeleteTftStep); |
|
875 // DeleteTFT() ia an async operation => return |
|
876 return; |
|
877 |
|
878 default: |
|
879 // wrong case |
|
880 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
881 ASSERT(EFalse); |
|
882 err = KErrNotSupported; |
|
883 break; |
|
884 } |
|
885 } |
|
886 |
|
887 // possible steps: |
|
888 // -- delete TFT |
|
889 // -- add filters |
|
890 // -- remove filters |
|
891 if(!err) |
|
892 { |
|
893 switch(aContext.StrategyStep()) |
|
894 { |
|
895 case EDeleteTftStep: |
|
896 { |
|
897 aContext.SetStrategyStep (EChangeTftFinished); |
|
898 User::RequestComplete( aStatus, KErrNone); |
|
899 break; |
|
900 } |
|
901 |
|
902 case EAddFirstTftStep: |
|
903 { |
|
904 TInt errV2 = aContext.FirstFilterV2(); |
|
905 if(errV2 == KErrNone) |
|
906 { |
|
907 if (aContext.ContextType() == SpudMan::EMbms) |
|
908 { |
|
909 aContext.MbmsPacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
910 } |
|
911 else |
|
912 { |
|
913 aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
914 } |
|
915 aContext.SetStrategyStep (EAddTftStep); |
|
916 } |
|
917 else // done |
|
918 { |
|
919 aContext.SetStrategyStep (EChangeTftFinished); |
|
920 User::RequestComplete( aStatus, KErrNone); |
|
921 } |
|
922 |
|
923 break; |
|
924 } |
|
925 |
|
926 case EAddTftStep: |
|
927 { |
|
928 TInt errV2 = aContext.NextFilterV2(); |
|
929 if(errV2 == KErrNone) |
|
930 { |
|
931 if (aContext.ContextType() == SpudMan::EMbms) |
|
932 { |
|
933 aContext.MbmsPacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
934 } |
|
935 else |
|
936 { |
|
937 aContext.PacketContext().AddPacketFilter( *aStatus, aContext.FilterV2Pckg()); |
|
938 } |
|
939 aContext.SetStrategyStep (EAddTftStep); |
|
940 } |
|
941 else // done |
|
942 { |
|
943 aContext.SetStrategyStep (EChangeTftFinished); |
|
944 User::RequestComplete( aStatus, KErrNone); |
|
945 } |
|
946 |
|
947 break; |
|
948 } |
|
949 |
|
950 case ERemoveFirstTftStep: |
|
951 { |
|
952 TInt errV2 = aContext.FirstFilterV2(); |
|
953 if(errV2 == KErrNone) |
|
954 { |
|
955 if (aContext.ContextType() == SpudMan::EMbms) |
|
956 { |
|
957 aContext.MbmsPacketContext().RemovePacketFilter( *aStatus, aContext.FilterV2().iId); |
|
958 } |
|
959 else |
|
960 { |
|
961 aContext.PacketContext().RemovePacketFilter( *aStatus, aContext.FilterV2().iId); |
|
962 } |
|
963 aContext.SetStrategyStep (ERemoveTftStep); |
|
964 } |
|
965 else // done |
|
966 { |
|
967 aContext.SetStrategyStep (EChangeTftFinished); |
|
968 User::RequestComplete( aStatus, KErrNone); |
|
969 } |
|
970 |
|
971 break; |
|
972 } |
|
973 |
|
974 case ERemoveTftStep: |
|
975 { |
|
976 TInt errV2 = aContext.NextFilterV2(); |
|
977 if(errV2 == KErrNone) |
|
978 { |
|
979 if (aContext.ContextType() == SpudMan::EMbms) |
|
980 { |
|
981 aContext.MbmsPacketContext().RemovePacketFilter( *aStatus, aContext.FilterV2().iId); |
|
982 } |
|
983 else |
|
984 { |
|
985 aContext.PacketContext().RemovePacketFilter( *aStatus, aContext.FilterV2().iId); |
|
986 } |
|
987 aContext.SetStrategyStep (ERemoveTftStep); |
|
988 } |
|
989 else // done |
|
990 { |
|
991 aContext.SetStrategyStep (EChangeTftFinished); |
|
992 User::RequestComplete( aStatus, KErrNone); |
|
993 } |
|
994 |
|
995 break; |
|
996 } |
|
997 |
|
998 case EChangeTftFinished: |
|
999 { |
|
1000 aContext.SetStrategyStep (EFinishStep); |
|
1001 } |
|
1002 break; |
|
1003 |
|
1004 |
|
1005 default: |
|
1006 // unexpected |
|
1007 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1008 ASSERT(EFalse); |
|
1009 err = KErrNotSupported; |
|
1010 break; |
|
1011 } |
|
1012 } |
|
1013 |
|
1014 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1015 { |
|
1016 User::RequestComplete( aStatus, err); |
|
1017 } |
|
1018 |
|
1019 } |
|
1020 |
|
1021 |
|
1022 /** |
|
1023 Notifies SPUD FSM about execution results. |
|
1024 |
|
1025 @param aContext - pdp context |
|
1026 @param aCompletionStatus - completion request status |
|
1027 */ |
|
1028 void TChangeTftStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
1029 { |
|
1030 if(aCompletionStatus == KErrNone) |
|
1031 { |
|
1032 SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftChanged")); |
|
1033 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftChanged); |
|
1034 } |
|
1035 else |
|
1036 { |
|
1037 SPUDTEL_INFO_LOG(_L("Notifying FSM: ETftChangedFailed")); |
|
1038 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::ETftChangedFailed, aCompletionStatus.Int()); |
|
1039 } |
|
1040 } |
|
1041 |
|
1042 /** Cancels last asynchronous request to eTel |
|
1043 |
|
1044 @param aContext - pdp context |
|
1045 */ |
|
1046 void TChangeTftStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1047 { |
|
1048 switch(aContext.StrategyStep()) |
|
1049 { |
|
1050 case EDeleteTftStep: |
|
1051 { |
|
1052 SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextDeleteTFTCancel")); |
|
1053 aContext.PacketQoS().CancelAsyncRequest(EPacketContextDeleteTFTCancel); |
|
1054 break; |
|
1055 } |
|
1056 |
|
1057 case ERemoveTftStep: |
|
1058 { |
|
1059 SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextRemovePacketFilterCancel")); |
|
1060 aContext.PacketQoS().CancelAsyncRequest(EPacketContextRemovePacketFilterCancel); |
|
1061 break; |
|
1062 } |
|
1063 |
|
1064 case EAddTftStep: |
|
1065 { |
|
1066 SPUDTEL_INFO_LOG(_L("Cancel PacketQoS::EPacketContextAddPacketFilter")); |
|
1067 aContext.PacketQoS().CancelAsyncRequest(EPacketContextAddPacketFilterCancel); |
|
1068 break; |
|
1069 } |
|
1070 |
|
1071 default: |
|
1072 // unexpected |
|
1073 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TChangeTftStrategy::CancelAsyncRequest")); |
|
1074 ASSERT(EFalse); |
|
1075 break; |
|
1076 } |
|
1077 } |
|
1078 |
|
1079 |
|
1080 // |
|
1081 // TActivatePdpStrategy |
|
1082 // |
|
1083 /** Executes next asynchronous step in a strategy. |
|
1084 |
|
1085 @param aContext - pdp context |
|
1086 @param aStatus - request status of this step |
|
1087 */ |
|
1088 void TActivatePdpStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
1089 { |
|
1090 SPUDTEL_FNLOG("TActivatePdpStrategy::Next()"); |
|
1091 |
|
1092 TInt err = KErrNone; |
|
1093 |
|
1094 switch(aContext.StrategyStep()) |
|
1095 { |
|
1096 case EStartStep: |
|
1097 { |
|
1098 aContext.PacketContext().Activate(*aStatus); |
|
1099 aContext.SetStrategyStep (EActivateStep); |
|
1100 break; |
|
1101 } |
|
1102 |
|
1103 case EActivateStep: |
|
1104 { |
|
1105 aContext.PacketContext().GetStatus(aContext.ContextStatus()); |
|
1106 |
|
1107 switch (aContext.ContextStatus()) |
|
1108 { |
|
1109 case RPacketContext::EStatusActive: |
|
1110 // Context is now active |
|
1111 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.ContextPacketDataConfigBase()); |
|
1112 aContext.PacketContext().GetConfig (*aStatus, aContext.ContextConfig()); |
|
1113 aContext.SetStrategyStep (EGetConfigStep); |
|
1114 break; |
|
1115 |
|
1116 case RPacketContext::EStatusInactive: |
|
1117 { |
|
1118 // Context is inactive so find out why |
|
1119 TInt errTsy = KErrNone; |
|
1120 TInt rc = aContext.PacketContext().GetLastErrorCause(errTsy); |
|
1121 if (rc == KErrNone) |
|
1122 { |
|
1123 if (errTsy == KErrNone) |
|
1124 { |
|
1125 err = KErrNone; |
|
1126 } |
|
1127 else if ((errTsy & 0xFFFF0000) != 0xFFFF0000) |
|
1128 { |
|
1129 // TSY stores the basic error code to lower 16 bits and |
|
1130 // adds the extended error code to higher 16 bits. |
|
1131 // If extended error code is present, it is prefered. |
|
1132 err = (errTsy >> 16); |
|
1133 err = (err | 0xFFFF0000); |
|
1134 } |
|
1135 else |
|
1136 { |
|
1137 // Basic error only - returned by TSYs not supporting extended errors |
|
1138 err = errTsy; |
|
1139 } |
|
1140 } |
|
1141 else |
|
1142 { |
|
1143 err = KErrCompletion; |
|
1144 } |
|
1145 |
|
1146 aContext.SetStrategyStep (EFinishStep); |
|
1147 break; |
|
1148 } |
|
1149 |
|
1150 default: |
|
1151 // Not active, not inactive. Re-request the status and try again |
|
1152 aContext.PacketContext().NotifyStatusChange(*aStatus, aContext.ContextStatus()); |
|
1153 aContext.SetStrategyStep (EActivateStep); |
|
1154 break; |
|
1155 } |
|
1156 break; |
|
1157 } |
|
1158 |
|
1159 case EGetConfigStep: |
|
1160 { |
|
1161 aContext.PdpFsmInterface().Set (aContext.Id(), aContext.ContextPacketDataConfigBase()); |
|
1162 if (KPrimaryContextId == aContext.Id()) |
|
1163 { |
|
1164 aContext.PacketQoS().GetProfileParameters (*aStatus, aContext.QosNegotiatedPckg()); |
|
1165 #ifdef _DEBUG |
|
1166 aContext.DumpNegProfileParameters (); |
|
1167 #endif |
|
1168 aContext.SetStrategyStep (EGetProfileParamsStep); |
|
1169 } |
|
1170 else |
|
1171 { |
|
1172 // start notifications in case of normal creation of a context |
|
1173 // -- StatusChangeNotifier |
|
1174 // -- QoSChangeNotifier |
|
1175 // -- ConfigChangeNotifier |
|
1176 aContext.StartNotifications(); |
|
1177 aContext.SetStrategyStep (EFinishStep); |
|
1178 } |
|
1179 break; |
|
1180 } |
|
1181 |
|
1182 case EGetProfileParamsStep: |
|
1183 { |
|
1184 // start notifications in case of normal creation of a context |
|
1185 // -- StatusChangeNotifier |
|
1186 // -- QoSChangeNotifier |
|
1187 // -- ConfigChangeNotifier |
|
1188 aContext.StartNotifications(); |
|
1189 aContext.SetStrategyStep (EFinishStep); |
|
1190 break; |
|
1191 } |
|
1192 |
|
1193 default: |
|
1194 // unexpected |
|
1195 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1196 ASSERT(EFalse); |
|
1197 err = KErrNotSupported; |
|
1198 break; |
|
1199 } |
|
1200 |
|
1201 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1202 { |
|
1203 User::RequestComplete( aStatus, err); |
|
1204 } |
|
1205 |
|
1206 } |
|
1207 |
|
1208 |
|
1209 /** |
|
1210 Notifies SPUD FSM about execution results. |
|
1211 |
|
1212 @param aContext - pdp context |
|
1213 @param aCompletionStatus - completion request status |
|
1214 */ |
|
1215 void TActivatePdpStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
1216 { |
|
1217 if(aCompletionStatus == KErrNone) |
|
1218 { |
|
1219 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: DataChannelV2")); |
|
1220 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.DataChannelV2()); |
|
1221 |
|
1222 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
1223 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR5Negotiated")); |
|
1224 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR5()); |
|
1225 |
|
1226 #else |
|
1227 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR99_R4Negotiated")); |
|
1228 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR99_R4()); |
|
1229 #endif |
|
1230 // SYMBIAN_NETWORKING_UMTSR5 |
|
1231 |
|
1232 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpActivated")); |
|
1233 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpActivated); |
|
1234 |
|
1235 } |
|
1236 else |
|
1237 { |
|
1238 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpActivatedFailed")); |
|
1239 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpActivatedFailed, aCompletionStatus.Int()); |
|
1240 } |
|
1241 } |
|
1242 |
|
1243 /** Cancels last asynchronous request to eTel |
|
1244 |
|
1245 @param aContext - pdp context |
|
1246 */ |
|
1247 void TActivatePdpStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1248 { |
|
1249 switch(aContext.StrategyStep()) |
|
1250 { |
|
1251 case EActivateStep: |
|
1252 { |
|
1253 aContext.PacketContext().CancelAsyncRequest(EPacketContextActivate); |
|
1254 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextActivate")); |
|
1255 break; |
|
1256 } |
|
1257 |
|
1258 case EGetConfigStep: |
|
1259 { |
|
1260 aContext.PacketContext().CancelAsyncRequest(EGetConfigStep); |
|
1261 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EGetConfigStep")); |
|
1262 break; |
|
1263 } |
|
1264 |
|
1265 case EInitialiseContextStep: |
|
1266 { |
|
1267 aContext.PacketContext().CancelAsyncRequest(EPacketContextInitialiseContext); |
|
1268 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextInitialiseContext")); |
|
1269 break; |
|
1270 } |
|
1271 |
|
1272 case EGetProfileParamsStep: |
|
1273 { |
|
1274 if(KPrimaryContextId == aContext.Id()) |
|
1275 { |
|
1276 aContext.PacketContext().CancelAsyncRequest(EPacketQoSGetProfileParams); |
|
1277 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSGetProfileParams")); |
|
1278 break; |
|
1279 } |
|
1280 } |
|
1281 |
|
1282 default: |
|
1283 // unexpected |
|
1284 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TActivatePdpStrategy::CancelAsyncRequest")); |
|
1285 ASSERT(EFalse); |
|
1286 break; |
|
1287 } |
|
1288 } |
|
1289 |
|
1290 // |
|
1291 // TGetNegQoSStrategy |
|
1292 // |
|
1293 /** Executes next asynchronous step in a strategy. |
|
1294 |
|
1295 @param aContext - pdp context |
|
1296 @param aStatus - request status of this step |
|
1297 */ |
|
1298 void TGetNegQoSStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
1299 { |
|
1300 SPUDTEL_FNLOG("TGetNegQoSStrategy::Next()"); |
|
1301 |
|
1302 TInt err = KErrNone; |
|
1303 |
|
1304 switch(aContext.StrategyStep()) |
|
1305 { |
|
1306 case EStartStep: |
|
1307 { |
|
1308 aContext.PacketQoS().GetProfileParameters (*aStatus, aContext.QosNegotiatedPckg()); |
|
1309 #ifdef _DEBUG |
|
1310 aContext.DumpNegProfileParameters (); |
|
1311 #endif |
|
1312 aContext.SetStrategyStep (EGetProfileParamsStep); |
|
1313 break; |
|
1314 } |
|
1315 |
|
1316 case EGetProfileParamsStep: |
|
1317 { |
|
1318 aContext.SetStrategyStep (EFinishStep); |
|
1319 break; |
|
1320 } |
|
1321 |
|
1322 default: |
|
1323 // unexpected |
|
1324 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1325 ASSERT(EFalse); |
|
1326 err = KErrNotSupported; |
|
1327 break; |
|
1328 } |
|
1329 |
|
1330 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1331 { |
|
1332 User::RequestComplete( aStatus, err); |
|
1333 } |
|
1334 |
|
1335 } |
|
1336 |
|
1337 |
|
1338 /** |
|
1339 Notifies SPUD FSM about execution results. |
|
1340 |
|
1341 @param aContext - pdp context |
|
1342 @param aCompletionStatus - completion request status |
|
1343 */ |
|
1344 void TGetNegQoSStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
1345 { |
|
1346 if(aCompletionStatus == KErrNone) |
|
1347 { |
|
1348 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
1349 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR5Negotiated")); |
|
1350 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR5()); |
|
1351 |
|
1352 #else |
|
1353 // !SYMBIAN_NETWORKING_UMTSR5 |
|
1354 |
|
1355 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR99_R4Negotiated")); |
|
1356 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR99_R4()); |
|
1357 #endif |
|
1358 // SYMBIAN_NETWORKING_UMTSR5 |
|
1359 |
|
1360 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpNegQoSRetrieved")); |
|
1361 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpNegQoSRetrieved); |
|
1362 } |
|
1363 else |
|
1364 { |
|
1365 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpNegQoSRetrievedFailed")); |
|
1366 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpNegQoSRetrievedFailed, aCompletionStatus.Int()); |
|
1367 } |
|
1368 } |
|
1369 |
|
1370 /** Cancels last asynchronous request to eTel |
|
1371 |
|
1372 @param aContext - pdp context |
|
1373 */ |
|
1374 void TGetNegQoSStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1375 { |
|
1376 switch(aContext.StrategyStep()) |
|
1377 { |
|
1378 case EGetProfileParamsStep: |
|
1379 { |
|
1380 aContext.PacketContext().CancelAsyncRequest(EPacketQoSGetProfileParams); |
|
1381 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSGetProfileParams")); |
|
1382 break; |
|
1383 } |
|
1384 |
|
1385 default: |
|
1386 // unexpected |
|
1387 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TGetNegQoSStrategy::CancelAsyncRequest")); |
|
1388 ASSERT(EFalse); |
|
1389 break; |
|
1390 } |
|
1391 } |
|
1392 |
|
1393 |
|
1394 // |
|
1395 // TModifyActiveStrategy |
|
1396 // |
|
1397 /** Executes next asynchronous step in a strategy. |
|
1398 |
|
1399 @param aContext - pdp context |
|
1400 @param aStatus - request status of this step |
|
1401 */ |
|
1402 void TModifyActiveStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
1403 { |
|
1404 SPUDTEL_FNLOG("TModifyActiveStrategy::Next()"); |
|
1405 |
|
1406 TInt err = KErrNone; |
|
1407 |
|
1408 switch(aContext.StrategyStep()) |
|
1409 { |
|
1410 case EStartStep: |
|
1411 { |
|
1412 if (aContext.ContextType() != SpudMan::EMbms) |
|
1413 { |
|
1414 aContext.PacketContext().ModifyActiveContext(*aStatus); |
|
1415 aContext.SetStrategyStep (EModifyActiveStep); |
|
1416 } |
|
1417 else |
|
1418 { |
|
1419 aContext.MbmsPacketContext().ModifyActiveContext(*aStatus); |
|
1420 aContext.SetStrategyStep (EGetProfileParamsStep); |
|
1421 } |
|
1422 //aContext.SetStrategyStep (EModifyActiveStep); |
|
1423 break; |
|
1424 } |
|
1425 |
|
1426 case EModifyActiveStep: |
|
1427 { |
|
1428 aContext.PacketQoS().GetProfileParameters (*aStatus, aContext.QosNegotiatedPckg()); |
|
1429 #ifdef _DEBUG |
|
1430 aContext.DumpNegProfileParameters (); |
|
1431 #endif |
|
1432 aContext.SetStrategyStep (EGetProfileParamsStep); |
|
1433 break; |
|
1434 } |
|
1435 |
|
1436 case EGetProfileParamsStep: |
|
1437 { |
|
1438 aContext.SetStrategyStep (EFinishStep); |
|
1439 break; |
|
1440 } |
|
1441 |
|
1442 default: |
|
1443 // unexpected |
|
1444 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1445 ASSERT(EFalse); |
|
1446 err = KErrNotSupported; |
|
1447 break; |
|
1448 } |
|
1449 |
|
1450 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1451 { |
|
1452 User::RequestComplete( aStatus, err); |
|
1453 } |
|
1454 |
|
1455 } |
|
1456 |
|
1457 |
|
1458 /** |
|
1459 Notifies SPUD FSM about execution results. |
|
1460 |
|
1461 @param aContext - pdp context |
|
1462 @param aCompletionStatus - completion request status |
|
1463 */ |
|
1464 void TModifyActiveStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
1465 { |
|
1466 if(aCompletionStatus == KErrNone) |
|
1467 { |
|
1468 if(aContext.ContextType() != SpudMan::EMbms) |
|
1469 { |
|
1470 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
1471 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR5Negotiated")); |
|
1472 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR5()); |
|
1473 |
|
1474 #else |
|
1475 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: QoSR99_R4Negotiated")); |
|
1476 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.QosNegotiated().NegotiatedQoSR99_R4()); |
|
1477 #endif |
|
1478 // SYMBIAN_NETWORKING_UMTSR5 |
|
1479 } |
|
1480 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpContextModified")); |
|
1481 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpContextModified); |
|
1482 |
|
1483 } |
|
1484 else |
|
1485 { |
|
1486 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpContextModifiedFailed")); |
|
1487 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpContextModifiedFailed, aCompletionStatus.Int()); |
|
1488 } |
|
1489 } |
|
1490 |
|
1491 /** Cancels last asynchronous request to eTel |
|
1492 |
|
1493 @param aContext - pdp context |
|
1494 */ |
|
1495 void TModifyActiveStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1496 { |
|
1497 switch(aContext.StrategyStep()) |
|
1498 { |
|
1499 case EModifyActiveStep: |
|
1500 { |
|
1501 aContext.PacketContext().CancelAsyncRequest(EPacketContextModifyActiveContext); |
|
1502 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextModifyActiveContext")); |
|
1503 break; |
|
1504 } |
|
1505 |
|
1506 case EGetProfileParamsStep: |
|
1507 { |
|
1508 aContext.PacketContext().CancelAsyncRequest(EPacketQoSGetProfileParams); |
|
1509 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketQoSGetProfileParams")); |
|
1510 break; |
|
1511 } |
|
1512 |
|
1513 default: |
|
1514 // unexpected |
|
1515 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TModifyActiveStrategy::CancelAsyncRequest")); |
|
1516 ASSERT(EFalse); |
|
1517 break; |
|
1518 } |
|
1519 } |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 // |
|
1529 // TCreateMbmsPdpContextStrategy |
|
1530 // |
|
1531 /** Executes next asynchronous step in a strategy. |
|
1532 |
|
1533 @param aContext - pdp context |
|
1534 @param aStatus - request status of this step |
|
1535 */ |
|
1536 void TCreateMbmsPdpContextStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
1537 { |
|
1538 SPUDTEL_FNLOG("TCreateMbmsPdpContextStrategy::Next()"); |
|
1539 |
|
1540 TInt err = KErrNone; |
|
1541 |
|
1542 // possible steps: |
|
1543 // -- open new context |
|
1544 // -- Set session information |
|
1545 // -- initialise context |
|
1546 switch(aContext.StrategyStep()) |
|
1547 { |
|
1548 case EStartStep: |
|
1549 { |
|
1550 err = aContext.MbmsPacketContext().OpenNewContext (aContext.PacketService(), aContext.Name()); |
|
1551 if (err) |
|
1552 { |
|
1553 SPUDTEL_ERROR_LOG(_L("PacketContextOpenNewContext returned for MBMS %d"), err); |
|
1554 break; |
|
1555 } |
|
1556 |
|
1557 aContext.MbmsPacketContext().InitialiseContext(*aStatus, aContext.DataChannelV2Pckg()); |
|
1558 aContext.SetStrategyStep (EInitialiseContextStep); |
|
1559 break; |
|
1560 } |
|
1561 |
|
1562 case EInitialiseContextStep: |
|
1563 { |
|
1564 // get mbms packet config from fsm |
|
1565 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.ContextConfigMbms()); |
|
1566 // async set config |
|
1567 aContext.MbmsPacketContext().SetConfig (*aStatus, aContext.ContextConfigMbmsPckg()); |
|
1568 // set next step |
|
1569 aContext.SetStrategyStep (ESetConfigStep); |
|
1570 break; |
|
1571 } |
|
1572 case ESetConfigStep: |
|
1573 aContext.SetStrategyStep (EFinishStep); |
|
1574 break; |
|
1575 |
|
1576 default: |
|
1577 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1578 ASSERT(EFalse); |
|
1579 err = KErrNotSupported; |
|
1580 break; |
|
1581 } |
|
1582 |
|
1583 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1584 { |
|
1585 User::RequestComplete( aStatus, err); |
|
1586 } |
|
1587 |
|
1588 } |
|
1589 |
|
1590 |
|
1591 /** |
|
1592 Notifies SPUD FSM about execution results. |
|
1593 |
|
1594 @param aContext - pdp context |
|
1595 @param aCompletionStatus - completion request status |
|
1596 */ |
|
1597 void TCreateMbmsPdpContextStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus) |
|
1598 { |
|
1599 if(aCompletionStatus == KErrNone) |
|
1600 { |
|
1601 SPUDTEL_INFO_LOG(_L("Notifying FSM: EMbmsPdpContextCreated")); |
|
1602 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EMbmsPdpContextCreated); |
|
1603 } |
|
1604 else |
|
1605 { |
|
1606 SPUDTEL_INFO_LOG(_L("Notifying FSM: E1ryPdpContextCreatedFailed")); |
|
1607 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EMbmsPdpContextCreatedFailed, aCompletionStatus.Int()); |
|
1608 } |
|
1609 } |
|
1610 |
|
1611 /** Cancels last asynchronous request to eTel |
|
1612 |
|
1613 @param aContext - pdp context |
|
1614 */ |
|
1615 void TCreateMbmsPdpContextStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1616 { |
|
1617 SPUDTEL_FNLOG("TCreate1ryPdpContextStrategy::CancelAsyncRequest()"); |
|
1618 |
|
1619 switch(aContext.StrategyStep()) |
|
1620 { |
|
1621 case ESetConfigStep: |
|
1622 { |
|
1623 SPUDTEL_INFO_LOG(_L("Cancel PacketContext::EPacketContextSetConfig")); |
|
1624 aContext.PacketContext().CancelAsyncRequest(EPacketContextSetConfig); |
|
1625 break; |
|
1626 } |
|
1627 |
|
1628 default: |
|
1629 // there're NO outstanding async requests |
|
1630 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1631 ASSERT(EFalse); |
|
1632 break; |
|
1633 } |
|
1634 } |
|
1635 |
|
1636 |
|
1637 // |
|
1638 // TActivatePdpStrategy |
|
1639 // |
|
1640 /** Executes next asynchronous step in a strategy. |
|
1641 |
|
1642 @param aContext - pdp context |
|
1643 @param aStatus - request status of this step |
|
1644 */ |
|
1645 void TActivateMbmsPdpStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
1646 { |
|
1647 SPUDTEL_FNLOG("TActivatePdpStrategy::Next()"); |
|
1648 |
|
1649 TInt err = KErrNone; |
|
1650 |
|
1651 switch(aContext.StrategyStep()) |
|
1652 { |
|
1653 case EStartStep: |
|
1654 { |
|
1655 aContext.MbmsPacketContext().Activate(*aStatus); |
|
1656 aContext.SetStrategyStep (EActivateStep); |
|
1657 break; |
|
1658 } |
|
1659 |
|
1660 case EActivateStep: |
|
1661 { |
|
1662 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.ContextConfigMbms()); |
|
1663 aContext.MbmsPacketContext().GetConfig (*aStatus, aContext.ContextConfigMbmsPckg()); |
|
1664 aContext.SetStrategyStep (EGetConfigStep); |
|
1665 break; |
|
1666 } |
|
1667 |
|
1668 case EGetConfigStep: |
|
1669 { |
|
1670 aContext.PdpFsmInterface().Set (aContext.Id(), aContext.ContextConfigMbms()); |
|
1671 aContext.MbmsPacketContext().InitialiseContext(*aStatus, aContext.DataChannelV2Pckg()); |
|
1672 aContext.SetStrategyStep (EGetProfileParamsStep); |
|
1673 break; |
|
1674 } |
|
1675 |
|
1676 |
|
1677 case EGetProfileParamsStep: |
|
1678 { |
|
1679 // start notifications in case of normal creation of a context |
|
1680 // -- StatusChangeNotifier |
|
1681 // -- QoSChangeNotifier |
|
1682 // -- ConfigChangeNotifier |
|
1683 aContext.StartNotifications(); |
|
1684 aContext.SetStrategyStep (EFinishStep); |
|
1685 break; |
|
1686 } |
|
1687 |
|
1688 default: |
|
1689 // unexpected |
|
1690 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case")); |
|
1691 ASSERT(EFalse); |
|
1692 err = KErrNotSupported; |
|
1693 break; |
|
1694 } |
|
1695 |
|
1696 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1697 { |
|
1698 User::RequestComplete( aStatus, err); |
|
1699 } |
|
1700 |
|
1701 } |
|
1702 |
|
1703 |
|
1704 /** |
|
1705 Notifies SPUD FSM about execution results. |
|
1706 |
|
1707 @param aContext - pdp context |
|
1708 @param aCompletionStatus - completion request status |
|
1709 */ |
|
1710 void TActivateMbmsPdpStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
1711 { |
|
1712 if(aCompletionStatus == KErrNone) |
|
1713 { |
|
1714 SPUDTELVERBOSE_INFO_LOG(_L("FSM set: DataChannelV2")); |
|
1715 aContext.PdpFsmInterface().Set(aContext.Id(), aContext.DataChannelV2()); |
|
1716 |
|
1717 |
|
1718 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpActivated")); |
|
1719 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpActivated); |
|
1720 } |
|
1721 else |
|
1722 { |
|
1723 SPUDTEL_INFO_LOG(_L("Notifying FSM: EPdpActivatedFailed")); |
|
1724 aContext.PdpFsmInterface().Input(aContext.Id(), PdpFsm::EPdpActivatedFailed, aCompletionStatus.Int()); |
|
1725 } |
|
1726 } |
|
1727 |
|
1728 /** Cancels last asynchronous request to eTel |
|
1729 |
|
1730 @param aContext - pdp context |
|
1731 */ |
|
1732 void TActivateMbmsPdpStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1733 { |
|
1734 switch(aContext.StrategyStep()) |
|
1735 { |
|
1736 case EActivateStep: |
|
1737 { |
|
1738 aContext.MbmsPacketContext().CancelAsyncRequest(EPacketContextActivate); |
|
1739 SPUDTEL_INFO_LOG(_L("Cancel MbmsPacketContext::EPacketContextActivate")); |
|
1740 break; |
|
1741 } |
|
1742 |
|
1743 case EGetConfigStep: |
|
1744 { |
|
1745 aContext.MbmsPacketContext().CancelAsyncRequest(EGetConfigStep); |
|
1746 SPUDTEL_INFO_LOG(_L("Cancel MbmsPacketContext::EGetConfigStep")); |
|
1747 break; |
|
1748 } |
|
1749 |
|
1750 case EInitialiseContextStep: |
|
1751 { |
|
1752 aContext.MbmsPacketContext().CancelAsyncRequest(EPacketContextInitialiseContext); |
|
1753 SPUDTEL_INFO_LOG(_L("Cancel MbmsPacketContext::EPacketContextInitialiseContext")); |
|
1754 break; |
|
1755 } |
|
1756 |
|
1757 |
|
1758 default: |
|
1759 // unexpected |
|
1760 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TActivatePdpStrategy::CancelAsyncRequest")); |
|
1761 ASSERT(EFalse); |
|
1762 break; |
|
1763 } |
|
1764 } |
|
1765 |
|
1766 // |
|
1767 // TMbmsSessionUpdatePdpStrategy |
|
1768 // |
|
1769 /** Executes next asynchronous step in a strategy. |
|
1770 |
|
1771 @param aContext - pdp context |
|
1772 @param aStatus - request status of this step |
|
1773 */ |
|
1774 void TMbmsSessionUpdateStrategy::Next(CEtelDriverContext& aContext, TRequestStatus* aStatus) |
|
1775 { |
|
1776 SPUDTEL_FNLOG("TMbmsSessionUpdateStrategy::Next()"); |
|
1777 |
|
1778 TInt err = KErrNone; |
|
1779 switch(aContext.StrategyStep()) |
|
1780 { |
|
1781 case EStartStep: |
|
1782 { |
|
1783 TInt sessionId=KErrNotFound; |
|
1784 aContext.PdpFsmInterface().Get (aContext.Id(), aContext.GetSessionInfo()); |
|
1785 TSessionOperatioInfo sessionInfo = aContext.GetSessionInfo(); |
|
1786 TInt count=sessionInfo.iSessionIds.Count(); |
|
1787 TInt curSessionIndex = aContext.GetSessionIndex(); |
|
1788 if (curSessionIndex < count ) |
|
1789 { |
|
1790 sessionId = sessionInfo.iSessionIds[curSessionIndex]; |
|
1791 aContext.SetSessionIndex(++curSessionIndex); |
|
1792 } |
|
1793 if (curSessionIndex>=count) |
|
1794 { |
|
1795 aContext.SetStrategyStep (EUpdateMbmsSessionList);//move to next strategy otherwise service next entry in session list |
|
1796 aContext.SetSessionIndex(0); //reset index |
|
1797 } |
|
1798 if ((sessionInfo.iOperation == CSubConMBMSExtensionParamSet::EAddSession) |
|
1799 && (sessionId != KErrNotFound)) |
|
1800 { |
|
1801 aContext.MbmsPacketContext().UpdateMbmsSessionList(*aStatus,EAddEntries,sessionId); |
|
1802 break; |
|
1803 } |
|
1804 else if ((sessionInfo.iOperation == CSubConMBMSExtensionParamSet::ERemoveSession) |
|
1805 && (sessionId != KErrNotFound)) |
|
1806 { |
|
1807 aContext.MbmsPacketContext().UpdateMbmsSessionList(*aStatus,ERemoveEntries,sessionId); |
|
1808 break; |
|
1809 } |
|
1810 else if ((sessionInfo.iOperation == CSubConMBMSExtensionParamSet::ERemoveAll) |
|
1811 && (sessionId != KErrNotFound)) |
|
1812 { |
|
1813 aContext.MbmsPacketContext().UpdateMbmsSessionList(*aStatus,ERemoveAllEntries,sessionId); |
|
1814 aContext.SetStrategyStep(EUpdateMbmsSessionList); |
|
1815 break; |
|
1816 } |
|
1817 //proper session operation is not supplied or the list is empty.. |
|
1818 // ..so return parameter rejected event |
|
1819 else |
|
1820 { |
|
1821 aContext.SetStrategyStep (EFinishStep); |
|
1822 err=KErrNotSupported; |
|
1823 break; |
|
1824 } |
|
1825 |
|
1826 } |
|
1827 |
|
1828 case EUpdateMbmsSessionList: |
|
1829 { |
|
1830 TRAP_IGNORE(aContext.SetMbmsSession(RPacketMbmsContext::CMbmsSession::NewL())); |
|
1831 TRAP_IGNORE(aContext.SetRetrievePcktMbmsSessionList(CRetrievePcktMbmsSessionList::NewL(aContext.MbmsPacketContext(),*aContext.MbmsSession()))); |
|
1832 aContext.RetrievePcktMbmsSessionList()->Start(*aStatus); |
|
1833 aContext.SetStrategyStep(EPrepareSessionList); |
|
1834 break; |
|
1835 } |
|
1836 |
|
1837 case EPrepareSessionList: |
|
1838 { |
|
1839 RPacketMbmsContext::CMbmsSession *mbmsSession = aContext.MbmsSession(); |
|
1840 if (mbmsSession) |
|
1841 { |
|
1842 TSessionOperatioInfo sessionInfo; |
|
1843 sessionInfo.iSessionIds = mbmsSession->iSessionIdList; |
|
1844 sessionInfo.iOperation = aContext.GetSessionInfo().iOperation; |
|
1845 aContext.PdpFsmInterface().Set (aContext.Id(), sessionInfo); |
|
1846 CRetrievePcktMbmsSessionList *retrievePktMbmsSessionList=aContext.RetrievePcktMbmsSessionList(); |
|
1847 delete retrievePktMbmsSessionList; |
|
1848 delete mbmsSession; //no need to close sessionInfo.iSessionIds..it will be delted by this delete |
|
1849 aContext.SetMbmsSession(NULL); |
|
1850 aContext.SetRetrievePcktMbmsSessionList(NULL); |
|
1851 } |
|
1852 aContext.SetStrategyStep(EFinishStep); |
|
1853 break; |
|
1854 } |
|
1855 |
|
1856 default: |
|
1857 CRetrievePcktMbmsSessionList *retrievePktMbmsSessionList=aContext.RetrievePcktMbmsSessionList(); |
|
1858 if (retrievePktMbmsSessionList) |
|
1859 delete retrievePktMbmsSessionList; |
|
1860 RPacketMbmsContext::CMbmsSession *mbmsSession = aContext.MbmsSession(); |
|
1861 if (mbmsSession) |
|
1862 delete mbmsSession; |
|
1863 aContext.SetMbmsSession(NULL); |
|
1864 aContext.SetRetrievePcktMbmsSessionList(NULL); |
|
1865 break; |
|
1866 } |
|
1867 if(err || (EFinishStep == aContext.StrategyStep())) |
|
1868 { |
|
1869 User::RequestComplete( aStatus, err); |
|
1870 } |
|
1871 |
|
1872 } |
|
1873 |
|
1874 /** |
|
1875 Notifies SPUD FSM about execution results. |
|
1876 |
|
1877 @param aContext - pdp context |
|
1878 @param aCompletionStatus - completion request status |
|
1879 */ |
|
1880 void TMbmsSessionUpdateStrategy::NotifyFsm(CEtelDriverContext& aContext, TRequestStatus& aCompletionStatus ) |
|
1881 { |
|
1882 if(aCompletionStatus == KErrNone) |
|
1883 { |
|
1884 SPUDTEL_INFO_LOG(_L("Notifying FSM: TMbmsSessionUpdateStrategy")); |
|
1885 aContext.PdpFsmInterface().Input(aContext.Id(), SpudMan::EMbmsParameterUpdate); |
|
1886 } |
|
1887 else |
|
1888 { |
|
1889 SPUDTEL_INFO_LOG(_L("Notifying FSM: TMbmsSessionUpdateStrategy")); |
|
1890 aContext.PdpFsmInterface().Input(aContext.Id(), SpudMan::EMbmsParameterUpdate, aCompletionStatus.Int()); |
|
1891 } |
|
1892 } |
|
1893 /** Cancels last asynchronous request to eTel |
|
1894 |
|
1895 @param aContext - mbms context |
|
1896 */ |
|
1897 void TMbmsSessionUpdateStrategy::CancelAsyncRequest(CEtelDriverContext& aContext) |
|
1898 { |
|
1899 |
|
1900 switch(aContext.StrategyStep()) |
|
1901 { |
|
1902 case EUpdateMbmsSessionList: |
|
1903 { |
|
1904 aContext.MbmsPacketContext().CancelAsyncRequest(EPacketContextSetConfig); |
|
1905 SPUDTEL_INFO_LOG(_L("Cancel MbmsPacketContext::EUpdateMbmsSessionList")); |
|
1906 break; |
|
1907 } |
|
1908 |
|
1909 case EPrepareSessionList: |
|
1910 { |
|
1911 aContext.MbmsPacketContext().CancelAsyncRequest(EPacketContextSetConfig); |
|
1912 SPUDTEL_INFO_LOG(_L("Cancel MbmsPacketContext::EPrepareSessionList")); |
|
1913 break; |
|
1914 } |
|
1915 |
|
1916 default: |
|
1917 // unexpected |
|
1918 SPUDTEL_ERROR_LOG0(_L("ERROR: Incorrect case in TMbmsSessionUpdateStrategy::CancelAsyncRequest")); |
|
1919 ASSERT(EFalse); |
|
1920 break; |
|
1921 } |
|
1922 |
|
1923 } |