diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2021-01-11 16:05:28 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-11 16:05:28 -0800 |
| commit | 081249f7966917abdc19a432ea7a82aeeae415d3 (patch) | |
| tree | 8c8fa0c68faa6cf68d0a87a1f6f5edc510017262 /ports/esp32s2 | |
| parent | 3cf4d9c57f10d9140027032706d9e715d2b75ad7 (diff) | |
| parent | 53e4d78a3cf42b4a8766d8d2d8315464b80b9632 (diff) | |
Merge pull request #3944 from BennyE/wifi-authmode
esp32-s2: Adding authmode keyword
Diffstat (limited to 'ports/esp32s2')
| -rw-r--r-- | ports/esp32s2/common-hal/wifi/Network.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 2674df065..b6eb6bb43 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -54,3 +54,37 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { // 2 instead of strlen(cstr) as this gives us only the country-code return mp_obj_new_str(cstr, 2); } + +mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { + const char* authmode = ""; + switch (self->record.authmode) { + case WIFI_AUTH_OPEN: + authmode = "OPEN"; + break; + case WIFI_AUTH_WEP: + authmode = "WEP"; + break; + case WIFI_AUTH_WPA_PSK: + authmode = "WPA_PSK"; + break; + case WIFI_AUTH_WPA2_PSK: + authmode = "WPA2_PSK"; + break; + case WIFI_AUTH_WPA_WPA2_PSK: + authmode = "WPA_WPA2_PSK"; + break; + case WIFI_AUTH_WPA2_ENTERPRISE: + authmode = "WPA2_ENTERPRISE"; + break; + case WIFI_AUTH_WPA3_PSK: + authmode = "WPA3_PSK"; + break; + case WIFI_AUTH_WPA2_WPA3_PSK: + authmode = "WPA2_WPA3_PSK"; + break; + default: + authmode = "UNKNOWN"; + break; + } + return mp_obj_new_str(authmode, strlen(authmode)); +} |
