esp8266/modnetwork: Use struct bss_info::ssid_len for ESSID length.

Instead of calling strlen(), which won't work if there're 32 chars in
returned ESSID. struct bss_info::ssid_len is not documented in SDK API
Guide, but is present in SDK headers since 1.4.0. Just in case, previous
code is left commented.
pull/2159/head
Mark 2016-06-04 16:43:32 +01:00 zatwierdzone przez Paul Sokolovsky
rodzic a1a261d8e8
commit 822e9ca8f3
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -142,7 +142,13 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
struct bss_info *bs;
STAILQ_FOREACH(bs, si->pbss, next) {
mp_obj_tuple_t *t = mp_obj_new_tuple(6, NULL);
#if 1
// struct bss_info::ssid_len is not documented in SDK API Guide,
// but is present in SDK headers since 1.4.0
t->items[0] = mp_obj_new_bytes(bs->ssid, bs->ssid_len);
#else
t->items[0] = mp_obj_new_bytes(bs->ssid, strlen((char*)bs->ssid));
#endif
t->items[1] = mp_obj_new_bytes(bs->bssid, sizeof(bs->bssid));
t->items[2] = MP_OBJ_NEW_SMALL_INT(bs->channel);
t->items[3] = MP_OBJ_NEW_SMALL_INT(bs->rssi);