|
1 /* |
|
2 * Copyright (c) 2002-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 the License "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: Client side interface to WLAN Services |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 24 % |
|
20 */ |
|
21 |
|
22 #ifndef RWLMSERVER_H |
|
23 #define RWLMSERVER_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <wlancontrolinterface.h> |
|
27 #include <wlantrafficstreamparameters.h> |
|
28 #include "genscanlist.h" |
|
29 #include "wlmnotify.h" |
|
30 #include "wlancontrolinterface.h" |
|
31 |
|
32 class CWlmScanRequest; |
|
33 |
|
34 /** |
|
35 * Application interface. |
|
36 * This class hides inter-thread communication between client |
|
37 * and server. Hides also asynchronous notification services. |
|
38 * @since Series 60 3.0 |
|
39 * @lib wlmserver.lib |
|
40 */ |
|
41 NONSHARABLE_CLASS( RWLMServer ) : public RSessionBase, public MWLMNotify |
|
42 { |
|
43 friend class CWlmScanRequest; |
|
44 |
|
45 public: // Methods. |
|
46 |
|
47 /** |
|
48 * Structure for storing buffers for a traffic stream create request. |
|
49 */ |
|
50 struct TWlmTsCreateRequest |
|
51 { |
|
52 TWlmTsCreateRequest( |
|
53 const TWlanTrafficStreamParameters& aStreamParameters, |
|
54 TUint& aStreamId, |
|
55 TWlanTrafficStreamStatus& aStreamStatus ) : |
|
56 iTsParameterPckg( aStreamParameters ), |
|
57 iTsIdPckg( aStreamId ), |
|
58 iTsStatusPckg( aStreamStatus ) {}; |
|
59 |
|
60 /** Buffer for storing TSPEC parameters. */ |
|
61 TPckgBuf<TWlanTrafficStreamParameters> iTsParameterPckg; |
|
62 |
|
63 /** Buffer for storing traffic stream ID. */ |
|
64 TPckg<TUint> iTsIdPckg; |
|
65 |
|
66 /** Buffer for storing traffic stream status. */ |
|
67 TPckg<TWlanTrafficStreamStatus> iTsStatusPckg; |
|
68 }; |
|
69 |
|
70 // New methods |
|
71 |
|
72 /** |
|
73 * Cancel pending notification message from server. |
|
74 * CWLMNotify class uses this method to cancel pending message at server |
|
75 * side. |
|
76 */ |
|
77 void CancelRequest(); |
|
78 |
|
79 /** |
|
80 * Close the connection; release the handle to the server. |
|
81 */ |
|
82 IMPORT_C void Close(); |
|
83 |
|
84 /** |
|
85 * Set a message to pend notification. |
|
86 * @param aReturnValue Status of the calling active object. |
|
87 * @param aReturnData (OUT) Data returned by the notification. |
|
88 * @param aNotificationMask Bitmask of active notifications. |
|
89 */ |
|
90 void WaitForNotification( |
|
91 TRequestStatus& aReturnValue, |
|
92 TDes8& aReturnData, |
|
93 TUint32 aNotificationMask ); |
|
94 |
|
95 /** |
|
96 * Client activates the notification service. |
|
97 * With this service client can receive asynchronous notifications from |
|
98 * the server. |
|
99 * @param aCallback Client's callback interface for notifications. |
|
100 * @param aNotificationMask Bitmask of notifications to activate. |
|
101 * @see TWLMResponses |
|
102 */ |
|
103 IMPORT_C void ActivateNotifiesL( |
|
104 MWLMNotify& aCallback, |
|
105 TUint32 aNotificationMask ); |
|
106 |
|
107 /** |
|
108 * Client deactivates the notification service. |
|
109 * This is the client's interface to stop receiveing notifications from the |
|
110 * server. |
|
111 */ |
|
112 IMPORT_C void CancelNotifies(); |
|
113 |
|
114 /** |
|
115 * Client makes the connection to the server. |
|
116 * @return General Symbian error code. |
|
117 */ |
|
118 IMPORT_C TInt Connect(); |
|
119 |
|
120 /** |
|
121 * Version information. |
|
122 * @return Version information. |
|
123 */ |
|
124 TVersion Version() const; |
|
125 |
|
126 /** |
|
127 * Get connection state of WLAN. |
|
128 * @return Current state of WLAN connection. |
|
129 */ |
|
130 IMPORT_C TWlanConnectionState GetConnectionState(); |
|
131 |
|
132 /** |
|
133 * Get current connections RCPI. |
|
134 * @param aRCPI (OUT) Current signal strength of the connection, 0 if no WLAN connection. |
|
135 * @return General Symbian error code. |
|
136 */ |
|
137 IMPORT_C TInt GetConnectionRCPI( |
|
138 TInt32& aRCPI ); |
|
139 |
|
140 /** |
|
141 * Get scan results. |
|
142 * @param aResults (OUT) Results of the last scan. |
|
143 * @param aSsid SSID to be scanned. |
|
144 * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. |
|
145 * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. |
|
146 * @return General Symbian error code. |
|
147 */ |
|
148 IMPORT_C TInt GetScanResults( |
|
149 ScanList& aResults, |
|
150 const TDesC8& aSsid, |
|
151 TInt& aCacheLifetime, |
|
152 TUint& aMaxDelay ); |
|
153 |
|
154 /** |
|
155 * Get scan results. |
|
156 * @param aResults (OUT) Results of the last scan. |
|
157 * @param aSsid SSID to be scanned. |
|
158 * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. |
|
159 * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. |
|
160 * @param aStatus Status of the calling active object. |
|
161 */ |
|
162 IMPORT_C void GetScanResults( |
|
163 ScanList& aResults, |
|
164 const TDesC8& aSsid, |
|
165 TInt& aCacheLifetime, |
|
166 TUint& aMaxDelay, |
|
167 TRequestStatus& aStatus ); |
|
168 |
|
169 /** |
|
170 * Cancel an outstanding scan request. |
|
171 */ |
|
172 IMPORT_C void CancelGetScanResults(); |
|
173 |
|
174 /** |
|
175 * Join to a network using the settings from "IAP specific WLAN table". |
|
176 * |
|
177 * @param aStatus Status of the calling active object. |
|
178 * @param aId Index to the "IAP specific WLAN table". |
|
179 * @param aOverrides Override parameters to joining the network. |
|
180 */ |
|
181 IMPORT_C void Join( |
|
182 TRequestStatus& aStatus, |
|
183 const TUint32 aId, |
|
184 TWLMOverrideSettings* aOverrides = NULL ); |
|
185 |
|
186 /** |
|
187 * Cancel an outstanding join request. |
|
188 */ |
|
189 IMPORT_C void CancelJoin(); |
|
190 |
|
191 /** |
|
192 * Reset the network connection. |
|
193 * @return General Symbian error code. |
|
194 */ |
|
195 IMPORT_C TInt Release(); |
|
196 |
|
197 /** |
|
198 * Get the BSSID of the current connection. |
|
199 * @param aBssid The BSSID of the current connection. |
|
200 * If no connection a zero address is returned. |
|
201 * @return General Symbian error code. |
|
202 */ |
|
203 IMPORT_C TInt GetBSSID( |
|
204 TMacAddress& aBssid ); |
|
205 |
|
206 /** |
|
207 * Get the name of the current network. |
|
208 * @param aNwName (OUT) The name of the current network. |
|
209 * @return General Symbian error code. |
|
210 */ |
|
211 IMPORT_C TInt GetNetworkName( |
|
212 TDes& aNwName ); |
|
213 |
|
214 /** |
|
215 * Get current security mode. |
|
216 * @param aMode (OUT) The current security mode. |
|
217 * @return General Symbian error code. |
|
218 */ |
|
219 IMPORT_C TInt GetSecurityMode( |
|
220 TWlanSecurity& aMode ); |
|
221 |
|
222 /** |
|
223 * Get current system mode. |
|
224 * @param aMode (OUT) The current system mode. |
|
225 * @return General Symbian error code. |
|
226 */ |
|
227 IMPORT_C TInt GetSystemMode( |
|
228 TWlanSystemMode& aMode ); |
|
229 |
|
230 /** |
|
231 * Get available WLAN IAPs. |
|
232 * @param aAvailableIaps Array of IAP IDs available. |
|
233 * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. |
|
234 * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. |
|
235 * @return General Symbian error code. |
|
236 */ |
|
237 IMPORT_C TInt GetAvailableIaps( |
|
238 TWlmAvailableIaps& aAvailableIaps, |
|
239 TInt& aCacheLifetime, |
|
240 TUint& aMaxDelay ); |
|
241 |
|
242 /** |
|
243 * Get available WLAN IAPs. |
|
244 * @param aAvailableIaps Array of IAP IDs available. |
|
245 * @param aCacheLifetime how old cached results (in seconds) the client is willing to accept. |
|
246 * @param aMaxDelay maximum time (in seconds) the client is willing to wait for the scan results. |
|
247 * @param aStatus Status of the calling active object. |
|
248 * |
|
249 * In order to call this method, an instance of TWlmAvailableIaps must |
|
250 * packaged into a TPckg<TWlmAvailableIaps> package buffer. This buffer |
|
251 * can be passed to the called method as a descriptor. |
|
252 * |
|
253 * Example: |
|
254 * TPckg<TWlmAvailableIaps> availableIapsBuf( availableIaps ); |
|
255 * GetAvailableIaps( availableIapsBuf, cacheLifetime, maxDelay, status ); |
|
256 */ |
|
257 IMPORT_C void GetAvailableIaps( |
|
258 TDes8& aAvailableIaps, |
|
259 TDes8& aCacheLifetime, |
|
260 TDes8& aMaxDelay, |
|
261 TRequestStatus& aStatus ); |
|
262 |
|
263 /** |
|
264 * Cancel an outstanding IAP availability request. |
|
265 */ |
|
266 IMPORT_C void CancelGetAvailableIaps(); |
|
267 |
|
268 /** |
|
269 * Notify the server about changed WLAN settings. |
|
270 */ |
|
271 IMPORT_C void NotifyChangedSettings(); |
|
272 |
|
273 /** |
|
274 * Adds a BSSID to rogue list |
|
275 * @param aBssid a BSSID of an accesspoint. |
|
276 * @return Error code. |
|
277 */ |
|
278 IMPORT_C TInt AddBssidToRoguelist( |
|
279 const TMacAddress& aBssid ); |
|
280 |
|
281 /** |
|
282 * Updates the RCP notification class boundaries. |
|
283 * @param aRcpLevelBoundary specifies the RCP level when notification |
|
284 * should be given. This boundary is used when signal level is |
|
285 * getting worse (see next parameter). |
|
286 * @param aHysteresis specifies the difference between RCP notification |
|
287 * trigger levels of declining and improving signal quality. |
|
288 * I.e. since aRcpLevelBoundary specifies the level boundary for |
|
289 * declining signal, the same boundary for imrpoving signal is |
|
290 * ( aRcpLevelBoundary - aHysteresis ). |
|
291 * @return Error value |
|
292 */ |
|
293 IMPORT_C TInt UpdateRcpNotificationBoundary( |
|
294 const TInt32 aRcpLevelBoundary, |
|
295 const TInt32 aHysteresis ); |
|
296 |
|
297 /** |
|
298 * ConfigureMulticast |
|
299 * @param aCommand specifies either KSoIp6JoinGroup or |
|
300 * KSoIp6LeaveGroup |
|
301 * @param aMulticastAddress contains the MAC address |
|
302 * @return Error code. |
|
303 */ |
|
304 IMPORT_C TInt ConfigureMulticast( |
|
305 TUint aCommand, |
|
306 const TMacAddress& aMulticastAddress ); |
|
307 |
|
308 /** |
|
309 * Get packet statistics of the current connection. |
|
310 * |
|
311 * @since S60 v3.2 |
|
312 * @param aStatistics Packet statistics of the current connection. |
|
313 * @return KErrNone if statistics were read successfully, an error otherwise. |
|
314 */ |
|
315 IMPORT_C TInt GetPacketStatistics( |
|
316 TWlanPacketStatistics& aStatistics ); |
|
317 |
|
318 /** |
|
319 * Clear packet statistics of the current connection. |
|
320 * |
|
321 * @since S60 v3.2 |
|
322 */ |
|
323 IMPORT_C void ClearPacketStatistics(); |
|
324 |
|
325 /** |
|
326 * Get the current U-APSD settings. |
|
327 * |
|
328 * @since S60 v3.2 |
|
329 * @param aSettings Current U-APSD settings. |
|
330 * @return KErrNone if settings were read successfully, an error otherwise. |
|
331 */ |
|
332 IMPORT_C TInt GetUapsdSettings( |
|
333 TWlanUapsdSettings& aSettings ); |
|
334 |
|
335 /** |
|
336 * Set the U-APSD settings. |
|
337 * |
|
338 * @since S60 v3.2 |
|
339 * @param aSettings Current U-APSD settings to be set. |
|
340 * @return KErrNone if settings were set successfully, an error otherwise. |
|
341 */ |
|
342 IMPORT_C TInt SetUapsdSettings( |
|
343 const TWlanUapsdSettings& aSettings ); |
|
344 |
|
345 /** |
|
346 * Get the current power save settings. |
|
347 * |
|
348 * @since S60 v3.2 |
|
349 * @param aSettings power save settings. |
|
350 * @return KErrNone if settings were read successfully, an error otherwise. |
|
351 */ |
|
352 IMPORT_C TInt GetPowerSaveSettings( |
|
353 TWlanPowerSaveSettings& aSettings ); |
|
354 |
|
355 /** |
|
356 * Set the power save settings. |
|
357 * |
|
358 * @since S60 v3.2 |
|
359 * @param aSettings Current power save settings to be set. |
|
360 * @return KErrNone if settings were set successfully, an error otherwise. |
|
361 */ |
|
362 IMPORT_C TInt SetPowerSaveSettings( |
|
363 const TWlanPowerSaveSettings& aSettings ); |
|
364 |
|
365 /** |
|
366 * Run Protected Setup. |
|
367 * @param aStatus Status of the calling active object. |
|
368 * @param aId IAP ID of network which user has selected to be configured. |
|
369 * @param Results of a successful Protected Setup operation. |
|
370 */ |
|
371 IMPORT_C void RunProtectedSetup( |
|
372 TRequestStatus& aStatus, |
|
373 TUint32 aId, |
|
374 TDes8& aCredentials ); |
|
375 |
|
376 /** |
|
377 * Cancel an outstanding Protected Setup request. |
|
378 */ |
|
379 IMPORT_C void CancelProtectedSetup(); |
|
380 |
|
381 /** |
|
382 * Create a virtual traffic stream. |
|
383 * |
|
384 * @param aStatus Status of the calling active object. On successful |
|
385 * completion contains KErrNone, otherwise one of the |
|
386 * system-wide error codes. |
|
387 * @param aStreamParameters Traffic stream parameters to use. |
|
388 * @param aIsAutomaticStream Whether the stream was created automatically |
|
389 * by WLAN NIF. |
|
390 * @param aStreamId Contains the ID assigned to this traffic stream |
|
391 * on successful completion. |
|
392 * @param aStreamStatus Contains the status of the traffic stream |
|
393 * on successful completion. |
|
394 */ |
|
395 IMPORT_C void CreateTrafficStream( |
|
396 TRequestStatus& aStatus, |
|
397 const TWlanTrafficStreamParameters& aStreamParameters, |
|
398 TBool aIsAutomaticStream, |
|
399 TUint& aStreamId, |
|
400 TWlanTrafficStreamStatus& aStreamStatus ); |
|
401 |
|
402 /** |
|
403 * Cancel an outstanding traffic stream creation request. |
|
404 * |
|
405 * @since S60 v3.2 |
|
406 */ |
|
407 IMPORT_C void CancelCreateTrafficStream(); |
|
408 |
|
409 /** |
|
410 * Delete a virtual traffic stream. |
|
411 * |
|
412 * @param aStatus Status of the calling active object. On successful |
|
413 * completion contains KErrNone, otherwise one of the |
|
414 * system-wide error codes. |
|
415 * @param aStreamId ID of the traffic stream to delete. |
|
416 */ |
|
417 IMPORT_C void DeleteTrafficStream( |
|
418 TRequestStatus& aStatus, |
|
419 TUint aStreamId ); |
|
420 /** |
|
421 * Cancel an outstanding traffic stream deletion request. |
|
422 * |
|
423 * @since S60 v3.2 |
|
424 */ |
|
425 IMPORT_C void CancelDeleteTrafficStream(); |
|
426 |
|
427 /** |
|
428 * Get information about the current AP. |
|
429 * |
|
430 * @since S60 v3.2 |
|
431 * @param aInfo Information about the current AP. |
|
432 * @return KErrNone if information is available, an error otherwise. |
|
433 */ |
|
434 IMPORT_C TInt GetAccessPointInfo( |
|
435 TWlanAccessPointInfo& aInfo ); |
|
436 |
|
437 /** |
|
438 * Get roam metrics of the current connection. |
|
439 * |
|
440 * @since S60 v3.2 |
|
441 * @param aRoamMetrics Roam metrics of the current connection. |
|
442 * @return KErrNone if settings were read successfully, an error otherwise. |
|
443 */ |
|
444 IMPORT_C TInt GetRoamMetrics( |
|
445 TWlanRoamMetrics& aRoamMetrics ); |
|
446 |
|
447 /** |
|
448 * Return a list of BSSIDs on the rogue list. |
|
449 * |
|
450 * @since S60 v3.2 |
|
451 * @param aRogueList List of BSSIDs on the rogue list. |
|
452 * @return KErrNone if list were read successfully, an error otherwise. |
|
453 */ |
|
454 IMPORT_C TInt GetRogueList( |
|
455 CArrayFixSeg<TWlanBssid>& aRogueList ); |
|
456 |
|
457 /** |
|
458 * Get the current regulatory domain. |
|
459 * |
|
460 * @since S60 v3.2 |
|
461 * @param aRegion current region. |
|
462 * @return KErrNone if value was read successfully, an error otherwise. |
|
463 */ |
|
464 IMPORT_C TInt GetRegulatoryDomain( |
|
465 TWlanRegion& aRegion ); |
|
466 |
|
467 /** |
|
468 * Get the current power save mode. |
|
469 * |
|
470 * @since S60 v3.2 |
|
471 * @param aPowerSaveMode current power save mode. |
|
472 * @return KErrNone if value was read successfully, an error otherwise. |
|
473 */ |
|
474 IMPORT_C TInt GetPowerSaveMode( |
|
475 TWlanPowerSave& aPowerSaveMode ); |
|
476 |
|
477 /** |
|
478 * Add a list of SSIDs to the given IAP ID. |
|
479 * |
|
480 * The list of SSIDs is matched against the scan results during IAP availability |
|
481 * check and the corresponding IAP marked as available if a match is found. |
|
482 * |
|
483 * @since S60 v5.0.1 |
|
484 * @param aIapId IAP ID the list is attached to. |
|
485 * @param aSsidList List of SSIDs. Any previous list attached will be overwritten. |
|
486 * @return KErrNone if the list was successfully added, an error code otherwise. |
|
487 */ |
|
488 IMPORT_C TInt AddIapSsidList( |
|
489 TUint aIapId, |
|
490 const CArrayFixFlat<TWlanSsid>& aSsidList ); |
|
491 |
|
492 /** |
|
493 * Remove any list of SSIDs attached to the given IAP ID. |
|
494 * |
|
495 * @since S60 v5.0.1 |
|
496 * @param aIapId IAP ID the list is attached to. |
|
497 * @return KErrNone if the list was successfully removed, an error code otherwise. |
|
498 */ |
|
499 IMPORT_C TInt RemoveIapSsidList( |
|
500 TUint aIapId ); |
|
501 |
|
502 /** |
|
503 * Set the power save mode. |
|
504 * |
|
505 * @since S60 v5.0.1 |
|
506 * @param aMode Power save mode to be set. |
|
507 * @return KErrNone if the mode was set successfully, an error otherwise. |
|
508 */ |
|
509 IMPORT_C TInt SetPowerSaveMode( |
|
510 TWlanPowerSaveMode aMode ); |
|
511 |
|
512 /** |
|
513 * Notify the server about PSM server mode change. |
|
514 * |
|
515 * @since S60 v5.2 |
|
516 * @param aMode new PSM server mode. |
|
517 * @return KErrNone if the mode was set successfully, an error otherwise. |
|
518 */ |
|
519 IMPORT_C TInt NotifyChangedPsmSrvMode( |
|
520 TInt aMode ); |
|
521 |
|
522 /** |
|
523 * Get the current traffic status for access classes. |
|
524 * |
|
525 * @since S60 v5.0.1 |
|
526 * @param aArray Traffic status for access classes. |
|
527 * @return KErrNone if information is available, an error otherwise. |
|
528 */ |
|
529 IMPORT_C TInt GetAcTrafficStatus( |
|
530 TWlmAcTrafficStatusArray& aArray ); |
|
531 |
|
532 /** |
|
533 * Initiate a roam to the given BSSID. |
|
534 * |
|
535 * @param aStatus Status of the calling active object. On successful |
|
536 * completion contains KErrNone, otherwise one of the |
|
537 * system-wide error codes. |
|
538 * @param aBssid BSSID to roam to. If set to FF:FF:FF:FF:FF:FF address, |
|
539 * search for a better BSS is initiated. |
|
540 */ |
|
541 IMPORT_C void DirectedRoam( |
|
542 TRequestStatus& aStatus, |
|
543 const TMacAddress& aBssid ); |
|
544 |
|
545 /** |
|
546 * Cancel an outstanding directed roam request. |
|
547 */ |
|
548 IMPORT_C void CancelDirectedRoam(); |
|
549 |
|
550 protected: // Methods |
|
551 |
|
552 /** |
|
553 * Start the server during Connect() if the server is not loaded. |
|
554 * @return error code |
|
555 */ |
|
556 TInt StartServer(); |
|
557 |
|
558 private: // Members |
|
559 |
|
560 /** Notification service. Exists only if its activated. */ |
|
561 CWLMNotify* iNotify; |
|
562 |
|
563 /** Class for handling scan requests. */ |
|
564 CWlmScanRequest* iScanRequest; |
|
565 |
|
566 /** Parameters for traffic stream create request. */ |
|
567 TWlmTsCreateRequest* iTsCreateRequest; |
|
568 |
|
569 /** Buffer for storing override settings. */ |
|
570 TPckgBuf<TWLMOverrideSettings> iOverridePckg; |
|
571 |
|
572 /** Buffer for storing BSSID to roam to. */ |
|
573 TPckgBuf<TMacAddress> iRoamBssidPckg; |
|
574 }; |
|
575 |
|
576 #endif // RWLMSERVER_H |