|
1 /* |
|
2 * Copyright (c) 2002-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 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: Driver interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WLMDRIVERIF_H |
|
20 #define WLMDRIVERIF_H |
|
21 |
|
22 #include "802dot11.h" |
|
23 #include "RWlanLogicalChannel.h" |
|
24 |
|
25 #include "abs_core_driverif.h" // Derived |
|
26 #include "wlannotificationhandler.h" // Derived |
|
27 #include "wlanmgmtframehandler.h" // Derived |
|
28 #include "wlanmgmtcommandhandler.h" // Derived |
|
29 #include "wlanmgmtpacket.h" |
|
30 |
|
31 class abs_core_driverif_callback_c; |
|
32 class CWlanHwInit; |
|
33 |
|
34 /** |
|
35 * CWlmDriverIf |
|
36 * |
|
37 * @lib wlmserversrv.lib |
|
38 * @since Series 60 3.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CWlmDriverIf ) : |
|
41 public CBase, |
|
42 public abs_core_driverif_c, |
|
43 public MWlanNotificationCallback, |
|
44 public MWlanMgmtFrameCallback, |
|
45 public MWlanMgmtCommandCallback |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 static CWlmDriverIf* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CWlmDriverIf(); |
|
58 |
|
59 public: // Functions from base classes |
|
60 |
|
61 // |
|
62 // Functions from abs_core_driverif_c |
|
63 // |
|
64 |
|
65 /** |
|
66 * Initialisation between core server - driverIf |
|
67 * |
|
68 * @since S60 v3.1 |
|
69 * @param core_callback delivers callback interface to driverIf |
|
70 */ |
|
71 void init( |
|
72 abs_core_driverif_callback_c* core_callback ); |
|
73 |
|
74 /** |
|
75 * Start an IBSS network. |
|
76 * |
|
77 * @since S60 v3.1 |
|
78 * @param request_id An unique identification for the request. |
|
79 * @param ssid Name of the network. |
|
80 * @param beacon_interval Beacon interval in TUs. |
|
81 * @param channel Used channel (1 - 11). |
|
82 * @param encrypt_level Used encryption level. |
|
83 */ |
|
84 void start_ibss( |
|
85 u32_t request_id, |
|
86 const core_ssid_s& ssid, |
|
87 u32_t beacon_interval, |
|
88 u32_t channel, |
|
89 core_encryption_mode_e encrypt_level ); |
|
90 |
|
91 /** |
|
92 * Request available networks with the given SSID. |
|
93 * |
|
94 * @since S60 v3.1 |
|
95 * @param request_id An unique identification for the request. |
|
96 * @param scan_mode Defines whether active or passive scan is performed. |
|
97 * @param scan_ssid Name of the network to scan for. |
|
98 * @param scan_rate Scan rate in units of 500kbit/second. |
|
99 * @param scan_channels Channels to scan. |
|
100 * @param scan_min_ch_time Minimum time to listen for beacons/probe responses on a channel. |
|
101 * @param scan_max_ch_time Maximum time to listen for beacons/probe responses on a channel. |
|
102 * @param is_split_scan Whether the scan should be performed as a split-scan. |
|
103 * @note If the length of the SSID is zero, a broadcast scan is performed. |
|
104 */ |
|
105 void scan( |
|
106 u32_t request_id, |
|
107 core_scan_mode_e scan_mode, |
|
108 const core_ssid_s& scan_ssid, |
|
109 int_t scan_rate, |
|
110 const core_scan_channels_s& scan_channels, |
|
111 u32_t scan_min_ch_time, |
|
112 u32_t scan_max_ch_time, |
|
113 bool_t is_split_scan ); |
|
114 |
|
115 /** |
|
116 * Request an ongoing scan to be stopped. |
|
117 * |
|
118 * @since S60 v3.1 |
|
119 * @param request_id An unique identification for the request. |
|
120 */ |
|
121 void stop_scan( |
|
122 u32_t request_id ); |
|
123 |
|
124 /** |
|
125 * Connect (authenticate and associate) to a BSS. |
|
126 * |
|
127 * @since S60 v3.1 |
|
128 * @param request_id An unique identification for the request. |
|
129 * @param status The status code from the connection attempt is stored here. |
|
130 * @param ssid Name of the network. |
|
131 * @param bssid BSSID of the access point. |
|
132 * @param auth_algorithm Authentication algorithm number. |
|
133 * @param encryption_level Used encryption level. |
|
134 * @param pairwise_key_type Pairwise cipher key type to be used. |
|
135 * @param is_infra Whether the network is an IBSS or an infra network. |
|
136 * @param ie_data_length Length of IE data. |
|
137 * @param ie_data IE data. |
|
138 * @param scan_frame_length Length of beacon/probe response frame from the BSS. |
|
139 * @param scan_frame Pointer to beacon/probe response frame from the BSS. |
|
140 * @param is_pairwise_key_invalidated Whether the pairwise key should be invalidated. |
|
141 * @param is_group_key_invalidated Whether the group key should be invalidated |
|
142 * @param is_radio_measurement_supported Whether the radio measurement is supported |
|
143 */ |
|
144 void connect( |
|
145 u32_t request_id, |
|
146 core_management_status_e& status, |
|
147 const core_ssid_s& ssid, |
|
148 const core_mac_address_s& bssid, |
|
149 u16_t auth_algorithm, |
|
150 core_encryption_mode_e encryption_level, |
|
151 core_cipher_key_type_e pairwise_key_type, |
|
152 bool_t is_infra, |
|
153 u32_t ie_data_length, |
|
154 const u8_t* ie_data, |
|
155 u32_t scan_frame_length, |
|
156 const u8_t* scan_frame, |
|
157 bool_t is_pairwise_key_invalidated, |
|
158 bool_t is_group_key_invalidated, |
|
159 bool_t is_radio_measurement_supported ); |
|
160 |
|
161 /** |
|
162 * Disconnect from the current network. |
|
163 * |
|
164 * @since S60 v3.1 |
|
165 * @param request_id An unique identification for the request. |
|
166 */ |
|
167 void disconnect( |
|
168 u32_t request_id ); |
|
169 |
|
170 /** |
|
171 * Set WLAN power mode. |
|
172 * |
|
173 * @since S60 v3.1 |
|
174 * @param request_id An unique identification for the request. |
|
175 * @param mode Power save mode to use. |
|
176 */ |
|
177 void set_power_mode( |
|
178 u32_t request_id, |
|
179 const core_power_mode_s& mode ); |
|
180 |
|
181 /** |
|
182 * Set transmission power level. |
|
183 * |
|
184 * @since S60 v3.1 |
|
185 * @param request_id An unique identification for the request. |
|
186 * @param tx_level Transmission power level in dBm. |
|
187 */ |
|
188 void set_tx_power_level( |
|
189 u32_t request_id, |
|
190 u32_t tx_level ); |
|
191 |
|
192 /** |
|
193 * Add a cipher key. |
|
194 * |
|
195 * @since S60 v3.1 |
|
196 * @param cipher_suite The cipher suite of the key. |
|
197 * @param key_index Index of the key. |
|
198 * @param key_length Length of the cipher key. |
|
199 * @param key_data Cipher key data. |
|
200 * @param mac Defines the MAC address the key is used for. |
|
201 * @param use_as_default in case of wep, whether the key is used as default cipher key |
|
202 */ |
|
203 void add_cipher_key( |
|
204 core_cipher_key_type_e cipher_suite, |
|
205 u8_t key_index, |
|
206 u16_t key_length, |
|
207 const u8_t* key_data, |
|
208 const core_mac_address_s& mac, |
|
209 bool_t use_as_default ); |
|
210 |
|
211 /** |
|
212 * Get the current RCPI value. |
|
213 * |
|
214 * @since S60 v3.1 |
|
215 * @param request_id An unique identification for the request. |
|
216 * @param rcpi The current RCPI value. |
|
217 */ |
|
218 void get_current_rcpi( |
|
219 u32_t request_id, |
|
220 u32_t& rcpi ); |
|
221 |
|
222 /** |
|
223 * Delivers multicast MAC address to drivers. |
|
224 * |
|
225 * @since S60 v3.1 |
|
226 * @param request_id An unique identification for the request. |
|
227 * @param join_group is set true_t if adding a multicast address |
|
228 * otherwise the address will be removed. |
|
229 * @param multicast_addr contains the MAC address to add/remove |
|
230 */ |
|
231 void configure_multicast_group( |
|
232 u32_t request_id, |
|
233 bool_t join_group, |
|
234 const core_mac_address_s& multicast_addr ); |
|
235 |
|
236 /** |
|
237 * Set the parameters related to BSS lost indication. |
|
238 * |
|
239 * @since S60 v3.1 |
|
240 * @param request_id Identification of the corresponding request. |
|
241 * @param parameters Parameters to set. |
|
242 */ |
|
243 void set_bss_lost_parameters( |
|
244 u32_t request_id, |
|
245 const core_bss_lost_parameters_s& parameters ); |
|
246 |
|
247 /** |
|
248 * Set the parameters related to tx rate adaptation algorithm. |
|
249 * |
|
250 * @since S60 v3.1 |
|
251 * @param request_id Identification of the corresponding request. |
|
252 * @param parameters Parameters to set. |
|
253 */ |
|
254 void set_tx_rate_adaptation_parameters( |
|
255 u32_t request_id, |
|
256 const core_tx_rate_adaptation_parameters_s& parameters ); |
|
257 |
|
258 /** |
|
259 * Set the parameters related to power mode management. |
|
260 * |
|
261 * @since S60 v3.1 |
|
262 * @param request_id Identification of the corresponding request. |
|
263 * @param parameters Parameters to set. |
|
264 */ |
|
265 void set_power_mode_mgmt_parameters( |
|
266 u32_t request_id, |
|
267 const core_power_mode_mgmt_parameters_s& parameters ); |
|
268 |
|
269 /** |
|
270 * Set the parameters related to TX rate policies. |
|
271 * |
|
272 * @since S60 v3.2 |
|
273 * @param request_id Identification of the corresponding request. |
|
274 * @param policies TX rate policies to set. |
|
275 * @param mappings Mappings between Access Classes and TX rate policies. |
|
276 */ |
|
277 void set_tx_rate_policies( |
|
278 u32_t request_id, |
|
279 const core_tx_rate_policies_s& policies, |
|
280 const core_tx_rate_policy_mappings_s& mappings ); |
|
281 |
|
282 /** |
|
283 * Get packet statistics for the currently active connection. |
|
284 * |
|
285 * @since S60 v3.2 |
|
286 * @param request_id Identification of the corresponding request. |
|
287 * @param statistics Packet statistics for the currently active connection. |
|
288 */ |
|
289 void get_packet_statistics( |
|
290 u32_t request_id, |
|
291 core_packet_statistics_by_access_category_s& statistics ); |
|
292 |
|
293 /** |
|
294 * Set the RCPI trigger level. |
|
295 * |
|
296 * @since S60 v3.2 |
|
297 * @param request_id Identification of the corresponding request. |
|
298 * @param rcpi_trigger The RCPI trigger level. |
|
299 */ |
|
300 void set_rcpi_trigger_level( |
|
301 u32_t request_id, |
|
302 u8_t rcpi_trigger ); |
|
303 |
|
304 /** |
|
305 * Set the U-APSD settings. |
|
306 * |
|
307 * @since S60 v3.2 |
|
308 * @param request_id Identification of the corresponding request. |
|
309 * @param settings Current U-APSD settings to be set. |
|
310 */ |
|
311 void set_uapsd_settings( |
|
312 u32_t request_id, |
|
313 const core_uapsd_settings_s& settings ); |
|
314 |
|
315 /** |
|
316 * Set the power save settings. |
|
317 * |
|
318 * @since S60 v3.2 |
|
319 * @param request_id Identification of the corresponding request. |
|
320 * @param settings Current power save settings to be set. |
|
321 */ |
|
322 void set_power_save_settings( |
|
323 u32_t request_id, |
|
324 const core_power_save_settings_s& settings ); |
|
325 |
|
326 /** |
|
327 * Set the parameters of a tx queue. |
|
328 * |
|
329 * @since S60 v3.2 |
|
330 * @param request_id Identification of the corresponding request. |
|
331 * @param queue_id Queue to be configured. |
|
332 * @param medium_time Medium time to be used. |
|
333 * @param max_tx_msdu_lifetime Maximum Transmit MSDU Lifetime to be used. |
|
334 */ |
|
335 void set_tx_queue_parameters( |
|
336 u32_t request_id, |
|
337 core_access_class_e queue_id, |
|
338 u16_t medium_time, |
|
339 u32_t max_tx_msdu_lifetime ); |
|
340 |
|
341 /** |
|
342 * Allow sending of user data. |
|
343 * |
|
344 * @since S60 v3.1 |
|
345 * @param request_id An unique identification for the request. |
|
346 */ |
|
347 void enable_user_data( |
|
348 u32_t request_id ); |
|
349 |
|
350 /** |
|
351 * Prevent sending of user data. |
|
352 * |
|
353 * @since S60 v3.1 |
|
354 * @param request_id An unique identification for the request. |
|
355 */ |
|
356 void disable_user_data( |
|
357 u32_t request_id ); |
|
358 |
|
359 /** |
|
360 * Unload the drivers and power down the WLAN hardware. |
|
361 * |
|
362 * @since S60 v3.1 |
|
363 * @param request_id An unique identification for the request. |
|
364 */ |
|
365 void unload_drivers( |
|
366 u32_t request_id ); |
|
367 |
|
368 /** |
|
369 * Load the drivers and power up the WLAN hardware. |
|
370 * |
|
371 * @since S60 v3.1 |
|
372 * @param request_id An unique identification for the request. |
|
373 * @param rts_threshold Determines the maximum packet size that can be sent without RTS/CTS protocol. |
|
374 * @param max_tx_msdu_lifetime Maximum time to (re-)send the whole MSDU packet in TUs. |
|
375 * @param qos_null_frame_entry_timeout Defines the time period in microseconds which is used |
|
376 * to evaluate whether QoS NULL data frame sending should be started. |
|
377 * @param qos_null_frame_entry_tx_count Defines how many Voice AC packets must be sent during the time |
|
378 * period defined in qos_null_frame_entry_timeout before QoS NULL |
|
379 * data frame sending is started. |
|
380 * @param qos_null_frame_interval Defines how often a QoS NULL data frame is sent. |
|
381 * @param qos_null_frame_exit_timeout Defines how soon after the last Voice AC packet QoS NULL data |
|
382 * frame sending is stopped. |
|
383 * @param keep_alive_interval Defines how often NULL data frames are sent if there are no other frames |
|
384 * to send. |
|
385 * @param sp_rcpi_target Defines the signal predictor algorithm "target" RCPI value for roam indication. |
|
386 * @param sp_time_target Defines the signal predictor algorithm "target" time for roam indication |
|
387 * (in microseconds). |
|
388 * @param sp_min_indication_interval Defines the minimum time interval for consecutive roam |
|
389 * indications from the signal predictor algorithm (in microseconds). |
|
390 */ |
|
391 void load_drivers( |
|
392 u32_t request_id, |
|
393 uint_t rts_threshold, |
|
394 u32_t max_tx_msdu_lifetime, |
|
395 u32_t qos_null_frame_entry_timeout, |
|
396 u32_t qos_null_frame_entry_tx_count, |
|
397 u32_t qos_null_frame_interval, |
|
398 u32_t qos_null_frame_exit_timeout, |
|
399 u32_t keep_alive_interval, |
|
400 u32_t sp_rcpi_target, |
|
401 u32_t sp_time_target, |
|
402 u32_t sp_min_indication_interval ); |
|
403 |
|
404 /** |
|
405 * Send a frame. |
|
406 * |
|
407 * @since S60 v3.1 |
|
408 * @param frame_type The type of the frame to send. |
|
409 * @param frame_length The length of the frame. |
|
410 * @param frame_data Pointer to the frame data. |
|
411 * @param frame_priority User priority to use for sending the frame. |
|
412 * @param destination Destination MAC address. |
|
413 * @param send_unencrypted Whether the frame must be sent unencrypted. |
|
414 */ |
|
415 void send_frame( |
|
416 core_frame_type_e frame_type, |
|
417 const u16_t frame_length, |
|
418 const u8_t* const frame_data, |
|
419 u8_t frame_priority, |
|
420 const core_mac_address_s& destination, |
|
421 bool_t send_unencrypted ); |
|
422 |
|
423 /** |
|
424 * Cancel a pending asynchronous request. |
|
425 * |
|
426 * @since S60 v3.1 |
|
427 * @param request_id Identification of the corresponding request. |
|
428 */ |
|
429 void cancel_request( |
|
430 u32_t request_id ); |
|
431 |
|
432 /** |
|
433 * Set the ARP filter. |
|
434 * |
|
435 * @since S60 v5.0 |
|
436 * @param request_id Identification of the corresponding request. |
|
437 * @param filter Current ARP filter to be set. |
|
438 */ |
|
439 void set_arp_filter( |
|
440 u32_t request_id, |
|
441 const core_arp_filter_s& filter ); |
|
442 |
|
443 /** |
|
444 * Set block ACK usage per traffic stream. |
|
445 * |
|
446 * @since S60 v5.1 |
|
447 * @param request_id Identification of the corresponding request. |
|
448 * @param usage Block ACK usage information. |
|
449 */ |
|
450 void set_block_ack_usage( |
|
451 u32_t request_id, |
|
452 const core_block_ack_usage_s& usage ); |
|
453 |
|
454 /** |
|
455 * Set the SNAP header of frames to receive. |
|
456 * |
|
457 * @since S60 v5.1 |
|
458 * @param request_id Identification of the corresponding request. |
|
459 * @param header SNAP header of frames to receive. |
|
460 */ |
|
461 void set_snap_header_filter( |
|
462 u32_t request_id, |
|
463 const core_snap_header_s& header ); |
|
464 |
|
465 // |
|
466 // Functions for handler callbacks |
|
467 // |
|
468 /** |
|
469 * From MWlanNotificationCallback |
|
470 * Notification event received from driver side |
|
471 * |
|
472 * @since S60 v3.1 |
|
473 * @param indication |
|
474 */ |
|
475 void OnNotify( const TIndication& aIndication ); |
|
476 |
|
477 /** |
|
478 * From MWlanMgmtFrameCallback |
|
479 * Management frame received from driver side |
|
480 * |
|
481 * @since S60 v3.1 |
|
482 * @param aFrameType specifies the frame type |
|
483 * @param aLength of the frame data |
|
484 * @param aData contains the frame |
|
485 * @param aRcpi RCPI value of the frame. |
|
486 */ |
|
487 void OnFrameReceive( |
|
488 const TDataBuffer::TFrameType aFrameType, |
|
489 const TUint aLength, |
|
490 const TUint8* const aData, |
|
491 TUint8 aRcpi ); |
|
492 |
|
493 /** |
|
494 * From MWlanMgmtCommandCallback |
|
495 * Management command completion callback received from driver side |
|
496 * |
|
497 * @since S60 v3.1 |
|
498 * @param command completion status |
|
499 */ |
|
500 void OnRequestComplete( TInt status ); |
|
501 |
|
502 /** |
|
503 * GetMacAddress is called by CWlmServer during startup |
|
504 * @param aMac contains the MAC address on completion |
|
505 * @return error code |
|
506 */ |
|
507 TInt GetMacAddress( TMacAddress& aMac ); |
|
508 |
|
509 /** |
|
510 * Notify the core server about an adaptation event. |
|
511 * @param aIndication Adaptation event. |
|
512 */ |
|
513 void Notify( core_am_indication_e aIndication ); |
|
514 |
|
515 private: |
|
516 |
|
517 /** |
|
518 * C++ default constructor. |
|
519 */ |
|
520 CWlmDriverIf(); |
|
521 |
|
522 /** |
|
523 * By default Symbian 2nd phase constructor is private. |
|
524 */ |
|
525 void ConstructL(); |
|
526 |
|
527 /** |
|
528 * Async callback function |
|
529 * @param aThisPtr Pointer to the event data. |
|
530 * @return error code |
|
531 */ |
|
532 static TInt AsynchCallbackFunction( TAny* aThisPtr ); |
|
533 |
|
534 /** |
|
535 * UnloadDrivers |
|
536 * @since S60 v3.1 |
|
537 */ |
|
538 void UnloadDrivers(); |
|
539 |
|
540 /** |
|
541 * SetRequestId sets the new requestId to iPendingRequestId |
|
542 * if no prior requests pending. |
|
543 * @since S60 v3.1 |
|
544 * @param aRequestId specifies the request id |
|
545 * @return error code |
|
546 */ |
|
547 TInt SetRequestId( TUint32 aRequestId ); |
|
548 |
|
549 private: // Data |
|
550 |
|
551 /** |
|
552 * Callback interface to core server. Not owned by this pointer. |
|
553 */ |
|
554 abs_core_driverif_callback_c* iCoreServer; |
|
555 /** |
|
556 * Pending command's requestId |
|
557 */ |
|
558 TUint32 iPendingRequestId; |
|
559 |
|
560 /** |
|
561 * Handler for notifications |
|
562 */ |
|
563 CWlanNotificationHandler* iNotificationHandler; |
|
564 /** |
|
565 * Handler for management commands |
|
566 */ |
|
567 CWlanMgmtCommandHandler* iManagementCommandHandler; |
|
568 /** |
|
569 * Handler for received management frames |
|
570 */ |
|
571 CWlanMgmtFrameHandler* iManagementFrameHandler; |
|
572 |
|
573 /** |
|
574 * Asynchronous callback |
|
575 */ |
|
576 CAsyncCallBack* iAsynchCallback; |
|
577 /** |
|
578 * Error status that will be returned in case asynch callback is called |
|
579 */ |
|
580 core_error_e iErrorStatus; |
|
581 |
|
582 /** |
|
583 * Handle to hardware specific client that reads initialization |
|
584 * data from CMT side |
|
585 */ |
|
586 CWlanHwInit* iHwInit; |
|
587 |
|
588 /** |
|
589 * Interface to access LDD |
|
590 */ |
|
591 RWlanLogicalChannel iChannel; |
|
592 /** |
|
593 * TRUE if PDD loaded |
|
594 */ |
|
595 TBool iIsPDDLoaded; |
|
596 /** |
|
597 * TRUE if LDD loaded |
|
598 */ |
|
599 TBool iIsLDDLoaded; |
|
600 |
|
601 /** |
|
602 * If defined, association response status is stored here. |
|
603 * Not owned by this pointer. |
|
604 */ |
|
605 core_management_status_e* iManagementStatus; |
|
606 }; |
|
607 |
|
608 #endif // WLMDRIVERIF_H |