mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
теперь можно выбирать из двух: стандартный или асинхронный веб сервер
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#ifdef ACYNC_WEB_SERVER
|
||||
#ifdef ASYNC_WEB_SERVER
|
||||
extern AsyncWebSocket ws;
|
||||
extern AsyncEventSource events;
|
||||
|
||||
void webServerInit();
|
||||
void webSocketsInit();
|
||||
void asyncWebServerInit();
|
||||
void asyncWebSocketsInit();
|
||||
void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len);
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#define JSON_BUFFER_SIZE 4096
|
||||
|
||||
#define ACYNC_WEB_SERVER
|
||||
//#define ASYNC_WEB_SERVER
|
||||
#define STANDARD_WEB_SERVER
|
||||
|
||||
#ifdef esp8266_4mb
|
||||
|
||||
@@ -14,13 +14,19 @@
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266httpUpdate.h>
|
||||
#endif
|
||||
|
||||
#ifdef ACYNC_WEB_SERVER
|
||||
#ifdef ASYNC_WEB_SERVER
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD_WEB_SERVER
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <ESP8266HTTPUpdateServer.h>
|
||||
#endif
|
||||
|
||||
#include <FS.h>
|
||||
|
||||
//внутренние глобальные директории проекта
|
||||
@@ -30,10 +36,15 @@
|
||||
|
||||
//глобальные объекты классов
|
||||
extern TickerScheduler ts;
|
||||
#ifdef ACYNC_WEB_SERVER
|
||||
#ifdef ASYNC_WEB_SERVER
|
||||
extern AsyncWebServer server;
|
||||
#endif
|
||||
|
||||
#ifdef STANDARD_WEB_SERVER
|
||||
extern ESP8266WebServer HTTP;
|
||||
extern ESP8266HTTPUpdateServer httpUpdater;
|
||||
#endif
|
||||
|
||||
//глобальные переменные
|
||||
extern String settingsFlashJson;
|
||||
extern String paramsFlashJson;
|
||||
|
||||
16
include/StandWebServer.h
Normal file
16
include/StandWebServer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#ifdef STANDARD_WEB_SERVER
|
||||
extern void standWebServerInit();
|
||||
|
||||
extern void standWebServerFiles();
|
||||
extern bool handleFileRead(String path);
|
||||
extern String getContentType(String filename);
|
||||
|
||||
#ifdef RSET_FILE_OPERATIONS
|
||||
extern void handleFileUpload();
|
||||
extern void handleFileDelete();
|
||||
extern void handleFileCreate();
|
||||
extern void handleFileList();
|
||||
#endif
|
||||
#endif
|
||||
@@ -3,4 +3,5 @@
|
||||
#include "Global.h"
|
||||
#include "Utils/Pretty.h"
|
||||
#include "Utils/WiFiUtils.h"
|
||||
#include "WebServer.h"
|
||||
#include "AsyncWebServer.h"
|
||||
#include "StandWebServer.h"
|
||||
|
||||
Reference in New Issue
Block a user