![Mediatek Labs LinkIt Скачать руководство пользователя страница 40](http://html1.mh-extra.com/html/mediatek-labs/linkit/linkit_developers-manual_1760805040.webp)
MediaTek LinkIt™ Development
Platform for RTOS Wi-Fi Developer's
Guide
© 2015 - 2017 MediaTek Inc.
Page 36 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.
Another approach to get the PIN code is to call the API described in section 2.7.2.3, "WPS get the PIN code".
An example implementation is shown below.
2.7.2.3.
WPS get the PIN code
This API is used to get the PIN code of AP or STA. Call the
wifi_wps_connection_by_pin()
API directly.
1)
AP get the PIN code
When the device is an AP, assign the parameter
WIFI_PORT_AP
to the "
port
" parameter of this API.
The AP will auto-generate a random PIN code when device powers on, the PIN stays the same for each API call.
An example implementation is shown below.
2)
STA gets the PIN code
When the device is in STA, assign the parameter
WIFI_PORT_STA
to the "
port
" parameter of this API.
The STA’s PIN code is randomly generated. An example implementation is shown below.
return wifi_wps_connection_by_pin( WIFI_PORT_STA, bssid, pin);
}
int32_t wps_sta_pin_example()
{
uint8_t *bssid = "00:11:22:33:44:55";
char pin_buf[9] = {0};//the size of the pin code is 8
wifi_wps_config_get_pin_code(WIFI_PORT_STA, ( uint8_t *)pin_buf);
printf("Get PIN:%s\n", (char *)pin_buf ); //ex.Get PIN: 00309448
return wifi_wps_connection_by_pin( WIFI_PORT_STA, bssid, ( uint8_t
*)pin_buf);
}
int32_t wps_ap_get_pin_example()
{
char pin_buf[9] = {0};//the size of the pin code is 8
wifi_wps_config_get_pin_code(WIFI_PORT_AP, ( uint8_t *)pin_buf);
printf("Get PIN:%s\n", (char *)pin_buf);
}
int32_t wps_sta_get_pin_example()
{
char pin_buf[9] = {0};//the size of the pin code is 8
wifi_wps_config_get_pin_code(WIFI_PORT_STA, ( uint8_t *)pin_buf);
printf("Get PIN:%s\n", (char *)pin_buf);
}