|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __CIMMOBILITYMANAGER_H__ |
|
17 #define __CIMMOBILITYMANAGER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <msvstd.h> |
|
21 #include <comms-infras/cs_mobility_apiext.h> // MMobilityProtocolResp, CActiveCommsMobilityApiExt |
|
22 #include "mimmobilitypolicyhandler.h" |
|
23 #include "mimmobileserver.h" |
|
24 #include "msgnetteststub.h" |
|
25 |
|
26 /** |
|
27 The CImMobilityManager class manages notifications from the Bearer Mobility |
|
28 Framework, passing notifications up to the Mobility Policy Provider, and |
|
29 instructing the server MTM of the appropriate actions to take to perform |
|
30 the requested mobility behaviour. |
|
31 |
|
32 @internalComponent |
|
33 @prototype |
|
34 */ |
|
35 class CImMobilityManager : public CBase, |
|
36 public MMobilityProtocolResp, |
|
37 public MImMobilityPolicyHandler |
|
38 { |
|
39 public: |
|
40 // construction/destruction: |
|
41 IMPORT_C static CImMobilityManager* NewL(TUid aMtmUid, TMsvId aAccountId, MImMobileServer& aMtm); |
|
42 ~CImMobilityManager(); |
|
43 |
|
44 // initialisation. |
|
45 // bearer mobility events are not observered until this is called. |
|
46 IMPORT_C void SetConnection(RCommsSubSession& aConnection); |
|
47 |
|
48 // from MMobilityProtocolResp |
|
49 void PreferredCarrierAvailable(TAccessPointInfo aOldAp, TAccessPointInfo aNewAp, TBool aIsUpgrade, TBool aIsSeamless); |
|
50 void NewCarrierActive(TAccessPointInfo aNewAp, TBool aIsSeamless); |
|
51 void Error(TInt aError); |
|
52 |
|
53 // from MImMobilityPolicyHandler |
|
54 IMPORT_C void AcceptNewCarrier(TImMobilityAction aAction); |
|
55 IMPORT_C void IgnoreNewCarrier(); |
|
56 |
|
57 // the interface to the server MTM. Perhaps should define an m-class for neatness. |
|
58 IMPORT_C void MigrateToNewCarrier(); |
|
59 IMPORT_C void NewCarrierAccepted(); |
|
60 IMPORT_C void NewCarrierRejected(); |
|
61 |
|
62 private: |
|
63 CImMobilityManager(TUid aMtmUid, TMsvId aAccountId, MImMobileServer& aMtm); |
|
64 void ConstructL(); |
|
65 |
|
66 /** |
|
67 Specifies the high-level state of the mobility manager |
|
68 */ |
|
69 enum TMobilityState |
|
70 { |
|
71 /** |
|
72 The Mobility Manager is uninitialiased. |
|
73 */ |
|
74 EMobilityUninitialised, |
|
75 /** |
|
76 The Mobility Manager has been initialised. |
|
77 No notifications received, nor waiting for any response. |
|
78 */ |
|
79 EMobilityIdle, |
|
80 /** |
|
81 PreferredCarrierAvailable(upgradade) notification received and policy |
|
82 provider notified. Waiting for instruction from the policy provider. |
|
83 */ |
|
84 EMobilityWaitForUpgradePolicy, |
|
85 /** |
|
86 PreferredCarrierAvailable(downgradade) notification received and policy |
|
87 provider notified. Waiting for instruction from the policy provider. |
|
88 */ |
|
89 EMobilityWaitForDowngradePolicy, |
|
90 /** |
|
91 Second PreferredCarrierAvailable(upgrade) notification received while |
|
92 waiting for the original old sockets to be closed. Policy provider notified. |
|
93 Waiting for instruction from the policy provider. |
|
94 Also waiting for notification that sockets using the old carrier have been |
|
95 disconnected. |
|
96 This state exists purely to handle an unexpected race condition |
|
97 */ |
|
98 EMobilityWaitForUpgradePolicyAndOldSocketClose, |
|
99 /** |
|
100 Second PreferredCarrierAvailable(upgrade) notification received while |
|
101 waiting for the original old sockets to be closed. Policy provider notified. |
|
102 Policy Provider has rejected the second upgrade notice. |
|
103 Waiting for notification that sockets using the old carrier have been |
|
104 disconnected. When the old sockets become disconnected, the MTM shall be |
|
105 instructed to reconnect (via NewCarrierActive(), even though this will be |
|
106 a connection via the original carrier. |
|
107 This state exists purely to handle an unexpected race condition |
|
108 */ |
|
109 EMobilityWaitForOldSocketCloseCarrierRejected, |
|
110 /** |
|
111 Waiting for notification that sockets using the old carrier have been |
|
112 disconnected. |
|
113 */ |
|
114 EMobilityWaitForOldSocketClose, |
|
115 /** |
|
116 Waiting for notification from the Bearer Mobility Framework that the |
|
117 new carrier is active and available for creation of new sockets. |
|
118 */ |
|
119 EMobilityWaitForMigrate, |
|
120 /** |
|
121 Waiting for notification from the Server MTM that either new sockets |
|
122 have been successfully created using the new carrier, or that |
|
123 connection has been unsuccessful. |
|
124 */ |
|
125 EMobilityConnectingToNewCarrier |
|
126 }; |
|
127 |
|
128 private: |
|
129 TUid iMtmUid; |
|
130 TMsvId iAccountId; |
|
131 TUint iState; |
|
132 |
|
133 // Interfaces... |
|
134 MImMobileServer& iMtm; |
|
135 CActiveCommsMobilityApiExt* iCommsMobilityApi; |
|
136 |
|
137 // info from the last PreferredCarrierAvailable() notice |
|
138 TAccessPointInfo iNewAp; |
|
139 TAccessPointInfo iOldAp; |
|
140 TBool iIsSeamless; |
|
141 |
|
142 // A flag - set when we're closing down as we don't need further notifications from Comms. |
|
143 TBool iIsCancelled; |
|
144 }; |
|
145 |
|
146 #endif // __CIMMOBILITYMANAGER_H__ |