Skip to content

Commit af8b9db

Browse files
committed
WiFi: add SSID() and RSSI()
1 parent 3ac4639 commit af8b9db

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

libraries/SocketWrapper/WiFi.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,28 @@ class WiFiClass : public NetworkInterface {
9999
// TODO: borrow code from mbed core for scan results handling
100100
}
101101

102+
char* SSID() {
103+
if (status() == WL_CONNECTED) {
104+
return (char *)sta_state.ssid;
105+
}
106+
return nullptr;
107+
}
108+
109+
int32_t RSSI() {
110+
if (status() == WL_CONNECTED) {
111+
return sta_state.rssi;
112+
}
113+
return 0;
114+
}
115+
102116
private:
103117
struct net_if *sta_iface = nullptr;
104118
struct net_if *ap_iface = nullptr;
105119

106120
struct wifi_connect_req_params ap_config;
107121
struct wifi_connect_req_params sta_config;
122+
123+
struct wifi_iface_status sta_state = { 0 };
108124
};
109125

110126
extern WiFiClass WiFi;

0 commit comments

Comments
 (0)