Begin progress on web gui stub. Make AP-only for now and form post. Would bluetooth from a webapp be better?

This commit is contained in:
Matt McWilliams 2024-03-02 22:49:10 +01:00
parent 01d309d539
commit 9dde491bcb
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,26 @@
#include "WebGUI.h"
void WebGUI::Setup () {
}
void WebGUI::Loop () {
}
void WebGUI::HandleNotFound() {
String res = "404 Not Found\n\n";
res += "URI: ";
res += server.uri();
res += "\nMethod: ";
res += (server.method() == HTTP_GET) ? "GET" : "POST";
res += "\nArguments: ";
res += server.args();
res += "\n";
for (uint8_t i = 0; i < server.args(); i++) {
res += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, "text/plain", res);
}

View File

@ -0,0 +1,32 @@
#ifndef WEBGUI
#define WEBGUI
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <ArduinoJson.h>
class WebGUI {
private:
const char *AP_SSID = "contact_printer";
const char *DEFAULT_PASSWORD = "contact_printer";
const char *MDNS_NAME = "contact_printer";
//IPAddress wifiIP;
//String IP;
//DynamicJsonDocument postJSON(1024);
WebServer server(80);
protected:
static void HandleNotFound();
public:
WebGUI();
void Setup();
void Loop();
};
#endif