1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

use new api boatDataString for the UI

This commit is contained in:
wellenvogel
2021-11-25 16:43:13 +01:00
parent 3944735190
commit aae16531ff
4 changed files with 183 additions and 24 deletions

View File

@@ -420,6 +420,17 @@ protected:
result = boatData.toJson();
}
};
class BoatDataStringRequest : public GwRequestMessage
{
public:
BoatDataStringRequest() : GwRequestMessage(F("text/plain"),F("boatDataString")){};
protected:
virtual void processRequest()
{
result = boatData.toString();
}
};
class XdrExampleRequest : public GwRequestMessage
{
@@ -562,6 +573,8 @@ void setup() {
{ return new ResetConfigRequest(); });
webserver.registerMainHandler("/api/boatData", [](AsyncWebServerRequest *request)->GwRequestMessage *
{ return new BoatDataRequest(); });
webserver.registerMainHandler("/api/boatDataString", [](AsyncWebServerRequest *request)->GwRequestMessage *
{ return new BoatDataStringRequest(); });
webserver.registerMainHandler("/api/xdrExample", [](AsyncWebServerRequest *request)->GwRequestMessage *
{
String mapping=request->arg("mapping");