|
1 /* |
|
2 * Copyright (c) 2007-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: |
|
15 * Name : sipalrsnapmonitor.h |
|
16 * Part of : SIP / SIP ALR Monitor |
|
17 * Version : SIP/6.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef CSIPALRSNAPMONITOR_H |
|
29 #define CSIPALRSNAPMONITOR_H |
|
30 |
|
31 // INCLUDES |
|
32 #include "sipalrobserver.h" |
|
33 #include <sipsystemstateobserver.h> |
|
34 #include <e32base.h> |
|
35 #include <in_sock.h> |
|
36 #include <connpref.h> |
|
37 |
|
38 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
39 #include <comms-infras/es_mobility_apiext.h> |
|
40 #else |
|
41 #include <comms-infras/cs_mobility_apiext.h> |
|
42 #endif |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class CSipSystemStateMonitor; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 /** |
|
49 * The implementation for SIP ALR SNAP monitor. |
|
50 * |
|
51 */ |
|
52 class CSipAlrSnapMonitor : public CActive, |
|
53 public MMobilityProtocolResp, |
|
54 public MSipSystemStateObserver |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 static CSipAlrSnapMonitor* NewLC( |
|
59 TUint32 aSnapId, |
|
60 MSipAlrObserver& aObserver, |
|
61 RSocketServ& aSocketServer, |
|
62 CSipSystemStateMonitor& aSystemStateMonitor ); |
|
63 |
|
64 ~CSipAlrSnapMonitor(); |
|
65 |
|
66 public: // From CActive |
|
67 |
|
68 void RunL(); |
|
69 |
|
70 void DoCancel(); |
|
71 |
|
72 TInt RunError( TInt aError ); |
|
73 |
|
74 public: // From MMobilityProtocolResp |
|
75 |
|
76 void PreferredCarrierAvailable( |
|
77 TAccessPointInfo aOldAP, |
|
78 TAccessPointInfo aNewAP, |
|
79 TBool aIsUpgrade, |
|
80 TBool aIsSeamless ); |
|
81 |
|
82 void NewCarrierActive( |
|
83 TAccessPointInfo aNewAP, |
|
84 TBool aIsSeamless ); |
|
85 |
|
86 void Error( TInt aError ); |
|
87 |
|
88 public: // From MSipSystemStateObserver |
|
89 |
|
90 void SystemVariableUpdated( |
|
91 CSipSystemStateMonitor::TSystemVariable aVariable, |
|
92 TInt aObjectId, |
|
93 TInt aValue ); |
|
94 |
|
95 public: // New functions |
|
96 |
|
97 TUint32 SnapId() const; |
|
98 |
|
99 void AddObserverL( MSipAlrObserver& aObserver ); |
|
100 |
|
101 TBool DetachObserver( MSipAlrObserver& aObserver ); |
|
102 |
|
103 void RefreshL(); |
|
104 |
|
105 void AllowMigration(); |
|
106 |
|
107 void DisallowMigration(); |
|
108 |
|
109 void NewIapAccepted(); |
|
110 |
|
111 void NewIapRejected(); |
|
112 |
|
113 private: // New functions |
|
114 |
|
115 TInt StartSnap(); |
|
116 |
|
117 void CreateMobilityAoL(); |
|
118 |
|
119 void ResetState(); |
|
120 |
|
121 void DestroyMobilityAo(); |
|
122 |
|
123 void NotifyObservers( TUint aIapId ); |
|
124 |
|
125 void NotifyInitializedObservers( |
|
126 TUint32 aIapId, |
|
127 MSipAlrObserver::TEvent aEvent ); |
|
128 |
|
129 void NotifyNewObservers( |
|
130 TUint32 aIapId ); |
|
131 |
|
132 TBool IsSnapAvailable() const; |
|
133 |
|
134 private: // Constructors |
|
135 |
|
136 CSipAlrSnapMonitor( |
|
137 TUint32 aSnapId, |
|
138 RSocketServ& aSocketServer, |
|
139 CSipSystemStateMonitor& aSystemStateMonitor ); |
|
140 |
|
141 void ConstructL( |
|
142 MSipAlrObserver& aObserver ); |
|
143 |
|
144 private: // Helper classes |
|
145 |
|
146 class TSipAlrSnapObserverInfo |
|
147 { |
|
148 public: |
|
149 MSipAlrObserver* iObserver; |
|
150 TBool iInitialEventDone; |
|
151 }; |
|
152 |
|
153 private: // Data |
|
154 |
|
155 TUint32 iSnapId; |
|
156 RSocketServ& iSocketServer; |
|
157 CSipSystemStateMonitor& iSystemStateMonitor; |
|
158 RConnection iConnection; |
|
159 TConnSnapPref iPrefs; |
|
160 CActiveCommsMobilityApiExt* iCommsMobilityAO; |
|
161 RArray<TSipAlrSnapObserverInfo> iObservers; |
|
162 TBool iPreferredCarrierAvailableCalled; |
|
163 TBool iMigrationAllowedByClient; |
|
164 TBool iFirstStartHasSucceeded; |
|
165 TBool iConnectionActive; |
|
166 TBool iDying; |
|
167 |
|
168 private: // For testing purposes |
|
169 |
|
170 #ifdef CPPUNIT_TEST |
|
171 friend class CSipAlrMonitorTest; |
|
172 friend class CSipAlrSnapMonitorTest; |
|
173 #endif |
|
174 }; |
|
175 |
|
176 #endif //CSIPALRSNAPMONITOR_H |