diff options
| author | Jeff Epler <jepler@gmail.com> | 2021-01-12 09:23:07 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2021-01-12 09:23:07 -0600 |
| commit | 1ca29ec47c9f51589faa151b659dfd1dd4a349ef (patch) | |
| tree | 0a2e35b45a52e85f258cc522615e37965b0453d3 /ports/esp32s2/common-hal/wifi/Network.c | |
| parent | e20c65d8f044cb9522cd1a7f4a3030efefa77cbb (diff) | |
| parent | 047708e36e67beee14771120296cdf758f00601d (diff) | |
Merge remote-tracking branch 'origin/main' into audioout-esp32
Diffstat (limited to 'ports/esp32s2/common-hal/wifi/Network.c')
| -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)); +} |
