MediaTek LinkIt™ Development
Platform for RTOS Wi-Fi Developer's
Guide
© 2015 - 2017 MediaTek Inc.
Page 34 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.
2.7.2.
Wi-Fi WPS connection support
Trigger Wi-Fi WPS connection using PBC (see section 2.7.2.1, "WPS PBC method") or PIN (see section 2.7.2.2, "WPS
PIN method") method.
Call the function
wifi_wps_unregister_credential_handler()
, to unregister the credential handler, as
described in section 2.7.1.2, “Register or unregister Wi-Fi WPS event handler”.
2.7.2.1.
WPS PBC method
There are two cases when using the WPS PBC method to connect to the Wi-Fi network:
•
The AP as a Registrar.
•
The STA as an Enrollee.
Call the function
wifi_wps_connection_by_pbc()
to apply the API directly.
1)
AP as a Registrar.
Call the function
wifi_wps_connection_by_pbc()
with an input AP port defined as WIFI_PORT_AP.
The AP can only act as Registrar in the WPS PBC method. The
bssid
parameter is ignored when the function
wps_ap_pbc_example()
is called.
An example implementation is shown below.
After the AP calls this API, the Enrollee, such as a smart phone, also needs to push the WPS virtual button to trigger
the Enrollee process. During 120 seconds, the Enrollee will connect with the AP and get an IP, or prompt fail.
2)
STA as an Enrollee.
When the device is in station mode, define the port directly in the
wifi_wps_connection_by_pbc()
function
(
WIFI_PORT_STA)
, the STA can only act as an Enrollee in PBC method.
When STA calls the
wifi_wps_connection_by_pbc()
API, the parameter
bssid
shouldn’t be NULL and
should be set to the Registrar’s BSSID, otherwise, if two APs push the WPS button at the same time, the STA’s WPS
may fail.
After the STA calls
the wifi_wps_connection_by_pbc()
API, the Registrar, such as an AP, also needs to
push the WPS button, either an actual or virtual one, to trigger the Registrar process. During 120 seconds, the
Enrollee will connect with the AP and get an IP, or prompt fail.
An example implementation is shown below.
int32_t wps_ap_pbc_example()
{
uint8_t *bssid = "00:11:22:33:44:55";
return wifi_wps_connection_by_pbc(WIFI_PORT_AP, NULL);
}
int32_t wps_sta_pbc_example()
{
uint8_t *bssid = "00:11:22:33:44:55";
return wifi_wps_connection_by_pbc(WIFI_PORT_STA, bssid);
}