|
1 /* |
|
2 * Copyright (c) 2008-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: S60 MCPR's activities. |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file s60mcpractivities.h |
|
20 S60 MCPR's activities. |
|
21 */ |
|
22 |
|
23 #ifndef S60MCPR_ACTIVITIES_H |
|
24 #define S60MCPR_ACTIVITIES_H |
|
25 |
|
26 #include <comms-infras/mobilitymcpractivities.h> |
|
27 |
|
28 #include "s60mcprstates.h" |
|
29 |
|
30 // Forward declarations |
|
31 class CS60MetaConnectionProvider; |
|
32 |
|
33 enum TS60MCprActivities |
|
34 { |
|
35 ECFActivityS60McprServiceIdMessage2Handler = ESock::ECFActivityCustom + 10 |
|
36 }; |
|
37 |
|
38 /** |
|
39 * S60MCprActivities namespace contains the |
|
40 * definition of S60MCPR's activity map. |
|
41 */ |
|
42 namespace S60MCprActivities |
|
43 { |
|
44 DECLARE_ACTIVITY_MAP(S60MCprActivityMap) |
|
45 } // namespace S60MCprActivities |
|
46 |
|
47 |
|
48 /** |
|
49 * S60MCprSelectActivity namespace packages the |
|
50 * S60 MCPR's connection selection activity related |
|
51 * states, transitions and forks. |
|
52 * |
|
53 * The activity doesn't need activity class because it |
|
54 * reuses the Symbian's core implementation for |
|
55 * selection. |
|
56 * |
|
57 */ |
|
58 namespace S60MCprSelectActivity |
|
59 { |
|
60 /** |
|
61 * Execution context definition for meshmachine activities. |
|
62 */ |
|
63 typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MobilityMCprStates::TContext> TContext; |
|
64 |
|
65 /** |
|
66 * STATE: Waits for valid select message. |
|
67 * @return ETrue if message is accepted. |
|
68 */ |
|
69 DECLARE_SMELEMENT_HEADER( TAwaitingSelectNextLayer, |
|
70 MeshMachine::TState<TContext>, |
|
71 NetStateMachine::MState, |
|
72 TContext) |
|
73 virtual TBool Accept(); |
|
74 DECLARE_SMELEMENT_FOOTER( TAwaitingSelectNextLayer ) |
|
75 |
|
76 /** |
|
77 * TRANSITION/ACTION: Makes the selection for next layer based on policy or other obtained preferences. |
|
78 */ |
|
79 DECLARE_SMELEMENT_HEADER( TSelectNextLayer, |
|
80 MeshMachine::TStateTransition<TContext>, |
|
81 NetStateMachine::MStateTransition, |
|
82 TContext ) |
|
83 virtual void DoL(); |
|
84 DECLARE_SMELEMENT_FOOTER( TSelectNextLayer ) |
|
85 |
|
86 /** |
|
87 * TRANSITION/ACTION: Requests PolicyServer for Best IAP. |
|
88 */ |
|
89 DECLARE_SMELEMENT_HEADER( TSimpleSelect, |
|
90 MeshMachine::TStateTransition<TContext>, |
|
91 NetStateMachine::MStateTransition, |
|
92 TContext ) |
|
93 virtual void DoL(); |
|
94 DECLARE_SMELEMENT_FOOTER( TSimpleSelect ) |
|
95 |
|
96 /** |
|
97 * STATE: Waits for PolicyServer response |
|
98 * @return ETrue if valid message policyresponse is received. |
|
99 */ |
|
100 DECLARE_SMELEMENT_HEADER( TAwaitingSimpleSelectComplete, |
|
101 MeshMachine::TState<TContext>, |
|
102 NetStateMachine::MState, |
|
103 TContext) |
|
104 virtual TBool Accept(); |
|
105 DECLARE_SMELEMENT_FOOTER( TAwaitingSimpleSelectComplete ) |
|
106 } |
|
107 |
|
108 /** |
|
109 * S60MCprSimpleSelectActivity namespace packages the |
|
110 * S60 MCPR's connection selection activity related |
|
111 * states, transitions and forks. |
|
112 * |
|
113 * The activity doesn't need activity class because it |
|
114 * reuses the Symbian's core implementation for |
|
115 * selection. |
|
116 * |
|
117 */ |
|
118 namespace S60MCprSimpleSelectActivity |
|
119 { |
|
120 /** |
|
121 * Execution context definition for meshmachine activities. |
|
122 */ |
|
123 typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MobilityMCprStates::TContext> TContext; |
|
124 /** |
|
125 * STATE: Waits for valid select message. |
|
126 * @return ETrue if message is accepted. |
|
127 */ |
|
128 DECLARE_SMELEMENT_HEADER( TAwaitingSelectNextLayer, |
|
129 MeshMachine::TState<TContext>, |
|
130 NetStateMachine::MState, |
|
131 TContext) |
|
132 virtual TBool Accept(); |
|
133 DECLARE_SMELEMENT_FOOTER( TAwaitingSelectNextLayer ) |
|
134 /** |
|
135 * TRANSITION/ACTION: Makes the selection for next layer based on policy or other obtained preferences. |
|
136 */ |
|
137 DECLARE_SMELEMENT_HEADER( TSelectNextLayer, |
|
138 MeshMachine::TStateTransition<TContext>, |
|
139 NetStateMachine::MStateTransition, |
|
140 TContext ) |
|
141 virtual void DoL(); |
|
142 DECLARE_SMELEMENT_FOOTER( TSelectNextLayer ) |
|
143 /** |
|
144 * TRANSITION/ACTION: Requests PolicyServer for Best IAP. |
|
145 */ |
|
146 DECLARE_SMELEMENT_HEADER( TChooseBestIAP, |
|
147 MeshMachine::TStateTransition<TContext>, |
|
148 NetStateMachine::MStateTransition, |
|
149 TContext ) |
|
150 virtual void DoL(); |
|
151 DECLARE_SMELEMENT_FOOTER( TChooseBestIAP ) |
|
152 /** |
|
153 * STATE: Waits for PolicyServer response |
|
154 * @return ETrue if valid message policyresponse is received. |
|
155 */ |
|
156 DECLARE_SMELEMENT_HEADER( TAwaitingChooseBestIAP, |
|
157 MeshMachine::TState<TContext>, |
|
158 NetStateMachine::MState, |
|
159 TContext) |
|
160 virtual TBool Accept(); |
|
161 DECLARE_SMELEMENT_FOOTER( TAwaitingChooseBestIAP ) |
|
162 /** |
|
163 * FORK/DECISION: Decides between three different activity execution paths: |
|
164 * 1. Request PolicyServer for connection preferences. |
|
165 * 2. Proceed and use existing connection preferences. |
|
166 * 3. Bypass selection and just mark new AP active. |
|
167 * @return TransitionTag of the selected transition. |
|
168 */ |
|
169 DECLARE_SMELEMENT_HEADER( TChooseBestIAPRequiredOrNoTagOrSetChosenApActive, |
|
170 MeshMachine::TStateFork<TContext>, |
|
171 NetStateMachine::MStateFork, |
|
172 TContext ) |
|
173 TInt TransitionTag(); |
|
174 DECLARE_SMELEMENT_FOOTER( TChooseBestIAPRequiredOrNoTagOrSetChosenApActive ) |
|
175 /** |
|
176 * FORK/DECISION: Decides between two different activity execution path. |
|
177 * 1. Mark new chose AP active. |
|
178 * 2. Reverse back to next layer tiermanager selection. |
|
179 * @return TransitionTag of the selected transition. |
|
180 */ |
|
181 DECLARE_SMELEMENT_HEADER( TSetChosenApActiveOrSelectedProviderBackward, |
|
182 MeshMachine::TStateFork<TContext>, |
|
183 NetStateMachine::MStateFork, |
|
184 TContext ) |
|
185 TInt TransitionTag(); |
|
186 DECLARE_SMELEMENT_FOOTER( TSetChosenApActiveOrSelectedProviderBackward ) |
|
187 /** |
|
188 * TRANSITION/ACTION: Marks the chosen AP active. |
|
189 * |
|
190 * Transition assumes that the chose AP is already bound to the MCPR |
|
191 * and will be found from the ServiceProvider -list. |
|
192 */ |
|
193 DECLARE_SMELEMENT_HEADER( TSetChosenApActive, |
|
194 MeshMachine::TStateTransition<TContext>, |
|
195 NetStateMachine::MStateTransition, |
|
196 TContext ) |
|
197 virtual void DoL(); |
|
198 DECLARE_SMELEMENT_FOOTER( TSetChosenApActive ) |
|
199 /** |
|
200 * CChooseBestIAPCb is a callback class that receives the policy server response |
|
201 * and converts PolicyResponse -event into meshmachine compatible message. |
|
202 * |
|
203 * PolicyServer wrapper API takes pointer of the class implementing the |
|
204 * MMPMPolicyRequestsUser -interface. The ownership is passed to the wrapper API |
|
205 * because the answer may be delayed and live longer than the execution context |
|
206 * of the MCPR. |
|
207 */ |
|
208 class CChooseBestIAPCb |
|
209 : public CBase, |
|
210 public MMPMPolicyRequestsUser |
|
211 { |
|
212 public: |
|
213 /** |
|
214 * C++ constructor. |
|
215 * |
|
216 * @param aNode reference to S60 MCPR running the Activity. |
|
217 * @param aActivity pointer to the Activity that requests for PolicyResponse. |
|
218 */ |
|
219 CChooseBestIAPCb( CS60MetaConnectionProvider& aNode, |
|
220 MeshMachine::CNodeActivityBase* aActivity ) |
|
221 : iNode(aNode) |
|
222 { |
|
223 iLastRequestOriginator.Open( aNode.SelfInterface(), |
|
224 Messages::TNodeCtxId( aActivity->ActivityId(), |
|
225 aNode.Id() )); |
|
226 } |
|
227 public: // From MMPMPolicyRequestsUser |
|
228 /** |
|
229 * Called when Policy Server responds to the request. |
|
230 * @param aCompletedRequest contains reference to answer from Policy Server. |
|
231 */ |
|
232 virtual void PolicyResponse( PolicyRequest& aCompletedRequest ); |
|
233 /** |
|
234 * Interface function that calls CBase-destructor |
|
235 */ |
|
236 virtual void Delete() { delete this; } |
|
237 protected: // From CBase |
|
238 /** |
|
239 * C++ destructor. |
|
240 */ |
|
241 virtual ~CChooseBestIAPCb() {} |
|
242 private: |
|
243 /** |
|
244 * Valid reference to CS60MetaConnectionProvider |
|
245 */ |
|
246 CS60MetaConnectionProvider& iNode; |
|
247 /** |
|
248 * Valid reference to request originator. |
|
249 */ |
|
250 Messages::RRequestOriginator iLastRequestOriginator; |
|
251 }; |
|
252 |
|
253 } // namespace S60MCprSimpleSelectActivity |
|
254 |
|
255 /** |
|
256 * S60MCprErrorRecoveryActivity namespace packages the |
|
257 * S60 MCPR's error recovery activity related |
|
258 * states, transitions and forks. |
|
259 */ |
|
260 namespace S60MCprErrorRecoveryActivity |
|
261 { |
|
262 /** |
|
263 * Execution context definition for meshmachine activities. |
|
264 */ |
|
265 typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MCprStates::TContext> TContext; |
|
266 /** |
|
267 * Mutex that blocks the activity during the mobility handshake. |
|
268 */ |
|
269 class THandshakingMobilityMutex |
|
270 { |
|
271 public: |
|
272 /** |
|
273 * @param aContext execution context. |
|
274 * @return ETrue if mobility handshake is in progress. |
|
275 */ |
|
276 static TBool IsBlocked(MeshMachine::TNodeContextBase& aContext); |
|
277 }; |
|
278 /** |
|
279 * Serialized state. |
|
280 * Idea is to wait in this state until the mobility handshake is done. |
|
281 */ |
|
282 DECLARE_SERIALIZABLE_STATE( TProcessErrorBlockedByMobilityHandshaking, |
|
283 THandshakingMobilityMutex, |
|
284 MeshMachine::TTag<S60MCprStates::KProcessError> ) |
|
285 |
|
286 /** |
|
287 * CS60ConnectionRecoveryActivity is the S60 version of the ErrorRecovery -activity |
|
288 * that is responsible to process connection errors whenever it happens. |
|
289 * |
|
290 * -jl- TODO Either finalize or remove S60CConnectionRecoveryActivity after EC158(?) |
|
291 */ |
|
292 class CS60ConnectionRecoveryActivity : public S60MCprStates::CS60ErrorRecoveryActivity |
|
293 { |
|
294 public: |
|
295 |
|
296 /** |
|
297 * Symbian two-phase constructor. |
|
298 */ |
|
299 static MeshMachine::CNodeActivityBase* NewL( const MeshMachine::TNodeActivity& aActivitySig, |
|
300 MeshMachine::AMMNodeBase& aNode ); |
|
301 /** |
|
302 * Sends response to request originators. |
|
303 */ |
|
304 void ReplyToOriginators( Messages::TEErrorRecovery::TErrorRecoveryResponse& aCFMessageSig ); |
|
305 |
|
306 protected: |
|
307 /** |
|
308 * Context definition |
|
309 */ |
|
310 typedef MeshMachine::TNodeContext<CMobilityMetaConnectionProvider, MCprStates::TContext> TContext; |
|
311 |
|
312 public: |
|
313 /** |
|
314 * STATE: Waits for reconnect activity to complete. |
|
315 */ |
|
316 DECLARE_SMELEMENT_HEADER( TAwaitingReConnectComplete, |
|
317 MeshMachine::TState<TContext>, |
|
318 NetStateMachine::MState, |
|
319 TContext ) |
|
320 virtual TBool Accept(); |
|
321 DECLARE_SMELEMENT_FOOTER( TAwaitingReConnectComplete ) |
|
322 /** |
|
323 * TTransitionBase from Symbian error recovery |
|
324 */ |
|
325 class TTransitionBase : public MeshMachine::TStateTransition<TContext> |
|
326 { |
|
327 public: |
|
328 TTransitionBase( TContext& aContext ) |
|
329 : MeshMachine::TStateTransition<TContext>(aContext) { /*EMPTY*/ } |
|
330 virtual void Error(TInt aError); |
|
331 }; |
|
332 /** |
|
333 * TRANSITION/ACTION: Stores error context. |
|
334 */ |
|
335 DECLARE_SMELEMENT_HEADER( TStoreErrorContext, |
|
336 CS60ConnectionRecoveryActivity::TTransitionBase, |
|
337 NetStateMachine::MStateTransition, |
|
338 TContext ) |
|
339 virtual void DoL(); |
|
340 DECLARE_SMELEMENT_FOOTER( TStoreErrorContext ) |
|
341 /** |
|
342 * TRANSITION/ACTION: Sends RETRY as RecoveryResponse |
|
343 */ |
|
344 DECLARE_SMELEMENT_HEADER( TSendRetryRecoveryResponse, |
|
345 CS60ConnectionRecoveryActivity::TTransitionBase, |
|
346 NetStateMachine::MStateTransition, |
|
347 TContext ) |
|
348 virtual void DoL(); |
|
349 DECLARE_SMELEMENT_FOOTER( TSendRetryRecoveryResponse ) |
|
350 /** |
|
351 * TRANSITION/ACTION: Sends PROPAGATE as RecoveryResponse |
|
352 */ |
|
353 |
|
354 DECLARE_SMELEMENT_HEADER( TSendPropagateRecoveryResponse, |
|
355 CS60ConnectionRecoveryActivity::TTransitionBase, |
|
356 NetStateMachine::MStateTransition, |
|
357 TContext) |
|
358 virtual void DoL(); |
|
359 DECLARE_SMELEMENT_FOOTER( TSendPropagateRecoveryResponse ) |
|
360 |
|
361 protected: |
|
362 /** |
|
363 * C++ constructor. |
|
364 */ |
|
365 CS60ConnectionRecoveryActivity( const MeshMachine::TNodeActivity& aActivitySig, |
|
366 MeshMachine::AMMNodeBase& aNode ); |
|
367 }; |
|
368 |
|
369 /** |
|
370 * TRANSITION/ACTION: Sends IGNORE as RecoveryResponse |
|
371 */ |
|
372 DECLARE_SMELEMENT_HEADER( TSendIgnoreRecoveryResponse, |
|
373 MeshMachine::TStateTransition<TContext>, |
|
374 NetStateMachine::MStateTransition, |
|
375 TContext ) |
|
376 virtual void DoL(); |
|
377 DECLARE_SMELEMENT_FOOTER( TSendIgnoreRecoveryResponse ) |
|
378 |
|
379 /** |
|
380 * STATE: Wait for valid error recovery request. |
|
381 */ |
|
382 DECLARE_SMELEMENT_HEADER( TAwaitingNotGoneDownErrorRecoveryRequest, |
|
383 MeshMachine::TState<TContext>, |
|
384 NetStateMachine::MState, |
|
385 TContext ) |
|
386 virtual TBool Accept(); |
|
387 DECLARE_SMELEMENT_FOOTER( TAwaitingNotGoneDownErrorRecoveryRequest ) |
|
388 |
|
389 |
|
390 /** |
|
391 * FORK/DECISION: Decides between three different activity execution paths: |
|
392 * 1. Continue to next transition. ( reselection of AP ) |
|
393 * 2. Sendiong of IGNORE to originators. |
|
394 * 3. Error handling. |
|
395 * @return TransitionTag of the selected transition. |
|
396 */ |
|
397 DECLARE_SMELEMENT_HEADER( TNoTagOrIgnoreErrorOrErrorTag, |
|
398 MeshMachine::TStateFork<TContext>, |
|
399 NetStateMachine::MStateFork, |
|
400 TContext ) |
|
401 TInt TransitionTag(); |
|
402 DECLARE_SMELEMENT_FOOTER( TNoTagOrIgnoreErrorOrErrorTag ) |
|
403 |
|
404 /** |
|
405 * FORK/DECISION: Decides between three different activity execution paths: |
|
406 * 1. Continue to next transition. ( selection of IAP ) |
|
407 * 2. Retrying of currently bound MCPR |
|
408 * 3. Error handling |
|
409 * @return TransitionTag of the selected transition. |
|
410 */ |
|
411 DECLARE_SMELEMENT_HEADER( TNoTagOrRetryConnectionTagOrErrorTag, |
|
412 MeshMachine::TStateFork<TContext>, |
|
413 NetStateMachine::MStateFork, |
|
414 TContext ) |
|
415 TInt TransitionTag(); |
|
416 DECLARE_SMELEMENT_FOOTER( TNoTagOrRetryConnectionTagOrErrorTag ) |
|
417 |
|
418 /** |
|
419 * FORK/DECISION: Decides between two different activity execution paths: |
|
420 * 1. Retrying of currently bound MCPR |
|
421 * 2. Error handling through process error |
|
422 * @return TransitionTag of the selected transition. |
|
423 */ |
|
424 DECLARE_SMELEMENT_HEADER( TRetryConnectionOrProcessErrorTagBackward, |
|
425 MeshMachine::TStateFork<TContext>, |
|
426 NetStateMachine::MStateFork, |
|
427 TContext ) |
|
428 TInt TransitionTag(); |
|
429 DECLARE_SMELEMENT_FOOTER( TRetryConnectionOrProcessErrorTagBackward ) |
|
430 |
|
431 /** |
|
432 * FORK/DECISION: Decides between two different activity execution paths: |
|
433 * 1. Error handling through process error |
|
434 * 2. Else continue |
|
435 * @return TransitionTag of the selected transition. |
|
436 */ |
|
437 DECLARE_SMELEMENT_HEADER( TNoTagOrProcessErrorBackwardTag, |
|
438 MeshMachine::TStateFork<TContext>, |
|
439 NetStateMachine::MStateFork, |
|
440 TContext ) |
|
441 TInt TransitionTag(); |
|
442 DECLARE_SMELEMENT_FOOTER( TNoTagOrProcessErrorBackwardTag ) |
|
443 |
|
444 } // namespace S60MCprErrorRecoveryActivity |
|
445 |
|
446 /** |
|
447 * S60MCprMobilityActivity namespace packages the |
|
448 * S60 MCPR's mobility activity related |
|
449 * states, transitions and forks. |
|
450 */ |
|
451 namespace S60MCprMobilityActivity |
|
452 { |
|
453 /** |
|
454 * Execution context definition for meshmachine activities. |
|
455 */ |
|
456 typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MCprStates::TContext> TContext; |
|
457 |
|
458 /** |
|
459 * TRANSITION/ACTION: Does nothing or resends the earlier received notification. |
|
460 */ |
|
461 DECLARE_SMELEMENT_HEADER( TDoNothingOrReSendPendingNotification, |
|
462 MeshMachine::TStateTransition<TContext>, |
|
463 NetStateMachine::MStateTransition, |
|
464 TContext ) |
|
465 virtual void DoL(); |
|
466 DECLARE_SMELEMENT_FOOTER( TDoNothingOrReSendPendingNotification ) |
|
467 |
|
468 /** |
|
469 * TRANSITION/ACTION: Responds back to IPCPR that mobility session has been started. |
|
470 */ |
|
471 DECLARE_SMELEMENT_HEADER( TReplyMobilityStarted, |
|
472 MeshMachine::TStateTransition<TContext>, |
|
473 NetStateMachine::MStateTransition, |
|
474 TContext ) |
|
475 virtual void DoL(); |
|
476 DECLARE_SMELEMENT_FOOTER( TReplyMobilityStarted ) |
|
477 |
|
478 /** |
|
479 * TRANSITION/ACTION: Registers to preferred carrier notifications. |
|
480 */ |
|
481 DECLARE_SMELEMENT_HEADER( TSendAvailabilityRequest, |
|
482 MeshMachine::TStateTransition<TContext>, |
|
483 NetStateMachine::MStateTransition, |
|
484 TContext ) |
|
485 virtual void DoL(); |
|
486 DECLARE_SMELEMENT_FOOTER( TSendAvailabilityRequest ) |
|
487 |
|
488 /** |
|
489 * TRANSITION/ACTION: Application rejects active carrier. |
|
490 */ |
|
491 DECLARE_SMELEMENT_HEADER( TSendInitialApplicationReject, |
|
492 MeshMachine::TStateTransition<TContext>, |
|
493 NetStateMachine::MStateTransition, |
|
494 TContext ) |
|
495 virtual void DoL(); |
|
496 DECLARE_SMELEMENT_FOOTER( TSendInitialApplicationReject ) |
|
497 |
|
498 /** |
|
499 * STATE: Waits for TStartMobility message. |
|
500 * @return ETrue if message is valid. |
|
501 */ |
|
502 DECLARE_SMELEMENT_HEADER( TAwaitingStartMobility, |
|
503 MeshMachine::TState<TContext>, |
|
504 NetStateMachine::MState, |
|
505 TContext) |
|
506 virtual TBool Accept(); |
|
507 DECLARE_SMELEMENT_FOOTER( TAwaitingStartMobility ) |
|
508 |
|
509 /** |
|
510 * STATE: Waits for TAwaitingMigrationRequestedOrRejectedOrCancel. |
|
511 * @return ETrue if message is valid either of those or cancel. |
|
512 */ |
|
513 DECLARE_SMELEMENT_HEADER( TAwaitingMigrationRequestedOrRejectedOrCancel, |
|
514 MeshMachine::TState<TContext>, |
|
515 NetStateMachine::MState, |
|
516 TContext) |
|
517 virtual TBool Accept(); |
|
518 DECLARE_SMELEMENT_FOOTER( TAwaitingMigrationRequestedOrRejectedOrCancel ) |
|
519 |
|
520 /** |
|
521 * STATE: Watis for application response. |
|
522 * @return ETrue if Migration Accepted or Rejected. |
|
523 */ |
|
524 DECLARE_SMELEMENT_HEADER( TAwaitingMigrationAcceptedOrRejectedOrCancel, |
|
525 MeshMachine::TState<TContext>, |
|
526 NetStateMachine::MState, |
|
527 TContext ) |
|
528 virtual TBool Accept(); |
|
529 DECLARE_SMELEMENT_FOOTER( TAwaitingMigrationAcceptedOrRejectedOrCancel ) |
|
530 |
|
531 /** |
|
532 * FORK/DECISION: Returns the KStartMobilityHandshake backwards or error |
|
533 * @return KStartMobilityHandshake backwards or error |
|
534 */ |
|
535 DECLARE_SMELEMENT_HEADER( TStartMobilityHandshakeBackwardsOrError, |
|
536 MeshMachine::TStateFork<TContext>, |
|
537 NetStateMachine::MStateFork, |
|
538 TContext ) |
|
539 virtual TInt TransitionTag(); |
|
540 DECLARE_SMELEMENT_FOOTER( TStartMobilityHandshakeBackwardsOrError ) |
|
541 |
|
542 /** |
|
543 * FORK/DECISION: Decides if needs cancel or not. |
|
544 */ |
|
545 DECLARE_SMELEMENT_HEADER( TInformMigrationAvailableOrCancelTag, |
|
546 MeshMachine::TStateFork<TContext>, |
|
547 NetStateMachine::MStateFork, |
|
548 TContext ) |
|
549 virtual TInt TransitionTag(); |
|
550 DECLARE_SMELEMENT_FOOTER( TInformMigrationAvailableOrCancelTag ) |
|
551 |
|
552 /** |
|
553 * FORK/DECISION: Decides what happens after IPCPR application completes the |
|
554 * three way handshake. |
|
555 * 1. Application accepted, continue to send accept to policy server. |
|
556 * 2. Error |
|
557 * 3. Application rejected, continue to send reject to policy server. |
|
558 * @return TransitionTag of the selected transition. |
|
559 */ |
|
560 DECLARE_SMELEMENT_HEADER( TNoTagOrErrorTagOrApplicationRejected, |
|
561 MeshMachine::TStateFork<TContext>, |
|
562 NetStateMachine::MStateFork, |
|
563 TContext ) |
|
564 virtual TInt TransitionTag(); |
|
565 DECLARE_SMELEMENT_FOOTER( TNoTagOrErrorTagOrApplicationRejected ) |
|
566 |
|
567 /** |
|
568 * FORK/DECISION: Decides whether to wait MPM actions or report an error. |
|
569 * 1. Wait for further actions. ReSelect is NOT supported. |
|
570 * 2. Error |
|
571 * @return TransitionTag of the selected transition. |
|
572 */ |
|
573 DECLARE_SMELEMENT_HEADER( TWaitPolicyServerResponseBackwardOrErrorTag, |
|
574 MeshMachine::TStateFork<TContext>, |
|
575 NetStateMachine::MStateFork, |
|
576 TContext ) |
|
577 virtual TInt TransitionTag(); |
|
578 DECLARE_SMELEMENT_FOOTER( TWaitPolicyServerResponseBackwardOrErrorTag ) |
|
579 |
|
580 /** |
|
581 * FORK/DECISION: |
|
582 * 1. Continue with handshake to select new AP for MCPR. |
|
583 * 2. Return back to migration-phase with new preferred IAP. |
|
584 * 3. Close down the system in case of mobilityerror. |
|
585 * @return //TODO Cancel from IPCPR. |
|
586 */ |
|
587 DECLARE_SMELEMENT_HEADER( TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel, |
|
588 MeshMachine::TStateFork<TContext>, |
|
589 NetStateMachine::MStateFork, |
|
590 TContext ) |
|
591 virtual TInt TransitionTag(); |
|
592 DECLARE_SMELEMENT_FOOTER( TNoTagOrInformMigrationAvailableBackwardsOrErrorOrCancel ) |
|
593 |
|
594 /** |
|
595 * Class that is responsible for managing mobility on MCPR side. |
|
596 * CS60MobilityActivity is the S60 version of the CMobilityActivity -class |
|
597 */ |
|
598 class CS60MobilityActivity : public S60MCprStates::CS60ErrorRecoveryActivity |
|
599 { |
|
600 public: |
|
601 /** |
|
602 * Symbian two-phase constructor |
|
603 */ |
|
604 static MeshMachine::CNodeActivityBase* NewL( const MeshMachine::TNodeActivity& aActivitySig, |
|
605 MeshMachine::AMMNodeBase& aNode ); |
|
606 |
|
607 /** |
|
608 * CS60MobilityActivity -context definition |
|
609 */ |
|
610 typedef MeshMachine::TNodeContext<CS60MetaConnectionProvider, MCprStates::TContext> TContext; |
|
611 |
|
612 /** |
|
613 * Inner mutex class. Takes care that mobility is not started while |
|
614 * activity/node is doing something more important. |
|
615 */ |
|
616 class TConnectionRecoveryOrMobilityPreferenceOrErrorMutex |
|
617 { |
|
618 public: |
|
619 /** |
|
620 * @return ETrue if mobility activity can't run |
|
621 */ |
|
622 static TBool IsBlocked(MeshMachine::TNodeContextBase& aContext); |
|
623 }; |
|
624 |
|
625 public: // Mesh Machine elements |
|
626 |
|
627 /** |
|
628 * TRANSITION/ACTION: Sends migration rejected message |
|
629 */ |
|
630 DECLARE_SMELEMENT_HEADER( TSendMigrationRejected, |
|
631 MeshMachine::TStateTransition<TContext>, |
|
632 NetStateMachine::MStateTransition, |
|
633 TContext ) |
|
634 virtual void DoL(); |
|
635 DECLARE_SMELEMENT_FOOTER( TSendMigrationRejected ) |
|
636 |
|
637 /** |
|
638 * TRANSITION/ACTION: Sends migration rejected message |
|
639 */ |
|
640 DECLARE_SMELEMENT_HEADER( TSendMigrationAccepted, |
|
641 MeshMachine::TStateTransition<TContext>, |
|
642 NetStateMachine::MStateTransition, |
|
643 TContext ) |
|
644 virtual void DoL(); |
|
645 DECLARE_SMELEMENT_FOOTER( TSendMigrationAccepted ) |
|
646 |
|
647 /** |
|
648 * TRANSITION/ACTION: Clears the handshaking flag |
|
649 */ |
|
650 DECLARE_SMELEMENT_HEADER( TClearHandshakingFlag, |
|
651 MeshMachine::TStateTransition<TContext>, |
|
652 NetStateMachine::MStateTransition, |
|
653 CS60MobilityActivity::TContext ) |
|
654 virtual void DoL(); |
|
655 DECLARE_SMELEMENT_FOOTER( TClearHandshakingFlag ) |
|
656 |
|
657 // EMPTY |
|
658 DECLARE_SMELEMENT_HEADER( TSendAvailabilityRequest, |
|
659 MeshMachine::TStateTransition<TContext>, |
|
660 NetStateMachine::MStateTransition, |
|
661 CS60MobilityActivity::TContext ) |
|
662 virtual void DoL(); |
|
663 DECLARE_SMELEMENT_FOOTER( TSendAvailabilityRequest ) |
|
664 |
|
665 /** |
|
666 * TRANSITION/ACTION: Sends migration available notification to IPCPR. |
|
667 */ |
|
668 DECLARE_SMELEMENT_HEADER( TInformMigrationAvailableAndSetHandshakingFlag, |
|
669 MeshMachine::TStateTransition<TContext>, |
|
670 NetStateMachine::MStateTransition, |
|
671 CS60MobilityActivity::TContext ) |
|
672 virtual void DoL(); |
|
673 DECLARE_SMELEMENT_FOOTER( TInformMigrationAvailableAndSetHandshakingFlag ) |
|
674 |
|
675 // Symbian comment: For the moment it is sufficient to use the re-connect activity, in the future we may want to |
|
676 // customise the behavior, for example start the new layer before rebinding it, etc. |
|
677 // EMPTY |
|
678 DECLARE_SMELEMENT_HEADER(TRequestReConnect, |
|
679 MeshMachine::TStateTransition<TContext>, |
|
680 NetStateMachine::MStateTransition, |
|
681 CS60MobilityActivity::TContext) |
|
682 virtual void DoL(); |
|
683 DECLARE_SMELEMENT_FOOTER(TRequestReConnect) |
|
684 |
|
685 /** |
|
686 * TRANSITION/ACTION: Informs IPCPR that MCPR has migrated. |
|
687 */ |
|
688 DECLARE_SMELEMENT_HEADER( TInformMigrationCompleted, |
|
689 MeshMachine::TStateTransition<TContext>, |
|
690 NetStateMachine::MStateTransition, |
|
691 CS60MobilityActivity::TContext ) |
|
692 virtual void DoL(); |
|
693 DECLARE_SMELEMENT_FOOTER( TInformMigrationCompleted ) |
|
694 |
|
695 /** |
|
696 * TRANSITION/ACTION: Sends Application Accepted Connection |
|
697 */ |
|
698 DECLARE_SMELEMENT_HEADER( TSendApplicationAccept, |
|
699 MeshMachine::TStateTransition<TContext>, |
|
700 NetStateMachine::MStateTransition, |
|
701 CS60MobilityActivity::TContext ) |
|
702 virtual void DoL(); |
|
703 DECLARE_SMELEMENT_FOOTER( TSendApplicationAccept ) |
|
704 |
|
705 /** |
|
706 * TRANSITION/ACTION: Sends Application Rejected Connection |
|
707 */ |
|
708 DECLARE_SMELEMENT_HEADER( TSendApplicationReject, |
|
709 MeshMachine::TStateTransition<TContext>, |
|
710 NetStateMachine::MStateTransition, |
|
711 CS60MobilityActivity::TContext ) |
|
712 virtual void DoL(); |
|
713 DECLARE_SMELEMENT_FOOTER( TSendApplicationReject ) |
|
714 |
|
715 /** |
|
716 * TRANSITION/ACTION: Unregister preferred carrier notifications. |
|
717 */ |
|
718 DECLARE_SMELEMENT_HEADER( TCancelMobilityActivity, |
|
719 MeshMachine::TStateTransition<TContext>, |
|
720 NetStateMachine::MStateTransition, |
|
721 CS60MobilityActivity::TContext ) |
|
722 virtual void DoL(); |
|
723 DECLARE_SMELEMENT_FOOTER( TCancelMobilityActivity ) |
|
724 |
|
725 /** |
|
726 * STATE: Waits for response to the MigrationAccepted message. |
|
727 * @return ETrue if new PreferredCarrier arrives, new StartIAPNotification arrives or error arrives. |
|
728 */ |
|
729 DECLARE_SMELEMENT_HEADER( TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel, |
|
730 MeshMachine::TState<TContext>, |
|
731 NetStateMachine::MState, |
|
732 CS60MobilityActivity::TContext) |
|
733 virtual TBool Accept(); |
|
734 DECLARE_SMELEMENT_FOOTER( TAwaitingPreferredCarrierOrStartIAPNotificationOrErrorNotificationOrCancel ) |
|
735 |
|
736 /** |
|
737 * STATE: Waits for preferred carrier message. |
|
738 * @return ETrue if preferred carrier notification is received. |
|
739 */ |
|
740 DECLARE_SMELEMENT_HEADER( TAwaitingPreferredCarrierOrCancelOrRejected, |
|
741 MeshMachine::TState<TContext>, |
|
742 NetStateMachine::MState, |
|
743 CS60MobilityActivity::TContext) |
|
744 virtual TBool Accept(); |
|
745 DECLARE_SMELEMENT_FOOTER( TAwaitingPreferredCarrierOrCancelOrRejected ) |
|
746 |
|
747 /** |
|
748 * FORK/DECISION: Decides what happens after IPCPR responds to migration offer. |
|
749 * 1. Proceed to migration if asked. |
|
750 * 2. Proceed to cancel. |
|
751 * 3. Go back to wait for new preferred connection. |
|
752 * @return TransitionTag of the selected transition. |
|
753 */ |
|
754 DECLARE_SMELEMENT_HEADER( TNoTagOrApplicationRejectedMigrationOrCancel, |
|
755 MeshMachine::TStateFork<TContext>, |
|
756 NetStateMachine::MStateFork, |
|
757 CS60MobilityActivity::TContext ) |
|
758 virtual TInt TransitionTag(); |
|
759 DECLARE_SMELEMENT_FOOTER( TNoTagOrApplicationRejectedMigrationOrCancel ) |
|
760 |
|
761 /** |
|
762 * Mutex protected TRANSITION. |
|
763 * Mopility scenario should wait until the connection recovery finishes. |
|
764 */ |
|
765 DECLARE_SERIALIZABLE_TRANSITION( TInformMigrationAvailableAndSetHandshakingFlagBlockedByConnectionRecoveryOrNoMobilityPreferenceOrError, |
|
766 CS60MobilityActivity::TConnectionRecoveryOrMobilityPreferenceOrErrorMutex, |
|
767 CS60MobilityActivity::TInformMigrationAvailableAndSetHandshakingFlag ) |
|
768 |
|
769 protected: // Methods. |
|
770 |
|
771 /** |
|
772 * C++ constructor |
|
773 */ |
|
774 CS60MobilityActivity( const MeshMachine::TNodeActivity& aActivitySig, |
|
775 MeshMachine::AMMNodeBase& aNode ); |
|
776 |
|
777 //TBool Signal( MeshMachine::TNodeContextBase& aContext ); |
|
778 |
|
779 private: // Private methods. |
|
780 |
|
781 /** |
|
782 * Sets on MCPR wide mobility handshaking flag. |
|
783 */ |
|
784 void SetHandshakingFlag(); |
|
785 |
|
786 /** |
|
787 * Clears MCPR wide mobility handshaking flag. |
|
788 */ |
|
789 void ClearHandshakingFlag(); |
|
790 |
|
791 private: // Member variables. |
|
792 |
|
793 /** |
|
794 * Pointer to IPProtocoMCPR which is currently active |
|
795 */ |
|
796 ESock::RMetaServiceProviderInterface* iCurrent; |
|
797 |
|
798 /** |
|
799 * Pointer to IPProtocoMCPR which is about to become the active. |
|
800 */ |
|
801 ESock::RMetaServiceProviderInterface* iPreferred; |
|
802 |
|
803 TUint iCurrentAssumedAPId; // Current IAP Id |
|
804 TUint iPreferredAPId; // New IAP Id system should roam to. |
|
805 TBool iIsUpgrade; // If the active iPreferredAPId is upgrade to old one. |
|
806 TBool iIsSeamless; // *not used* if the roaming is seamless from the IP point of view |
|
807 |
|
808 }; |
|
809 |
|
810 DECLARE_SMELEMENT_HEADER( TProcessSimpleSelectionPolicy, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext ) |
|
811 virtual void DoL(); |
|
812 DECLARE_SMELEMENT_FOOTER( TProcessSimpleSelectionPolicy ) |
|
813 |
|
814 } // namespace S60MCprMobilityActivity |
|
815 |
|
816 #endif // S60MCPR_ACTIVITIES_H |
|
817 |