4 #ifndef __WIFI_HAL_GSCAN_H__
5 #define __WIFI_HAL_GSCAN_H__
10 WIFI_BAND_UNSPECIFIED,
11 WIFI_BAND_BG, // 2.4 GHz
12 WIFI_BAND_A, // 5 GHz without DFS
13 WIFI_BAND_A_WITH_DFS, // 5 GHz with DFS
14 WIFI_BAND_ABG, // 2.4 GHz + 5 GHz; no DFS
15 WIFI_BAND_ABG_WITH_DFS, // 2.4 GHz + 5 GHz with DFS
18 wifi_error wifi_get_valid_channels(wifi_interface_handle handle,
19 int band, int size, wifi_channel *channels, int *num);
22 int max_scan_cache_size; // in number of scan results??
24 int max_ap_cache_per_scan;
25 int max_rssi_sample_size;
26 int max_scan_reporting_threshold; // in number of scan results??
28 int max_significant_wifi_change_aps;
29 } wifi_gscan_capabilities;
31 wifi_error wifi_get_gscan_capabilities(wifi_interface_handle handle,
32 wifi_gscan_capabilities *capabilities);
35 wifi_timestamp ts; // Time of discovery
36 char ssid[32+1]; // null terminated
38 wifi_channel channel; // channel frequency in MHz
39 wifi_rssi rssi; // in db
40 wifi_timespan rtt; // in nanoseconds
41 wifi_timespan rtt_sd; // standard deviation in rtt
47 void (*on_scan_results_available) (wifi_request_id id, unsigned num_results_available);
48 } wifi_scan_result_handler;
51 wifi_channel channel; // frequency
52 int dwellTimeMs; // dwell time hint
53 int passive; // 0 => active, 1 => passive scan; ignored for DFS
54 /* Add channel class */
55 } wifi_scan_channel_spec;
58 int bucket; // bucket index, 0 based
59 wifi_band band; // when UNSPECIFIED, use channel list
60 int period; // desired period, in millisecond; if this is too
61 // low, the firmware should choose to generate results as
62 // fast as it can instead of failing the command
63 byte report_events; // 1 => report events after each scan
65 wifi_scan_channel_spec channels[8]; // channels to scan; these may include DFS channels
66 } wifi_scan_bucket_spec;
69 int base_period; // base timer period in ms
71 int report_threshold; // in %, when buffer is this much full, wake up AP
72 int num_buckets; // maximum 8
73 wifi_scan_bucket_spec buckets[8];
74 } wifi_scan_cmd_params;
76 wifi_error wifi_start_gscan(wifi_request_id id, wifi_interface_handle iface,
77 wifi_scan_cmd_params params, wifi_scan_result_handler handler);
78 wifi_error wifi_stop_gscan(wifi_request_id id, wifi_interface_handle iface);
80 wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush,
81 wifi_scan_result *results, int *num);
86 void (*on_hotlist_ap_found)(wifi_request_id id,
87 unsigned num_results, wifi_scan_result *results);
88 } wifi_hotlist_ap_found_handler;
91 mac_addr bssid; // AP BSSID
92 wifi_rssi low; // low threshold
93 wifi_rssi high; // high threshold
98 ap_threshold_param bssids[64];
99 } wifi_bssid_hotlist_params;
101 wifi_error wifi_set_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface,
102 wifi_bssid_hotlist_params params, wifi_hotlist_ap_found_handler handler);
103 wifi_error wifi_reset_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface);
105 /* Significant wifi change*/
108 void (*on_significant_change)(wifi_request_id id,
109 unsigned num_results, wifi_scan_result *results);
110 } wifi_significant_change_handler;
113 int rssi_sample_size; // number of samples for averaging RSSI
114 int lost_ap_sample_size; // number of samples to confirm AP loss
115 int min_breaching; // number of APs breaching threshold
117 ap_threshold_param bssids[64];
118 } wifi_significant_change_params;
120 wifi_error wifi_set_significant_change_handler(wifi_request_id id, wifi_interface_handle iface,
121 wifi_significant_change_params params, wifi_significant_change_handler handler);
122 wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interface_handle iface);