File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,12 @@ class WiFiClass: public NetworkInterface
75
75
}
76
76
77
77
int status () {
78
- struct wifi_iface_status status = { 0 };
79
-
80
- if (net_mgmt (NET_REQUEST_WIFI_IFACE_STATUS, netif, &status,
78
+ if (net_mgmt (NET_REQUEST_WIFI_IFACE_STATUS, netif, &sta_state,
81
79
sizeof (struct wifi_iface_status ))) {
82
80
return WL_NO_SHIELD;
83
81
}
84
82
85
- if (status .state >= WIFI_STATE_ASSOCIATED) {
83
+ if (sta_state .state >= WIFI_STATE_ASSOCIATED) {
86
84
return WL_CONNECTED;
87
85
} else {
88
86
return WL_DISCONNECTED;
@@ -94,12 +92,28 @@ class WiFiClass: public NetworkInterface
94
92
// TODO: borrow code from mbed core for scan results handling
95
93
}
96
94
95
+ char * SSID () {
96
+ if (status () == WL_CONNECTED) {
97
+ return (char *)sta_state.ssid ;
98
+ }
99
+ return nullptr ;
100
+ }
101
+
102
+ int32_t RSSI () {
103
+ if (status () == WL_CONNECTED) {
104
+ return sta_state.rssi ;
105
+ }
106
+ return 0 ;
107
+ }
108
+
97
109
private:
98
110
struct net_if *sta_iface = nullptr ;
99
111
struct net_if *ap_iface = nullptr ;
100
112
101
113
struct wifi_connect_req_params ap_config;
102
114
struct wifi_connect_req_params sta_config;
115
+
116
+ struct wifi_iface_status sta_state = { 0 };
103
117
};
104
118
105
119
extern WiFiClass WiFi;
You can’t perform that action at this time.
0 commit comments