Skip to content

Commit

Permalink
Show BSSID
Browse files Browse the repository at this point in the history
  • Loading branch information
iranl committed May 4, 2024
1 parent 0d05810 commit 65ba3b4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
7 changes: 7 additions & 0 deletions WebCfgServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions networkDevices/NetworkDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions networkDevices/WifiDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions networkDevices/WifiDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class WifiDevice : public NetworkDevice
int8_t signalStrength() override;

String localIP() override;
String BSSIDstr() override;

private:
static void clearRtcInitVar(WiFiManager*);
Expand Down

0 comments on commit 65ba3b4

Please sign in to comment.