html dashboard page, without upload
This commit is contained in:
parent
8c43d260d0
commit
d340142879
10 changed files with 719 additions and 3 deletions
|
@ -21,5 +21,36 @@ void ESPMegaWebServer::loop() {
|
|||
}
|
||||
|
||||
void ESPMegaWebServer::dashboardHandler(AsyncWebServerRequest *request) {
|
||||
request->send(200, "text/plain", "Hello World!");
|
||||
auto bindedDashboardProcessor = std::bind(&ESPMegaWebServer::dashboardProcessor, this, std::placeholders::_1);
|
||||
request->send_P(200, "text/html", ota_html, bindedDashboardProcessor);
|
||||
}
|
||||
|
||||
String ESPMegaWebServer::dashboardProcessor(const String& var) {
|
||||
if (var == "hostname") {
|
||||
return String(this->iot->getNetworkConfig()->hostname);
|
||||
}
|
||||
else if (var == "ip_address") {
|
||||
return this->iot->getIp().toString();
|
||||
}
|
||||
else if (var == "mac_address") {
|
||||
return this->iot->getMac();
|
||||
}
|
||||
else if (var == "model") {
|
||||
return String("ESPMega PRO R3.3c");
|
||||
}
|
||||
else if (var == "mqtt_connection_string") {
|
||||
MqttConfig *mqttConfig = this->iot->getMqttConfig();
|
||||
String connectionString;
|
||||
connectionString += mqttConfig->mqtt_server;
|
||||
connectionString += ":";
|
||||
connectionString += mqttConfig->mqtt_port;
|
||||
return connectionString;
|
||||
}
|
||||
else if (var == "base_topic") {
|
||||
return String(this->iot->getMqttConfig()->base_topic);
|
||||
}
|
||||
else if (var == "mqtt_connected") {
|
||||
return this->iot->mqttConnected() ? "Connected" : "Standalone";
|
||||
}
|
||||
return "";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue