MediaTek LinkIt™ Development
Platform for RTOS Wi-Fi Developer's
Guide
© 2015 - 2017 MediaTek Inc.
Page 15 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
Description
wifi_connection_register_event_handler()
This function registers the Wi-Fi Event handler.
wifi_connection_unregister_event_handler()
This function unregisters Wi-Fi Event handler.
wifi_connection_disconnect_sta()
This function disconnects the connected Wi-Fi
station.
wifi_connection_get_sta_list()
This function gets the Wi-Fi Associated Station List.
wifi_connection_get_max_sta_number()
This function gets the maximum number of the
stations supported in AP mode or dual mode.
wifi_connection_get_link_status()
This function gets the current STA port link up / link
down status of the connection.
You can find more information on the APIs in the Wi-Fi API Reference Manual.
To use the device in the AP mode, apply any of the three examples described below.
2.2.1.
Use the device in AP open mode
1)
In this example, initialize the device in AP open mode on channel 6 with the SSID of "
MTK_SOFT_AP
”, as
shown below.
a)
Define the operation mode (
config.opmode
), SSID (
config.ap_config.ssid
), channel
(
config.ap_config.channel
), authentication mode (
config.ap_config.auth_mode
) and
encryption type (
config.ap_config.encrypt_type
) in the
wifi_config_t
structure, as shown
below.
wifi_config_t config = {0};
config.opmode = WIFI_MODE_AP_ONLY;
strcpy((char *)config.ap_config.ssid, "MTK_SOFT_AP");
config.ap_config.ssid_length = strlen((char *)config.ap_config.ssid);
config.ap_config.auth_mode = WIFI_AUTH_MODE_OPEN;
config.ap_config.encrypt_type = WIFI_ENCRYPT_TYPE_WEP_DISABLED;
config.ap_config.channel = 6;
b)
Call the
wifi_init()
function to initialize the Wi-Fi driver.
wifi_init(&config, NULL);
2)
Use configuration APIs to set the device in AP mode that operates on channel 6 in open mode with an
SSID of “MTK_SOFT_AP”.
a)
Call the function
wifi_config_set_opmode(opmode)
to set the opmode to
WIFI_MODE_AP_ONLY
, as shown below.
wifi_config_set_opmode(WIFI_MODE_AP_ONLY);
Call the function
wifi_config_set_ssid(port, ssid_name, strlen(ssid_name))
to set the SSID
("
MTK_SOFT_AP
") of a given port (
WIFI_PORT_AP
), as shown below.
wifi_config_set_ssid(WIFI_PORT_AP, "MTK_SOFT_AP", strlen("MTK_SOFT_AP"));
b)
Call the function
wifi_config_set_security_mode(port, auth, encrypt)
to set the
security mode of the AP router, as shown below.
wifi_config_set_security_mode(WIFI_PORT_AP, WIFI_AUTH_MODE_OPEN,
WIFI_ENCRYPT_TYPE_WEP_DISABLED);