mirror of https://github.com/ARMmbed/mbed-os.git
Bugfix - drops the assumption that there is more than SSID in vicinity
parent
7995e8beac
commit
50bc2e9280
|
@ -85,7 +85,7 @@ Case cases[] = {
|
||||||
Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
|
Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
|
||||||
#endif
|
#endif
|
||||||
Case("WIFI-SCAN-NULL", wifi_scan_null),
|
Case("WIFI-SCAN-NULL", wifi_scan_null),
|
||||||
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) || defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
||||||
Case("WIFI-SCAN", wifi_scan),
|
Case("WIFI-SCAN", wifi_scan),
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
||||||
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
|
||||||
|
|
||||||
void wifi_scan(void)
|
void wifi_scan(void)
|
||||||
{
|
{
|
||||||
WiFiInterface *wifi = get_interface();
|
WiFiInterface *wifi = get_interface();
|
||||||
|
@ -33,7 +31,7 @@ void wifi_scan(void)
|
||||||
WiFiAccessPoint ap[MBED_CONF_APP_MAX_SCAN_SIZE];
|
WiFiAccessPoint ap[MBED_CONF_APP_MAX_SCAN_SIZE];
|
||||||
|
|
||||||
int size = wifi->scan(ap, MBED_CONF_APP_MAX_SCAN_SIZE);
|
int size = wifi->scan(ap, MBED_CONF_APP_MAX_SCAN_SIZE);
|
||||||
TEST_ASSERT(size >= 2);
|
TEST_ASSERT(size >= 1);
|
||||||
|
|
||||||
bool secure_found = false;
|
bool secure_found = false;
|
||||||
bool unsecure_found = false;
|
bool unsecure_found = false;
|
||||||
|
@ -49,17 +47,19 @@ void wifi_scan(void)
|
||||||
nsapi_security_t security = ap[i].get_security();
|
nsapi_security_t security = ap[i].get_security();
|
||||||
int8_t rssi = ap[i].get_rssi();
|
int8_t rssi = ap[i].get_rssi();
|
||||||
TEST_ASSERT_INT8_WITHIN(-10, -100, rssi);
|
TEST_ASSERT_INT8_WITHIN(-10, -100, rssi);
|
||||||
|
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
|
||||||
if (strcmp(MBED_CONF_APP_WIFI_SECURE_SSID, ssid) == 0) {
|
if (strcmp(MBED_CONF_APP_WIFI_SECURE_SSID, ssid) == 0) {
|
||||||
secure_found = true;
|
secure_found = true;
|
||||||
TEST_ASSERT_EQUAL_INT(get_security(), security);
|
TEST_ASSERT_EQUAL_INT(get_security(), security);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
||||||
if (strcmp(MBED_CONF_APP_WIFI_UNSECURE_SSID, ssid) == 0) {
|
if (strcmp(MBED_CONF_APP_WIFI_UNSECURE_SSID, ssid) == 0) {
|
||||||
unsecure_found = true;
|
unsecure_found = true;
|
||||||
TEST_ASSERT_EQUAL_INT(NSAPI_SECURITY_NONE, security);
|
TEST_ASSERT_EQUAL_INT(NSAPI_SECURITY_NONE, security);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Finding one SSID is enough
|
// Finding one SSID is enough
|
||||||
TEST_ASSERT_TRUE(secure_found || unsecure_found);
|
TEST_ASSERT_TRUE(secure_found || unsecure_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
|
||||||
|
|
|
@ -26,6 +26,6 @@ using namespace utest::v1;
|
||||||
void wifi_scan_null(void)
|
void wifi_scan_null(void)
|
||||||
{
|
{
|
||||||
WiFiInterface *wifi = get_interface();
|
WiFiInterface *wifi = get_interface();
|
||||||
TEST_ASSERT(wifi->scan(NULL, 0) >= 2);
|
TEST_ASSERT(wifi->scan(NULL, 0) >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue