mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-17 10:49:47 +00:00
update WiFi security definitions
This commit is contained in:
1 parent
60fe567845
commit
8392b9407a
5 files changed
+29
-21
No files matched your search
@@ -274,14 +274,11 @@ static void st67w6_handle_scan_result(char *data, size_t len) {
|
||||
!mg_str_to_num(fields[0], 10, &val, 1))
|
||||
return;
|
||||
bss.security =
|
||||
(val == 0)
|
||||
? MG_WIFI_SECURITY_OPEN
|
||||
: MG_WIFI_SECURITY_WEP |
|
||||
((val == 2 || val == 4 || val == 5) ? MG_WIFI_SECURITY_WPA
|
||||
: 0) |
|
||||
((val == 3 || val == 4 || val == 7) ? MG_WIFI_SECURITY_WPA2
|
||||
: 0) |
|
||||
((val == 6 || val == 7) ? MG_WIFI_SECURITY_WPA3 : 0);
|
||||
(val == 0) ? MG_WIFI_SECURITY_OPEN : (uint8_t) MG_WIFI_SECURITY_WEP;
|
||||
if (val == 2 || val == 4) bss.security |= MG_WIFI_SECURITY_WPA;
|
||||
if (val == 3 || val == 4 || val == 7) bss.security |= MG_WIFI_SECURITY_WPA2;
|
||||
if (val == 6 || val == 7) bss.security |= MG_WIFI_SECURITY_WPA3;
|
||||
if (val == 5) bss.security |= MG_WIFI_SECURITY_WPA_ENTERPRISE;
|
||||
if (!mg_span(fields[1], &fields[0], &fields[1], ',')) return;
|
||||
bss.SSID.buf = fields[0].buf + 1, bss.SSID.len = fields[0].len - 2;
|
||||
if (!mg_span(fields[1], &fields[0], &fields[1], ',')) return;
|
||||
@@ -311,7 +308,7 @@ static void st67w6_handle_scan_result(char *data, size_t len) {
|
||||
!mg_str_to_num(fields[0], 10, &val, 1))
|
||||
return;
|
||||
bss.has_n = (val & 4) != 0;
|
||||
// bss.has_ax = (val & 8) != 0;
|
||||
bss.has_ax = (val & 8) != 0;
|
||||
bss.band = MG_WIFI_BAND_2G; // NOT INFORMED with default options, no docs
|
||||
MG_VERBOSE(("BSS: %.*s (%u) (%M) %d dBm %u", bss.SSID.len, bss.SSID.buf,
|
||||
bss.channel, mg_print_mac, bss.BSSID, (int) bss.RSSI,
|
||||
|
||||
@@ -24,11 +24,16 @@ struct mg_wifi_scan_bss_data {
|
||||
#define MG_WIFI_SECURITY_WPA MG_BIT(1)
|
||||
#define MG_WIFI_SECURITY_WPA2 MG_BIT(2)
|
||||
#define MG_WIFI_SECURITY_WPA3 MG_BIT(3)
|
||||
#define MG_WIFI_SECURITY_WPA_ENTERPRISE MG_BIT(4)
|
||||
#define MG_WIFI_SECURITY_WPA2_ENTERPRISE MG_BIT(5)
|
||||
#define MG_WIFI_SECURITY_WPA3_ENTERPRISE MG_BIT(6)
|
||||
uint8_t channel;
|
||||
unsigned band : 2;
|
||||
#define MG_WIFI_BAND_2G 0
|
||||
#define MG_WIFI_BAND_5G 1
|
||||
unsigned has_n : 1;
|
||||
unsigned has_ac : 1;
|
||||
unsigned has_ax : 1;
|
||||
};
|
||||
|
||||
bool mg_wifi_scan(void);
|
||||
|
||||
Reference in new issue
Block a user