add network device name to sysinfo page

This commit is contained in:
technyon
2023-02-05 19:26:15 +01:00
parent 8580857ef3
commit ff62368012
8 changed files with 26 additions and 0 deletions

View File

@@ -479,6 +479,11 @@ bool Network::encryptionSupported()
return _device->supportsEncryption();
}
const String Network::networkDeviceName() const
{
return _device->deviceName();
}
void Network::publishFloat(const char* prefix, const char* topic, const float value, const uint8_t precision)
{
char str[30];

View File

@@ -45,6 +45,7 @@ public:
int mqttConnectionState(); // 0 = not connected; 1 = connected; 2 = connected and mqtt processed
bool encryptionSupported();
const String networkDeviceName() const;
const NetworkDeviceType networkDeviceType();

View File

@@ -766,6 +766,10 @@ void WebCfgServer::buildInfoHtml(String &response)
response.concat(_nukiOpener->isPaired() ? _nukiOpener->isPinSet() ? "Yes\n" : "No\n" : "-\n");
}
response.concat("Network device: ");
response.concat(_network->networkDeviceName());
response.concat("\n");
response.concat("Heap: ");
response.concat(esp_get_free_heap_size());
response.concat("\n");

View File

@@ -17,6 +17,8 @@ public:
: _hostname(hostname)
{}
virtual const String deviceName() const = 0;
virtual void initialize() = 0;
virtual ReconnectStatus reconnect() = 0;
virtual void reconfigure() = 0;

View File

@@ -32,6 +32,11 @@ W5500Device::W5500Device(const String &hostname, Preferences* preferences, int v
W5500Device::~W5500Device()
{}
const String W5500Device::deviceName() const
{
return "Wiznet W5500";
}
void W5500Device::initialize()
{
WiFi.mode(WIFI_OFF);

View File

@@ -18,6 +18,8 @@ public:
explicit W5500Device(const String& hostname, Preferences* _preferences, int variant);
~W5500Device();
const String deviceName() const override;
virtual void initialize();
virtual ReconnectStatus reconnect();
virtual void reconfigure();

View File

@@ -53,6 +53,11 @@ WifiDevice::WifiDevice(const String& hostname, Preferences* _preferences)
}
}
const String WifiDevice::deviceName() const
{
return "Built-in Wifi";
}
void WifiDevice::initialize()
{
std::vector<const char *> wm_menu;

View File

@@ -12,6 +12,8 @@ class WifiDevice : public NetworkDevice
public:
WifiDevice(const String& hostname, Preferences* _preferences);
const String deviceName() const override;
virtual void initialize();
virtual void reconfigure();
virtual ReconnectStatus reconnect();