mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5649 from Archcady/realtek-PR-master
Fix greentea test mbed-os-tests-netsocket-connectivitypull/5723/head
commit
13dbb67891
|
@ -36,6 +36,8 @@ typedef struct _wifi_scan_hdl {
|
||||||
|
|
||||||
#define MAX_SCAN_TIMEOUT (15000)
|
#define MAX_SCAN_TIMEOUT (15000)
|
||||||
|
|
||||||
|
static bool _inited = false;
|
||||||
|
|
||||||
static rtw_result_t scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result )
|
static rtw_result_t scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result )
|
||||||
{
|
{
|
||||||
wifi_scan_hdl *scan_handler = (wifi_scan_hdl *)malloced_scan_result->user_data;
|
wifi_scan_hdl *scan_handler = (wifi_scan_hdl *)malloced_scan_result->user_data;
|
||||||
|
@ -97,10 +99,13 @@ RTWInterface::RTWInterface(bool debug)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emac->ops.power_up(emac);
|
emac->ops.power_up(emac);
|
||||||
ret = mbed_lwip_init(emac);
|
if (_inited == false) {
|
||||||
if (ret != 0) {
|
ret = mbed_lwip_init(emac);
|
||||||
printf("Error init RTWInterface!(%d)\r\n", ret);
|
if (ret != 0) {
|
||||||
return;
|
printf("Error init RTWInterface!(%d)\r\n", ret);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_inited = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +242,7 @@ int8_t RTWInterface::get_rssi()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsapi_error_t RTWInterface::connect(const char *ssid, const char *pass,
|
nsapi_error_t RTWInterface::connect(const char *ssid, const char *pass,
|
||||||
nsapi_security_t security, uint8_t channel)
|
nsapi_security_t security, uint8_t channel)
|
||||||
{
|
{
|
||||||
set_credentials(ssid, pass, security);
|
set_credentials(ssid, pass, security);
|
||||||
set_channel(channel);
|
set_channel(channel);
|
||||||
|
@ -249,6 +254,7 @@ nsapi_error_t RTWInterface::disconnect()
|
||||||
char essid[33];
|
char essid[33];
|
||||||
|
|
||||||
wlan_emac_link_change(false);
|
wlan_emac_link_change(false);
|
||||||
|
mbed_lwip_bringdown();
|
||||||
if(wifi_is_connected_to_ap() != RTW_SUCCESS)
|
if(wifi_is_connected_to_ap() != RTW_SUCCESS)
|
||||||
return NSAPI_ERROR_NO_CONNECTION;
|
return NSAPI_ERROR_NO_CONNECTION;
|
||||||
if(wifi_disconnect()<0){
|
if(wifi_disconnect()<0){
|
||||||
|
|
Loading…
Reference in New Issue