diff --git a/Network.cpp b/Network.cpp index f9df89b1..570ebb1d 100644 --- a/Network.cpp +++ b/Network.cpp @@ -686,6 +686,11 @@ const String Network::networkDeviceName() const return _device->deviceName(); } +const String Network::networkBSSID() const +{ + return _device->BSSIDstr(); +} + void Network::publishFloat(const char* prefix, const char* topic, const float value, const uint8_t precision) { char str[30]; diff --git a/Network.h b/Network.h index cdcff4f2..55d9a3e8 100644 --- a/Network.h +++ b/Network.h @@ -67,6 +67,7 @@ class Network int mqttConnectionState(); // 0 = not connected; 1 = connected; 2 = connected and mqtt processed bool encryptionSupported(); const String networkDeviceName() const; + const String networkBSSID() const; const NetworkDeviceType networkDeviceType(); diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index eb7f2340..7819d2b1 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -1216,6 +1216,13 @@ void WebCfgServer::buildInfoHtml(String &response) response.concat("Network device: "); response.concat(_network->networkDeviceName()); response.concat("\n"); + + if(_network->networkDeviceName() == "Built-in Wi-Fi") + { + response.concat("BSSID of AP: "); + response.concat(_network->networkBSSID()); + response.concat("\n"); + } response.concat("Uptime: "); response.concat(millis() / 1000 / 60); diff --git a/networkDevices/NetworkDevice.h b/networkDevices/NetworkDevice.h index 9721be4f..4cdc2403 100644 --- a/networkDevices/NetworkDevice.h +++ b/networkDevices/NetworkDevice.h @@ -33,6 +33,7 @@ class NetworkDevice virtual int8_t signalStrength() = 0; virtual String localIP() = 0; + virtual String BSSIDstr() = 0; virtual void mqttSetClientId(const char* clientId); virtual void mqttSetCleanSession(bool cleanSession); diff --git a/networkDevices/WifiDevice.cpp b/networkDevices/WifiDevice.cpp index 17dc4035..d6e7cc42 100644 --- a/networkDevices/WifiDevice.cpp +++ b/networkDevices/WifiDevice.cpp @@ -160,6 +160,11 @@ String WifiDevice::localIP() return WiFi.localIP().toString(); } +String WifiDevice::BSSIDstr() +{ + return WiFi.BSSIDstr(); +} + void WifiDevice::clearRtcInitVar(WiFiManager *) { memset(WiFiDevice_reconfdetect, 0, sizeof WiFiDevice_reconfdetect); diff --git a/networkDevices/WifiDevice.h b/networkDevices/WifiDevice.h index 0e5c1645..152fbc4d 100644 --- a/networkDevices/WifiDevice.h +++ b/networkDevices/WifiDevice.h @@ -25,6 +25,7 @@ class WifiDevice : public NetworkDevice int8_t signalStrength() override; String localIP() override; + String BSSIDstr() override; private: static void clearRtcInitVar(WiFiManager*);