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

This commit is contained in:
Paul Sokolovsky 2016-04-12 00:17:31 +03:00
parent 6f3fc9bfa1
commit 7acc252e93
2 changed files with 26 additions and 0 deletions

View File

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

View File

@ -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)