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; 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
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[] = {
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
}; };

View File

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