Commit 7acc252e authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266/modnetwork: .config(): Add "authmode" param.

parent 6f3fc9bf
...@@ -259,6 +259,11 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs ...@@ -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; cfg.ap.ssid_len = len;
break; break;
} }
case QS(MP_QSTR_authmode): {
req_if = SOFTAP_IF;
cfg.ap.authmode = mp_obj_get_int(kwargs->table[i].value);
break;
}
default: default:
goto unknown; 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 ...@@ -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; req_if = SOFTAP_IF;
val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len, false); val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len, false);
break; break;
case QS(MP_QSTR_authmode):
req_if = SOFTAP_IF;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.authmode);
break;
default: default:
goto unknown; goto unknown;
} }
...@@ -384,6 +393,17 @@ STATIC const mp_map_elem_t mp_module_network_globals_table[] = { ...@@ -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_SMALL_INT(PHY_MODE_11G) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11N), { MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11N),
MP_OBJ_NEW_SMALL_INT(PHY_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 #endif
}; };
......
...@@ -118,8 +118,14 @@ Q(STAT_WRONG_PASSWORD) ...@@ -118,8 +118,14 @@ Q(STAT_WRONG_PASSWORD)
Q(STAT_NO_AP_FOUND) Q(STAT_NO_AP_FOUND)
Q(STAT_CONNECT_FAIL) Q(STAT_CONNECT_FAIL)
Q(STAT_GOT_IP) 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 // config keys
Q(essid) Q(essid)
Q(authmode)
// Pin class // Pin class
Q(Pin) Q(Pin)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment