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
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
};
......
......@@ -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)
......
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