1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Fix WiFi events with 32byte wide SSIDs

This commit is contained in:
Maxim Prokhorov 2021-03-25 02:38:25 +03:00
parent fdc295dfae
commit 3ff573103b

View File

@ -105,7 +105,7 @@ WiFiEventHandler ESP8266WiFiGenericClass::onStationModeConnected(std::function<v
WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_CONNECTED, [f](System_Event_t* e) { WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_CONNECTED, [f](System_Event_t* e) {
auto& src = e->event_info.connected; auto& src = e->event_info.connected;
WiFiEventStationModeConnected dst; WiFiEventStationModeConnected dst;
dst.ssid = String(reinterpret_cast<char*>(src.ssid)); dst.ssid.concat(reinterpret_cast<char*>(src.ssid), src.ssid_len);
memcpy(dst.bssid, src.bssid, 6); memcpy(dst.bssid, src.bssid, 6);
dst.channel = src.channel; dst.channel = src.channel;
f(dst); f(dst);
@ -119,7 +119,7 @@ WiFiEventHandler ESP8266WiFiGenericClass::onStationModeDisconnected(std::functio
WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_DISCONNECTED, [f](System_Event_t* e){ WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_DISCONNECTED, [f](System_Event_t* e){
auto& src = e->event_info.disconnected; auto& src = e->event_info.disconnected;
WiFiEventStationModeDisconnected dst; WiFiEventStationModeDisconnected dst;
dst.ssid = String(reinterpret_cast<char*>(src.ssid)); dst.ssid.concat(reinterpret_cast<char*>(src.ssid), src.ssid_len);
memcpy(dst.bssid, src.bssid, 6); memcpy(dst.bssid, src.bssid, 6);
dst.reason = static_cast<WiFiDisconnectReason>(src.reason); dst.reason = static_cast<WiFiDisconnectReason>(src.reason);
f(dst); f(dst);