1 /* |
|
2 * Copyright (c) 2007-2008 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: Class header for CWsfSession |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_WSFSESSION_H |
|
21 #define C_WSFSESSION_H |
|
22 |
|
23 // EXTERNAL INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // INTERNAL INCLUDES |
|
27 #include "wsfengineobserver.h" |
|
28 #include "wsfservercommon.h" |
|
29 |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CWsfServer; |
|
33 |
|
34 // CLASS DEFINITION |
|
35 /** |
|
36 * Server-side session class. |
|
37 * This class is instantiated and used each time a client connects to the |
|
38 * sniffer server. |
|
39 * |
|
40 * @since S60 5.0 |
|
41 * @lib wsfserver.exe |
|
42 */ |
|
43 NONSHARABLE_CLASS( CWsfSession ): public CSession2, |
|
44 public MWsfEngineObserver |
|
45 { |
|
46 public: // Construction and destruction |
|
47 |
|
48 /** |
|
49 * Factory function. |
|
50 * @since S60 5.0 |
|
51 * @param aServer Reference to the server object. Ownership not passed. |
|
52 * @return Session instance |
|
53 */ |
|
54 static CWsfSession* NewL( CWsfServer& aServer ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CWsfSession(); |
|
60 |
|
61 private: |
|
62 /** |
|
63 * Constructor |
|
64 * @since S60 5.0 |
|
65 * @param aServer Reference to the server object. Ownership not passed. |
|
66 */ |
|
67 CWsfSession( CWsfServer& aServer ); |
|
68 |
|
69 /** |
|
70 * Second-phase constructor. |
|
71 * @since S60 5.0 |
|
72 */ |
|
73 void ConstructL(); |
|
74 |
|
75 |
|
76 public: // from CSession2 |
|
77 /** |
|
78 * Handles the servicing of a client request that has been passed to |
|
79 * the server. |
|
80 * @since S60 5.0 |
|
81 * @param aMessage The message containing the details of the |
|
82 * client request |
|
83 */ |
|
84 void ServiceL( const RMessage2& aMessage ); |
|
85 |
|
86 |
|
87 public: // new functions |
|
88 /** |
|
89 * Handles messages by reading the function id and passing |
|
90 * the request forward. |
|
91 * @since S60 5.0 |
|
92 * @param aMessage The received message containing function and |
|
93 * descriptors. |
|
94 */ |
|
95 void DispatchMessageL( const RMessage2& aMessage ); |
|
96 |
|
97 |
|
98 private: // new functions |
|
99 /** |
|
100 * Returns whether wlan scanning is scheduled at the moment |
|
101 * @since S60 5.0 |
|
102 * @param aMessage The message to process |
|
103 * @return ETrue if active or efalse. |
|
104 */ |
|
105 TBool ScanActiveL( const RMessage2& aMessage ); |
|
106 |
|
107 /** |
|
108 * Enables the engine scanning |
|
109 * @since S60 5.0 |
|
110 */ |
|
111 void ActivateScanL(); |
|
112 |
|
113 /** |
|
114 * Disables the engine scanning |
|
115 * @since S60 5.0 |
|
116 */ |
|
117 void DisableScanL(); |
|
118 |
|
119 /** |
|
120 * Returns the wlan bearer status |
|
121 * @since S60 5.0 |
|
122 * @param aMessage The message to process |
|
123 */ |
|
124 void IsConnectedL( const RMessage2& aMessage ); |
|
125 |
|
126 /** |
|
127 * Activates asynchronous request to engine events |
|
128 * @since S60 5.0 |
|
129 * @param aMessage The message to process |
|
130 */ |
|
131 void RequestNotifyL( const RMessage2& aMessage ); |
|
132 |
|
133 /** |
|
134 * Cancels pending notify request |
|
135 * @since S60 5.0 |
|
136 */ |
|
137 void CancelNotifyEvents(); |
|
138 |
|
139 /** |
|
140 * Cancels all pending tasks |
|
141 * @since S60 5.0 |
|
142 */ |
|
143 void CancelPendingTasks(); |
|
144 |
|
145 /** |
|
146 * Gets the connected wlan connection name |
|
147 * @since S60 5.0 |
|
148 * @param aMessage The message to process |
|
149 */ |
|
150 void GetConnectedAccountNameL( const RMessage2& aMessage ); |
|
151 |
|
152 /** |
|
153 * Gets the connected wlan's details in a TWsfWlanInfo |
|
154 * @since S60 5.0 |
|
155 * @param aMessage The message to process |
|
156 */ |
|
157 void GetConnectedDetailsL( const RMessage2& aMessage ); |
|
158 |
|
159 /** |
|
160 * Checks the required buffer size for serialized wlan data |
|
161 * @since S60 5.0 |
|
162 * @param aMessage The message to process |
|
163 */ |
|
164 void ReplyWlanDataSizeL( const RMessage2& aMessage ); |
|
165 |
|
166 /** |
|
167 * Copies serialized wlan data |
|
168 * @since S60 5.0 |
|
169 * @param aMessage The message to process |
|
170 */ |
|
171 void WriteWlanDataL( const RMessage2& aMessage ); |
|
172 |
|
173 /** |
|
174 * Passes connect wlan commands to engine |
|
175 * @since S60 5.0 |
|
176 * @param aMessage The message to process |
|
177 */ |
|
178 void ConnectWlanL( const RMessage2& aMessage ); |
|
179 |
|
180 /** |
|
181 * Passes disconnect wlan commands to engine |
|
182 * @since S60 5.0 |
|
183 * @param aMessage The message to process |
|
184 */ |
|
185 void DisconnectWlanL( const RMessage2& aMessage ); |
|
186 |
|
187 /** |
|
188 * Request the engine to scan asap |
|
189 * @since S60 5.0 |
|
190 * @param aMessage The message to process |
|
191 */ |
|
192 void RequestScanL( const RMessage2& aMessage ); |
|
193 |
|
194 /** |
|
195 * Starts to monitor UI defined AP |
|
196 * @since S60 5.0 |
|
197 * @param aMessage The message to process |
|
198 */ |
|
199 void MonitorApL( const RMessage2& aMessage ); |
|
200 |
|
201 /** |
|
202 * Aborts the currently ongoing connecting process |
|
203 * @since S60 5.0 |
|
204 */ |
|
205 void AbortConnectingL(); |
|
206 |
|
207 /** |
|
208 * Aborts the currently ongoing scanning process |
|
209 * @since S60 5.0 |
|
210 */ |
|
211 void AbortScanning(); |
|
212 |
|
213 /** |
|
214 * Sets the persistence property for the currently monitored IAP |
|
215 * @param aMessage The message to process |
|
216 * @since S60 5.0 |
|
217 */ |
|
218 void SetIapPersistenceL( const RMessage2& aMessage ); |
|
219 |
|
220 /** |
|
221 * Controls the auto-disconnect timer in the server |
|
222 * for owned connections |
|
223 * @since S60 5.0 |
|
224 * @param aMessage The message to process |
|
225 */ |
|
226 void ControlDisconnectTimerL( const RMessage2& aMessage ); |
|
227 |
|
228 /** |
|
229 * Returns whether scanning is enabled |
|
230 * @since S60 5.0 |
|
231 * @param aMessage The message to process |
|
232 */ |
|
233 void ReplyIsScanningL( const RMessage2& aMessage ); |
|
234 |
|
235 |
|
236 public: // from MWsfEngineObserver |
|
237 /** |
|
238 * Called when the WLAN scanning is finished and results are available |
|
239 * @since S60 5.0 |
|
240 */ |
|
241 void WlanListChangedL(); |
|
242 |
|
243 /** |
|
244 * Called when an error occured in the engine |
|
245 * @since S60 5.0 |
|
246 * @param aError System wide error code |
|
247 */ |
|
248 void NotifyErrorL( TInt aError ); |
|
249 |
|
250 /** |
|
251 * Called when the WLAN scanning has been enabled |
|
252 * @since S60 5.0 |
|
253 */ |
|
254 void ScanEnabledL(); |
|
255 |
|
256 /** |
|
257 * Called when the WLAN scanning has been disabled |
|
258 * @since S60 5.0 |
|
259 */ |
|
260 void ScanDisabledL(); |
|
261 |
|
262 /** |
|
263 * Called when a WLAN connection has been established |
|
264 * @since S60 5.0 |
|
265 */ |
|
266 void ConnectedL(); |
|
267 |
|
268 /** |
|
269 * Called when the active WLAN connection has been terminated |
|
270 * @since S60 5.0 |
|
271 */ |
|
272 void DisconnectedL(); |
|
273 |
|
274 /** |
|
275 * Called when an error occured during the connecting process |
|
276 * @since S60 5.0 |
|
277 * @param aError System wide error code |
|
278 */ |
|
279 void ConnectingFailedL( TInt aError ); |
|
280 |
|
281 |
|
282 private: // new methods |
|
283 /** |
|
284 * Notifies the client of the next server event in the event queue |
|
285 * @since S60 5.0 |
|
286 */ |
|
287 void NotifyClientL(); |
|
288 |
|
289 |
|
290 private: // data |
|
291 /** |
|
292 * Reference to the server object (not owned) |
|
293 */ |
|
294 CWsfServer& iServer; |
|
295 |
|
296 /** |
|
297 * Indicates if notification has been requested |
|
298 */ |
|
299 TBool iRequestNotify; |
|
300 |
|
301 /** |
|
302 * Client message to complete when notifying |
|
303 */ |
|
304 RMessage2 iNotifyChangesMessage; |
|
305 |
|
306 /** |
|
307 * Queue of server events |
|
308 */ |
|
309 RArray<TWsfNotifyEventContainer> iEventQueue; |
|
310 |
|
311 /** |
|
312 * Indicates whether scanning is enabled |
|
313 */ |
|
314 TBool iEnabledScanning; |
|
315 |
|
316 /** |
|
317 * Indicates if an event is being processed |
|
318 */ |
|
319 TBool iProcessingEvent; |
|
320 }; |
|
321 |
|
322 #endif // C_WSFSESSION_H |
|
323 |
|