esp32/modnetwork: Allow to get ESSID of AP that STA is connected to.

Following the same addition to esp8266 port.
This commit is contained in:
Damien George 2018-05-01 16:37:08 +10:00
parent d8fdb77ac9
commit 777e042ab5

View File

@ -509,8 +509,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
return mp_obj_new_bytes(mac, sizeof(mac)); return mp_obj_new_bytes(mac, sizeof(mac));
} }
case QS(MP_QSTR_essid): case QS(MP_QSTR_essid):
req_if = WIFI_IF_AP; if (self->if_id == WIFI_IF_STA) {
val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len); val = mp_obj_new_str((char*)cfg.sta.ssid, strlen((char*)cfg.sta.ssid));
} else {
val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len);
}
break; break;
case QS(MP_QSTR_hidden): case QS(MP_QSTR_hidden):
req_if = WIFI_IF_AP; req_if = WIFI_IF_AP;