MediaTek LinkIt™ Development
Platform for RTOS Wi-Fi Developer's
Guide
© 2015 - 2017 MediaTek Inc.
Page 24 of 36
This document contains information that is proprietary to MediaTek Inc. (“MediaTek”) and/or its licensor(s).
Any unauthorized use, reproduction or disclosure of this document in whole or in part is strictly prohibited.
API
Definition
wifi_connection_start_scan()
.
wifi_connection_scan_deinit (void)
This function de-initializes the scan table. When the scan is
finished,
wifi_connection_scan_deinit()
should be
called to unload the buffer from the driver. After that, the data
in the
ap_list
can be processed by user applications safely,
and then another scan can be initialized by calling
wifi_connection_scan_init()
. Not calling the
wifi_connection_scan_deinit()
function, may cause
failure if another task attempts to call
wifi_connection_scan_init()
.
The example implementation below uses full scan and active scan methods. Apply this as a reference for other
scan mode and scan option implementations. There are two approaches to get the scan result, one is to register an
event callback and parse the Wi-Fi beacon and probe-request raw packet and the other method applies a scan
table initialized through
wifi_connection_scan_init()
.
2.4.1.1.
Using the
wifi_connection_scan_init()
API
1)
Define a buffer
g_ap_list
to store the scan results.
uint8_t size = 30;
wifi_scan_list_item_t g_ap_list[size] = {0};
2)
Call the function
wifi_connection_scan_init()
to initialize the buffer in the Wi-Fi module. The scan
result is recorded in
g_ap_list
in descending order of the RSSI. The number of APs to detect is limited
by
size
, which is
30
in this example.
wifi_connection_scan_init(g_ap_list, size);
3)
Call the function
wifi_connection_start_scan()
to start the scan.
wifi_connection_start_scan(NULL, 0, NULL, 0, 0);
4)
Call the function
wifi_connection_stop_scan()
to stop the scan.
wifi_connect_stop_scan();
5)
Call the function
wifi_connection_scan_deinit()
to de-initialize the scan and to unload the buffer
from the driver.
wifi_connect_scan_deinit();