|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Implementation of HotSpot Server Session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HOTSPOTSESSION_H |
|
20 #define HOTSPOTSESSION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <centralrepository.h> |
|
24 #include "hssclientplugin.h" |
|
25 #include <e32base.h> |
|
26 #include <e32svr.h> |
|
27 #include <wlanmgmtclient.h> |
|
28 #include <wlanmgmtinterface.h> |
|
29 #include <wlanmgmtcommon.h> |
|
30 #include <commdb.h> |
|
31 #include <ictscommon.h> |
|
32 #include <ictsclientinterface.h> |
|
33 #include "hssnotif.h" |
|
34 #include "hssiapsettingshandler.h" |
|
35 #include "hssclientinterface.h" |
|
36 #include "hsslogintimerobserver.h" |
|
37 #include "hsslogouttimerobserver.h" |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CHotSpotServer; |
|
41 class CWlanMgmtClient; |
|
42 class HssNotifications; |
|
43 class CSessionNotification; |
|
44 class CHssLoginTimer; |
|
45 class CHssLogoutTimer; |
|
46 |
|
47 |
|
48 // CLASS DECLARATION |
|
49 /** |
|
50 * Server side counterpart for client's Session classes. |
|
51 * Each connection has own session in server. |
|
52 * @lib HotSpotServer.exe |
|
53 * @since Series 60 3.0 |
|
54 */ |
|
55 NONSHARABLE_CLASS( CHotSpotSession ) : public CSession2, |
|
56 public MIctsObserver, |
|
57 public MHssLoginTimerObserver, |
|
58 public MHssLogoutTimerObserver, |
|
59 public MWlanMgmtNotifications |
|
60 { |
|
61 |
|
62 public: |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 */ |
|
67 static CHotSpotSession* NewL( CHotSpotServer& aServer ); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 ~CHotSpotSession(); |
|
73 |
|
74 struct TNotification |
|
75 { |
|
76 TInt id; |
|
77 TBuf8<KHssMaxNotificationLength> data; |
|
78 }; |
|
79 public: // Functions from base classes |
|
80 |
|
81 /** |
|
82 * From CSession called when a client asks for service |
|
83 * @param aMessage the message |
|
84 * @return None |
|
85 */ |
|
86 void ServiceL( const RMessage2& aMessage ); |
|
87 |
|
88 /** |
|
89 * Called by ServiceL when a client asks for service |
|
90 * @param aMessage the message |
|
91 * @return None |
|
92 */ |
|
93 void DispatchMessageL( const RMessage2& aMessage ); |
|
94 |
|
95 /** |
|
96 * From MICTSObserver. Called when internet connectivity tests are |
|
97 * being done. |
|
98 * @param aResult Result of tests |
|
99 * @param aString String containing possible HTML response |
|
100 * @return None |
|
101 */ |
|
102 void ConnectivityObserver( TIctsTestResult aResult, |
|
103 const TDesC& aString ); |
|
104 |
|
105 /** |
|
106 * From MHssLoginTimerObserver. Called when time used for Login(..) |
|
107 * has run out for client. |
|
108 * @return None |
|
109 */ |
|
110 void LoginTimeout(); |
|
111 |
|
112 /** |
|
113 * From MHssLogoutTimerObserver. Called when time used for Logout(..) |
|
114 * has run out for client. |
|
115 * @return None |
|
116 */ |
|
117 void LogoutTimeout(); |
|
118 |
|
119 /** |
|
120 * From MWlanMgmtNotifications |
|
121 * @since Series 60 3.0 |
|
122 * @param aNewState State of WLAN |
|
123 * @return None |
|
124 */ |
|
125 virtual void ConnectionStateChanged( TWlanConnectionMode aNewState ); |
|
126 |
|
127 public: // New functions |
|
128 |
|
129 |
|
130 /** |
|
131 * Metods for handling passthrough notifications |
|
132 */ |
|
133 void HandleCancelNotifications( const RMessage2& aMessage ); |
|
134 void AddNotification( TInt aNotification, TDes8& aData ); |
|
135 void HandleOrderNotifications( const RMessage2& aMessage ); |
|
136 void HandleNotification(); |
|
137 |
|
138 private: |
|
139 |
|
140 /** |
|
141 * C++ default constructor. |
|
142 */ |
|
143 CHotSpotSession( CHotSpotServer& aServer ); |
|
144 |
|
145 /** |
|
146 * By default Symbian 2nd phase constructor is private. |
|
147 */ |
|
148 |
|
149 void ConstructL(); |
|
150 /** |
|
151 * Initialize Scan to WlanEngine |
|
152 * @return None |
|
153 */ |
|
154 |
|
155 /** |
|
156 * Launch Intenet Connectivity Test Service |
|
157 * @return None |
|
158 */ |
|
159 void TestInternetConnectivityL(); |
|
160 |
|
161 /** |
|
162 * Starts client register procedures |
|
163 * @param aMessage, RMessage from client side |
|
164 * @return None |
|
165 */ |
|
166 void ProcessRegisterL( const RMessage2& aMessage ); |
|
167 |
|
168 /** |
|
169 * Starts client unregister procedures |
|
170 * @param aMessage, RMessage from client side |
|
171 * @return None |
|
172 */ |
|
173 void ProcessUnRegisterL( const RMessage2& aMessage ); |
|
174 |
|
175 /** |
|
176 * Starts login procedures |
|
177 * @param aIapId, IAP id |
|
178 * @param aNetId, Network id |
|
179 * @return KErrNone, if successful, otherwice one of system wide errorcodes. |
|
180 */ |
|
181 TInt ProcessStartLoginL( const TUint aIapId, const TUint aNetId ); |
|
182 |
|
183 /** |
|
184 * Starts Join procedures |
|
185 * @param aIapId, IAP id |
|
186 * @return KErrNone, if successful, otherwice one of system wide errorcodes. |
|
187 */ |
|
188 TInt ProcessStartL( const TUint aIapId ); |
|
189 |
|
190 /** |
|
191 * Starts Configure & reJoin procedures |
|
192 * @param aIapId, IAP id |
|
193 * @return KErrNone, if successful, otherwice one of system wide errorcodes. |
|
194 */ |
|
195 TInt ProcessStartAgain( const TUint aIapId ); |
|
196 |
|
197 /** |
|
198 * Sends WLAN association status to client |
|
199 * @param aIapId, IAP id |
|
200 * @param aResult, ETrue is successful, otherwise EFalse |
|
201 * @return KErrNone, if successful, otherwice one of system wide errorcodes. |
|
202 */ |
|
203 TInt ProcessAssociationStatus( const TUint aIapId, TBool aResult ); |
|
204 |
|
205 /** |
|
206 * Starts CloseConnection procedures |
|
207 * @param aIapId, IAP id |
|
208 * @return KErrNone, if successful, otherwice one of system wide errorcodes. |
|
209 */ |
|
210 TInt ProcessCloseL( const TUint aIapId ); |
|
211 |
|
212 /** |
|
213 * Creates client instance through ECom |
|
214 * @param aUid, ECom implementation UID of client |
|
215 * @return KErrNone, if successful, otherwice one of system wide errorcodes. |
|
216 */ |
|
217 TInt CreateClient( const TUid aUid, TDesC8& aUidText ); |
|
218 |
|
219 /** |
|
220 * Makes server shutdown processes (agent change and IAP removals) |
|
221 * @param aMessage, Message for completing request |
|
222 */ |
|
223 void ProcessServerShutdown( const RMessage2& aMessage ); |
|
224 |
|
225 /** |
|
226 * Updates UI state of HotSpot browser logon application. |
|
227 * @param aMessage, Message for completing request |
|
228 */ |
|
229 void ProcessUiState( const RMessage2& aMessage ); |
|
230 |
|
231 /** |
|
232 * Start HotSpot browser logon application. |
|
233 * @param aString, redirect URL |
|
234 */ |
|
235 void AuthenticateL( const TDesC& aString ); |
|
236 |
|
237 private: // Data |
|
238 |
|
239 /** List of pending (not sent) notifications. */ |
|
240 RArray<TNotification> iPendingNotifications; |
|
241 |
|
242 /** The request from the client pending for a notification. */ |
|
243 RMessagePtr2 iPendingNotificationRequest; |
|
244 |
|
245 /** Is there a pending request from the client. */ |
|
246 TBool iIsNotificationRequestPending; |
|
247 |
|
248 /** |
|
249 * Handle to server |
|
250 */ |
|
251 CHotSpotServer& iServer; |
|
252 |
|
253 /** |
|
254 * Instance of 3rd party client (ECom) |
|
255 * Own |
|
256 */ |
|
257 CHssClientPlugin* iClient; |
|
258 |
|
259 /** |
|
260 * handle to MHssSrvNotifications |
|
261 */ |
|
262 MHssSrvNotifications *iSrvNotifications; |
|
263 |
|
264 /** Handle to remove notification. */ |
|
265 CSessionNotification* iNotificationHandle; |
|
266 |
|
267 /** |
|
268 * RMessage instance |
|
269 */ |
|
270 RMessage2 iMessage; |
|
271 |
|
272 /** |
|
273 * IAP id in use |
|
274 */ |
|
275 TInt iIapId; |
|
276 |
|
277 /** |
|
278 * Network Id in use |
|
279 */ |
|
280 TInt iNetId; |
|
281 |
|
282 /** |
|
283 * handle to WlanMgmtClient |
|
284 */ |
|
285 CWlanMgmtClient *iMgtClient; |
|
286 |
|
287 /** |
|
288 * handle to HssNotifications |
|
289 */ |
|
290 HssNotifications *iNotifications; |
|
291 |
|
292 |
|
293 /** |
|
294 * statusinformation of Async call |
|
295 */ |
|
296 TRequestStatus iStatus; |
|
297 |
|
298 /** |
|
299 * Handler for changing IAP settings |
|
300 * Own |
|
301 */ |
|
302 CHssIapSettingsHandler* iIapSettingsHandler; |
|
303 |
|
304 /** |
|
305 * Internet Connectivity testing instance |
|
306 * Own |
|
307 */ |
|
308 CIctsClientInterface* iIcts; |
|
309 |
|
310 /** |
|
311 * Timer used for client Login procedure |
|
312 * Own |
|
313 */ |
|
314 CHssLoginTimer* iLoginTimer; |
|
315 |
|
316 /** |
|
317 * Timer used for client Logout procedure |
|
318 * Own |
|
319 */ |
|
320 CHssLogoutTimer* iLogoutTimer; |
|
321 |
|
322 /** |
|
323 * Flag for notification sending |
|
324 */ |
|
325 TBool iAllowNotifications; |
|
326 |
|
327 /** |
|
328 * Instance of CenRep |
|
329 * Own. |
|
330 */ |
|
331 CRepository* iRepository; |
|
332 |
|
333 /** |
|
334 * Client UID of this session |
|
335 */ |
|
336 TUid iClientUid; |
|
337 |
|
338 /** |
|
339 * Flag for indicate if extended HSFW API is used |
|
340 */ |
|
341 TBool iHotspotExtension; |
|
342 }; |
|
343 |
|
344 #endif |