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

This patch enables iface.config('essid') to work for both AP and STA
interfaces.
This commit is contained in:
Lars Kellogg-Stedman 2018-04-09 15:34:18 -04:00 committed by Damien George
parent 298c072433
commit d8fdb77ac9

View File

@ -422,8 +422,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));
}
case MP_QSTR_essid:
req_if = SOFTAP_IF;
val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len);
if (self->if_id == STATION_IF) {
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;
case MP_QSTR_hidden:
req_if = SOFTAP_IF;