diff options
-rw-r--r-- | esp8266/modnetwork.c | 20 | ||||
-rw-r--r-- | esp8266/qstrdefsport.h | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/esp8266/modnetwork.c b/esp8266/modnetwork.c index 382c2ef07c..32eaf689db 100644 --- a/esp8266/modnetwork.c +++ b/esp8266/modnetwork.c @@ -259,6 +259,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs cfg.ap.ssid_len = len; break; } + case QS(MP_QSTR_authmode): { + req_if = SOFTAP_IF; + cfg.ap.authmode = mp_obj_get_int(kwargs->table[i].value); + break; + } default: goto unknown; } @@ -295,6 +300,10 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs req_if = SOFTAP_IF; val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len, false); break; + case QS(MP_QSTR_authmode): + req_if = SOFTAP_IF; + val = MP_OBJ_NEW_SMALL_INT(cfg.ap.authmode); + break; default: goto unknown; } @@ -384,6 +393,17 @@ STATIC const mp_map_elem_t mp_module_network_globals_table[] = { MP_OBJ_NEW_SMALL_INT(PHY_MODE_11G) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11N), MP_OBJ_NEW_SMALL_INT(PHY_MODE_11N) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_OPEN), + MP_OBJ_NEW_SMALL_INT(AUTH_OPEN) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WEP), + MP_OBJ_NEW_SMALL_INT(AUTH_WEP) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WPA_PSK), + MP_OBJ_NEW_SMALL_INT(AUTH_WPA_PSK) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WPA2_PSK), + MP_OBJ_NEW_SMALL_INT(AUTH_WPA2_PSK) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WPA_WPA2_PSK), + MP_OBJ_NEW_SMALL_INT(AUTH_WPA_WPA2_PSK) }, #endif }; diff --git a/esp8266/qstrdefsport.h b/esp8266/qstrdefsport.h index 1819395fa4..2c0a33525d 100644 --- a/esp8266/qstrdefsport.h +++ b/esp8266/qstrdefsport.h @@ -118,8 +118,14 @@ Q(STAT_WRONG_PASSWORD) Q(STAT_NO_AP_FOUND) Q(STAT_CONNECT_FAIL) Q(STAT_GOT_IP) +Q(AUTH_OPEN) +Q(AUTH_WEP) +Q(AUTH_WPA_PSK) +Q(AUTH_WPA2_PSK) +Q(AUTH_WPA_WPA2_PSK) // config keys Q(essid) +Q(authmode) // Pin class Q(Pin) |