Skip to content

Commit 5193fd9

Browse files
committed
WiFi: add SSID() and RSSI()
1 parent af8b9db commit 5193fd9

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

libraries/SocketWrapper/WiFi.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,19 @@ class WiFiClass : public NetworkInterface {
7979
return true;
8080
}
8181

82-
int status() {
83-
struct wifi_iface_status status = {0};
84-
85-
if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, netif, &status,
86-
sizeof(struct wifi_iface_status))) {
87-
return WL_NO_SHIELD;
88-
}
82+
int status() {
83+
if (net_mgmt(NET_REQUEST_WIFI_IFACE_STATUS, netif, &sta_state,
84+
sizeof(struct wifi_iface_status))) {
85+
return WL_NO_SHIELD;
86+
}
8987

90-
if (status.state >= WIFI_STATE_ASSOCIATED) {
91-
return WL_CONNECTED;
92-
} else {
93-
return WL_DISCONNECTED;
94-
}
95-
return WL_NO_SHIELD;
96-
}
88+
if (sta_state.state >= WIFI_STATE_ASSOCIATED) {
89+
return WL_CONNECTED;
90+
} else {
91+
return WL_DISCONNECTED;
92+
}
93+
return WL_NO_SHIELD;
94+
}
9795

9896
int8_t scanNetworks() {
9997
// TODO: borrow code from mbed core for scan results handling

0 commit comments

Comments
 (0)