84 lines
1.7 KiB
C
84 lines
1.7 KiB
C
// web_server.h - Web Server with WebServer and WebSocketsServer
|
|
|
|
#ifndef WEB_SERVER_H
|
|
#define WEB_SERVER_H
|
|
|
|
#include <Arduino.h>
|
|
#include <WiFi.h>
|
|
#include <WebServer.h>
|
|
#include <WebSocketsServer.h>
|
|
#include <ESPmDNS.h>
|
|
|
|
#include "config.h"
|
|
#include "types.h"
|
|
|
|
extern WebServer server;
|
|
extern WebSocketsServer webSocket;
|
|
|
|
extern bool wifiInitialized;
|
|
extern bool apModeActive;
|
|
extern bool staModeActive;
|
|
|
|
bool initWiFi();
|
|
bool initWebServer();
|
|
|
|
bool startAPMode();
|
|
bool startSTAMode(const char* ssid, const char* password);
|
|
void stopWiFi();
|
|
|
|
bool initMDNS();
|
|
|
|
void webServerTask(void *pvParameters);
|
|
void wsTxTask(void *pvParameters);
|
|
|
|
void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length);
|
|
|
|
void broadcastToClients(const char* message);
|
|
void broadcastSignalData(const GraphSignal* signals, uint8_t count);
|
|
|
|
void handleRoot();
|
|
void handleSettings();
|
|
void handleFiles();
|
|
void handleCAN();
|
|
void handleGraph();
|
|
void handleTest();
|
|
|
|
void handleAPIStatus();
|
|
void handleAPIMemory();
|
|
void handleAPIFileList();
|
|
void handleAPIFileDownload();
|
|
void handleAPIFileDelete();
|
|
void handleAPICANSend();
|
|
void handleAPIWiFiConfig();
|
|
void handleAPILoggingStart();
|
|
void handleAPILoggingStop();
|
|
void handleAPIDBCUpload();
|
|
|
|
void handleAPITimeSync();
|
|
void handleAPIRestart();
|
|
void handleAPICANConfig();
|
|
void handleAPITriggerConfig();
|
|
void handleAPISignalAdd();
|
|
void handleAPISignalList();
|
|
|
|
void handleNotFound();
|
|
|
|
extern const char HTML_INDEX[];
|
|
extern const char HTML_SETTINGS[];
|
|
extern const char HTML_FILES[];
|
|
extern const char HTML_CAN[];
|
|
extern const char HTML_GRAPH[];
|
|
|
|
struct WiFiConfig {
|
|
char staSSID[32];
|
|
char staPassword[64];
|
|
bool useSTA;
|
|
};
|
|
|
|
extern WiFiConfig wifiConfig;
|
|
|
|
bool loadWiFiConfig();
|
|
bool saveWiFiConfig();
|
|
|
|
#endif // WEB_SERVER_H
|