mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
Merge remote-tracking branch 'origin/dev'
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
|
||||
#ifdef EMSESP_STANDALONE
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <iostream>
|
||||
@@ -57,8 +56,11 @@ void ClientLoop(void * arg) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef EMSESP_UNITY
|
||||
// we have another main that overrides this when using Unity in test_api.cpp
|
||||
int main(int argc __attribute__((unused)), char * argv[] __attribute__((unused))) {
|
||||
setup();
|
||||
|
||||
std::thread t = std::thread(ClientLoop, nullptr);
|
||||
// while (millis() <= 10 * 1000) {
|
||||
while (1) {
|
||||
@@ -69,10 +71,7 @@ int main(int argc __attribute__((unused)), char * argv[] __attribute__((unused))
|
||||
t.join();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// unsigned long millis() {
|
||||
// return __millis;
|
||||
// }
|
||||
#endif
|
||||
|
||||
int64_t esp_timer_get_time() {
|
||||
return __millis;
|
||||
@@ -139,13 +138,13 @@ uint32_t analogReadMilliVolts(uint8_t pin) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void analogSetPinAttenuation(uint8_t pin, adc_attenuation_t attenuation){};
|
||||
void analogSetAttenuation(adc_attenuation_t attenuation){};
|
||||
void dacWrite(uint8_t pin, uint8_t value){};
|
||||
void analogSetPinAttenuation(uint8_t pin, adc_attenuation_t attenuation) {};
|
||||
void analogSetAttenuation(adc_attenuation_t attenuation) {};
|
||||
void dacWrite(uint8_t pin, uint8_t value) {};
|
||||
double ledcSetup(uint8_t chan, double freq, uint8_t bit_num) {
|
||||
return 0;
|
||||
};
|
||||
void ledcAttachPin(uint8_t pin, uint8_t chan){};
|
||||
void ledcWrite(uint8_t chan, uint32_t duty){};
|
||||
void ledcAttachPin(uint8_t pin, uint8_t chan) {};
|
||||
void ledcWrite(uint8_t chan, uint32_t duty) {};
|
||||
|
||||
#endif
|
||||
@@ -32,6 +32,10 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "WString.h"
|
||||
#include "Network.h"
|
||||
|
||||
extern ETHClass ETH;
|
||||
extern WiFiClass WiFi;
|
||||
|
||||
typedef double double_t;
|
||||
|
||||
@@ -86,6 +90,21 @@ int vsnprintf_P(char * str, size_t size, const char * format, va_list ap);
|
||||
#define pgm_read_float(addr) (*(const float *)(addr))
|
||||
#define pgm_read_ptr(addr) (*(const void **)(addr))
|
||||
|
||||
// #if defined(__linux__)
|
||||
#include <chrono> // NOLINT [build/c++11]
|
||||
#include <thread> // NOLINT [build/c++11] for yield()
|
||||
#define millis() std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count()
|
||||
// #endif
|
||||
|
||||
int64_t esp_timer_get_time();
|
||||
|
||||
void delay(unsigned long millis);
|
||||
|
||||
void yield(void);
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
class Print;
|
||||
|
||||
class NativeConsole : public Stream {
|
||||
@@ -94,6 +113,11 @@ class NativeConsole : public Stream {
|
||||
}
|
||||
|
||||
int available() override {
|
||||
#if defined(_WIN32)
|
||||
// added for EMS-ESP
|
||||
return 1;
|
||||
#else
|
||||
|
||||
if (peek_ != -1)
|
||||
return 1;
|
||||
|
||||
@@ -107,6 +131,7 @@ class NativeConsole : public Stream {
|
||||
timeout.tv_usec = 1000;
|
||||
|
||||
return ::select(STDIN_FILENO + 1, &rfds, NULL, NULL, &timeout) > 0 ? 1 : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int read() override {
|
||||
@@ -163,27 +188,6 @@ class NativeConsole : public Stream {
|
||||
int peek_ = -1;
|
||||
};
|
||||
|
||||
#include "Network.h"
|
||||
|
||||
extern NativeConsole Serial;
|
||||
extern ETHClass ETH;
|
||||
extern WiFiClass WiFi;
|
||||
|
||||
// unsigned long millis();
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <chrono> // NOLINT [build/c++11]
|
||||
#include <thread> // NOLINT [build/c++11] for yield()
|
||||
#define millis() std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count()
|
||||
#endif
|
||||
|
||||
int64_t esp_timer_get_time();
|
||||
|
||||
void delay(unsigned long millis);
|
||||
|
||||
void yield(void);
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,64 +42,66 @@ class ChunkPrint : public Print {
|
||||
}
|
||||
};
|
||||
|
||||
class PrettyAsyncJsonResponse {
|
||||
protected:
|
||||
JsonDocument _jsonBuffer;
|
||||
// class PrettyAsyncJsonResponse {
|
||||
// protected:
|
||||
// JsonDocument _jsonBuffer;
|
||||
|
||||
JsonVariant _root;
|
||||
bool _isValid;
|
||||
// JsonVariant _root;
|
||||
// bool _isValid;
|
||||
|
||||
public:
|
||||
PrettyAsyncJsonResponse(bool isArray = false)
|
||||
: _isValid{false} {
|
||||
if (isArray)
|
||||
_root = _jsonBuffer.to<JsonArray>();
|
||||
else
|
||||
_root = _jsonBuffer.add<JsonObject>();
|
||||
}
|
||||
// public:
|
||||
// PrettyAsyncJsonResponse(bool isArray = false)
|
||||
// : _isValid{false} {
|
||||
// if (isArray)
|
||||
// _root = _jsonBuffer.to<JsonArray>();
|
||||
// else
|
||||
// _root = _jsonBuffer.add<JsonObject>();
|
||||
// }
|
||||
|
||||
~PrettyAsyncJsonResponse() {
|
||||
}
|
||||
// ~PrettyAsyncJsonResponse() {
|
||||
// }
|
||||
|
||||
JsonVariant getRoot() {
|
||||
return _root;
|
||||
}
|
||||
// JsonVariant getRoot() {
|
||||
// return _root;
|
||||
// }
|
||||
|
||||
bool _sourceValid() const {
|
||||
return _isValid;
|
||||
}
|
||||
// bool _sourceValid() const {
|
||||
// return _isValid;
|
||||
// }
|
||||
|
||||
size_t setLength() {
|
||||
return 0;
|
||||
}
|
||||
// size_t setLength() {
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
void setContentType(const char * s) {
|
||||
}
|
||||
// void setContentType(const char * s) {
|
||||
// }
|
||||
|
||||
size_t getSize() {
|
||||
return _jsonBuffer.size();
|
||||
}
|
||||
// size_t getSize() {
|
||||
// return _jsonBuffer.size();
|
||||
// }
|
||||
|
||||
size_t _fillBuffer(uint8_t * data, size_t len) {
|
||||
return len;
|
||||
}
|
||||
// size_t _fillBuffer(uint8_t * data, size_t len) {
|
||||
// return len;
|
||||
// }
|
||||
|
||||
void setCode(uint16_t) {
|
||||
}
|
||||
};
|
||||
// void setCode(uint16_t) {
|
||||
// }
|
||||
// };
|
||||
|
||||
class AsyncJsonResponse {
|
||||
protected:
|
||||
JsonDocument _jsonBuffer;
|
||||
|
||||
JsonVariant _root;
|
||||
bool _isValid;
|
||||
bool _isMsgPack;
|
||||
JsonVariant _root;
|
||||
bool _isValid;
|
||||
bool _isMsgPack;
|
||||
int _code;
|
||||
size_t _contentLength;
|
||||
|
||||
public:
|
||||
AsyncJsonResponse(bool isArray = false, bool isMsgPack = false)
|
||||
: _isValid{false}
|
||||
, _isMsgPack{isMsgPack} {
|
||||
_code = 200;
|
||||
if (isArray)
|
||||
_root = _jsonBuffer.to<JsonArray>();
|
||||
else
|
||||
@@ -118,7 +120,12 @@ class AsyncJsonResponse {
|
||||
}
|
||||
|
||||
size_t setLength() {
|
||||
return 0;
|
||||
_contentLength = _isMsgPack ? measureMsgPack(_root) : measureJson(_root);
|
||||
|
||||
if (_contentLength) {
|
||||
_isValid = true;
|
||||
}
|
||||
return _contentLength;
|
||||
}
|
||||
|
||||
size_t getSize() {
|
||||
@@ -126,10 +133,12 @@ class AsyncJsonResponse {
|
||||
}
|
||||
|
||||
size_t _fillBuffer(uint8_t * data, size_t len) {
|
||||
// _isMsgPack ? serializeMsgPack(_root, data) : serializeJson(_root, data);
|
||||
return len;
|
||||
}
|
||||
|
||||
void setCode(uint16_t) {
|
||||
void setCode(uint16_t c) {
|
||||
_code = c;
|
||||
}
|
||||
|
||||
void setContentType(const char * s) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#define NETWORK_SETTINGS_FILE "/config/networkSettings.json"
|
||||
#define NTP_SETTINGS_FILE "/config/ntpSettings.json"
|
||||
#define EMSESP_SETTINGS_FILE "/config/emsespSettings.json"
|
||||
#define OTA_SETTINGS_FILE "/config/otaSettings.json"
|
||||
|
||||
class DummySettings {
|
||||
public:
|
||||
@@ -68,16 +67,16 @@ class DummySettings {
|
||||
bool staticIPConfig = false;
|
||||
String dnsIP1 = "";
|
||||
String dnsIP2 = "";
|
||||
bool enableIPv6 = false;
|
||||
bool enableMDNS = true;
|
||||
bool enableCORS = false;
|
||||
String CORSOrigin = "*";
|
||||
uint8_t tx_power = 0;
|
||||
|
||||
uint8_t provisionMode = 0;
|
||||
uint8_t provisionMode = 0;
|
||||
uint32_t publish_time_water = 0;
|
||||
|
||||
static void read(DummySettings & settings, JsonObject root){};
|
||||
static void read(DummySettings & settings){};
|
||||
static void read(DummySettings & settings, JsonObject root) {};
|
||||
static void read(DummySettings & settings) {};
|
||||
|
||||
static StateUpdateResult update(JsonObject root, DummySettings & settings) {
|
||||
return StateUpdateResult::CHANGED;
|
||||
@@ -86,7 +85,7 @@ class DummySettings {
|
||||
|
||||
class DummySettingsService : public StatefulService<DummySettings> {
|
||||
public:
|
||||
DummySettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager){};
|
||||
DummySettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager) {};
|
||||
|
||||
void begin();
|
||||
void loop();
|
||||
@@ -96,20 +95,18 @@ class DummySettingsService : public StatefulService<DummySettings> {
|
||||
#define SecuritySettings DummySettings
|
||||
#define MqttSettings DummySettings
|
||||
#define NTPSettings DummySettings
|
||||
#define OTASettings DummySettings
|
||||
#define APSettings DummySettings
|
||||
|
||||
|
||||
class ESP8266React {
|
||||
public:
|
||||
ESP8266React(AsyncWebServer * server, FS * fs)
|
||||
: _settings(server, fs, nullptr)
|
||||
, _securitySettingsService(server, fs){};
|
||||
, _securitySettingsService(server, fs) {};
|
||||
|
||||
void begin() {
|
||||
_mqttClient = new espMqttClient();
|
||||
};
|
||||
void loop(){};
|
||||
void loop() {};
|
||||
|
||||
SecurityManager * getSecurityManager() {
|
||||
return &_securitySettingsService;
|
||||
@@ -144,10 +141,6 @@ class ESP8266React {
|
||||
return &_settings;
|
||||
}
|
||||
|
||||
StatefulService<DummySettings> * getOTASettingsService() {
|
||||
return &_settings;
|
||||
}
|
||||
|
||||
StatefulService<DummySettings> * getAPSettingsService() {
|
||||
return &_settings;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ class AsyncWebServer;
|
||||
class AsyncWebServerRequest;
|
||||
class AsyncWebServerResponse;
|
||||
class AsyncJsonResponse;
|
||||
class PrettyAsyncJsonResponse;
|
||||
class MsgpackAsyncJsonResponse;
|
||||
// class PrettyAsyncJsonResponse;
|
||||
// class MsgpackAsyncJsonResponse;
|
||||
class AsyncEventSource;
|
||||
|
||||
class AsyncWebParameter {
|
||||
@@ -76,9 +76,9 @@ class AsyncWebServerRequest {
|
||||
public:
|
||||
void * _tempObject;
|
||||
|
||||
AsyncWebServerRequest(AsyncWebServer *, AsyncClient *){};
|
||||
AsyncWebServerRequest(){};
|
||||
~AsyncWebServerRequest(){};
|
||||
AsyncWebServerRequest(AsyncWebServer *, AsyncClient *) {};
|
||||
AsyncWebServerRequest() {};
|
||||
~AsyncWebServerRequest() {};
|
||||
|
||||
AsyncClient * client() {
|
||||
return _client;
|
||||
@@ -92,18 +92,20 @@ class AsyncWebServerRequest {
|
||||
_method = method_s;
|
||||
}
|
||||
|
||||
void addInterestingHeader(const String & name){};
|
||||
void addInterestingHeader(const String & name) {};
|
||||
|
||||
size_t args() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void send(AsyncWebServerResponse * response){};
|
||||
void send(AsyncJsonResponse * response){};
|
||||
void send(PrettyAsyncJsonResponse * response){};
|
||||
void send(MsgpackAsyncJsonResponse * response){};
|
||||
void send(int code, const String & contentType = String(), const String & content = String()){};
|
||||
void send(int code, const String & contentType, const __FlashStringHelper *){};
|
||||
void send(AsyncWebServerResponse * response) {};
|
||||
|
||||
void send(AsyncJsonResponse * response) {};
|
||||
|
||||
// void send(PrettyAsyncJsonResponse * response) {};
|
||||
// void send(MsgpackAsyncJsonResponse * response) {};
|
||||
void send(int code, const String & contentType = String(), const String & content = String()) {};
|
||||
void send(int code, const String & contentType, const __FlashStringHelper *) {};
|
||||
|
||||
const String & url() const {
|
||||
return _url;
|
||||
@@ -205,6 +207,17 @@ class AsyncWebHandler {
|
||||
};
|
||||
|
||||
class AsyncWebServerResponse {
|
||||
protected:
|
||||
int _code;
|
||||
String _contentType;
|
||||
size_t _contentLength;
|
||||
bool _sendContentLength;
|
||||
bool _chunked;
|
||||
size_t _headLength;
|
||||
size_t _sentLength;
|
||||
size_t _ackedLength;
|
||||
size_t _writtenLength;
|
||||
|
||||
public:
|
||||
AsyncWebServerResponse();
|
||||
virtual ~AsyncWebServerResponse();
|
||||
@@ -213,7 +226,7 @@ class AsyncWebServerResponse {
|
||||
typedef std::function<void(AsyncWebServerRequest * request)> ArRequestHandlerFunction;
|
||||
typedef std::function<void(AsyncWebServerRequest * request, const String & filename, size_t index, uint8_t * data, size_t len, bool final)> ArUploadHandlerFunction;
|
||||
typedef std::function<void(AsyncWebServerRequest * request, uint8_t * data, size_t len, size_t index, size_t total)> ArBodyHandlerFunction;
|
||||
typedef std::function<void(AsyncWebServerRequest * request, JsonVariant json)> ArJsonRequestHandlerFunction; // added by proddy
|
||||
typedef std::function<void(AsyncWebServerRequest * request, JsonVariant json)> ArJsonRequestHandlerFunction; // added by proddy for EMS-ESP
|
||||
|
||||
class AsyncWebServer {
|
||||
protected:
|
||||
@@ -221,32 +234,32 @@ class AsyncWebServer {
|
||||
|
||||
public:
|
||||
AsyncWebServer(uint16_t port)
|
||||
: _server(port){};
|
||||
: _server(port) {};
|
||||
|
||||
~AsyncWebServer(){};
|
||||
~AsyncWebServer() {};
|
||||
|
||||
void begin(){};
|
||||
void begin() {};
|
||||
void end();
|
||||
|
||||
AsyncWebHandler & addHandler(AsyncWebHandler * handler) {
|
||||
return *handler;
|
||||
}
|
||||
|
||||
void on(const char * uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest){};
|
||||
void on(const char * uri, ArJsonRequestHandlerFunction onRequest){}; // added by proddy
|
||||
void on(const char * uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest) {};
|
||||
void on(const char * uri, ArJsonRequestHandlerFunction onRequest) {}; // added by proddy for EMS-ESP
|
||||
};
|
||||
|
||||
|
||||
class AsyncEventSource : public AsyncWebHandler {
|
||||
public:
|
||||
AsyncEventSource(const String & url){};
|
||||
~AsyncEventSource(){};
|
||||
AsyncEventSource(const String & url) {};
|
||||
~AsyncEventSource() {};
|
||||
|
||||
size_t count() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void send(const char * message, const char * event = NULL, uint32_t id = 0, uint32_t reconnect = 0){};
|
||||
void send(const char * message, const char * event = NULL, uint32_t id = 0, uint32_t reconnect = 0) {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +21,6 @@
|
||||
#define FT_NTP 0
|
||||
#endif
|
||||
|
||||
// mqtt feature on by default
|
||||
#ifndef FT_OTA
|
||||
#define FT_OTA 0
|
||||
#endif
|
||||
|
||||
// upload firmware/file feature off by default
|
||||
#ifndef FT_UPLOAD_FIRMWARE
|
||||
#define FT_UPLOAD_FIRMWARE 0
|
||||
|
||||
27
lib_standalone/HTTPClient.h
Normal file
27
lib_standalone/HTTPClient.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef HTTPClient_H_
|
||||
#define HTTPClient_H_
|
||||
|
||||
#include "WString.h"
|
||||
|
||||
class HTTPClient {
|
||||
public:
|
||||
// HTTPClient();
|
||||
// ~HTTPClient();
|
||||
|
||||
bool begin(String url) {
|
||||
return true;
|
||||
};
|
||||
void end(void) {};
|
||||
int GET() {
|
||||
return 200;
|
||||
};
|
||||
int POST(String payload) {
|
||||
return 200;
|
||||
};
|
||||
void addHeader(const String & name, const String & value, bool first = false, bool replace = true) {};
|
||||
String getString(void) {
|
||||
return "Hello, World!";
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* HTTPClient_H_ */
|
||||
31
lib_standalone/ModuleLibrary.cpp
Normal file
31
lib_standalone/ModuleLibrary.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2024 emsesp.org - proddy, MichaelDvP
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <emsesp.h>
|
||||
|
||||
void ModuleLibrary::list(JsonObject output) {};
|
||||
|
||||
void ModuleLibrary::loop() {};
|
||||
|
||||
void ModuleLibrary::start(emsesp::EMSESP * emsesp_main, bool test_mode) {};
|
||||
|
||||
bool ModuleLibrary::enable(const char * key, const char * license, bool enable) {
|
||||
return true;
|
||||
};
|
||||
52
lib_standalone/ModuleLibrary.h
Normal file
52
lib_standalone/ModuleLibrary.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2024 emsesp.org - proddy, MichaelDvP
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MODULELIBRARY_H
|
||||
#define MODULELIBRARY_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <emsesp.h>
|
||||
|
||||
class ModuleLibrary {
|
||||
public:
|
||||
class Modules {
|
||||
public:
|
||||
Modules(const char * key, std::unique_ptr<Module> module)
|
||||
: key(key)
|
||||
, module(std::move(module)) {
|
||||
}
|
||||
const char * key;
|
||||
std::unique_ptr<Module> module;
|
||||
};
|
||||
|
||||
void start(emsesp::EMSESP * emsesp_main, bool test_mode = false);
|
||||
void loop();
|
||||
void list(JsonObject output);
|
||||
bool enable(const char * key, const char * license, bool enable);
|
||||
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
private:
|
||||
std::vector<Modules> modules_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Arduino.h"
|
||||
|
||||
#include <functional>
|
||||
#include <IPAddress.h>
|
||||
#include <ClientPosixIPAddress.h>
|
||||
|
||||
#define WiFiMode_t wifi_mode_t
|
||||
#define WIFI_OFF WIFI_MODE_NULL
|
||||
@@ -162,7 +162,7 @@ class WiFiClass {
|
||||
return 0;
|
||||
};
|
||||
|
||||
void disconnect(bool v){};
|
||||
void disconnect(bool v) {};
|
||||
|
||||
char * getHostname() {
|
||||
return nullptr;
|
||||
@@ -183,7 +183,7 @@ class ETHClass {
|
||||
return false;
|
||||
};
|
||||
|
||||
void setHostname(const char * s){};
|
||||
void setHostname(const char * s) {};
|
||||
|
||||
char * getHostname() {
|
||||
return nullptr;
|
||||
|
||||
@@ -41,6 +41,10 @@ class Preferences {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getChar(const char * key, uint8_t defaultValue = 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
double getDouble(const char * key, double defaultValue = NAN) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,12 @@ class Print {
|
||||
return print(str);
|
||||
}
|
||||
size_t println() {
|
||||
// added for EMS-ESP
|
||||
#if defined(_WIN32)
|
||||
return print("\n");
|
||||
#else
|
||||
return print("\r\n");
|
||||
#endif
|
||||
}
|
||||
size_t println(const char * data) {
|
||||
return print(data) + println();
|
||||
@@ -106,7 +111,7 @@ class Print {
|
||||
size_t println(unsigned long value) {
|
||||
return print(std::to_string(value).c_str()) + println();
|
||||
}
|
||||
virtual void flush(){};
|
||||
virtual void flush() {};
|
||||
|
||||
private:
|
||||
int err_{0};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "Print.h"
|
||||
#include "WString.h"
|
||||
|
||||
// compatability macros for testing
|
||||
// compatibility macros for testing
|
||||
/*
|
||||
#define getInt() parseInt()
|
||||
#define getInt(skipChar) parseInt(skipchar)
|
||||
@@ -91,7 +91,7 @@ class Stream : public Print {
|
||||
// initial characters that are not digits (or the minus sign) are skipped
|
||||
// integer is terminated by the first character that is not a digit.
|
||||
|
||||
float parseFloat(); // float version of parseInt
|
||||
float parseFloat(); // float version of parseInt
|
||||
|
||||
virtual size_t readBytes(char * buffer, size_t length) // read chars from stream into buffer
|
||||
{
|
||||
|
||||
@@ -69,4 +69,4 @@ size_t strlcat(char * dst, const char * src, size_t siz) {
|
||||
return (dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -53,6 +53,14 @@ class String {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int len() const {
|
||||
return _str.size();
|
||||
}
|
||||
|
||||
bool startsWith(const char * prefix) const {
|
||||
return _str.find(prefix) == 0;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string _str;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2024 Paul Derbyshire
|
||||
* Copyright 2020-2024 emsesp.org - proddy, MichaelDvP
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,9 +20,6 @@
|
||||
|
||||
#include "emsuart_standalone.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
/*
|
||||
@@ -87,6 +84,4 @@ char * EMSuart::hextoa(char * result, const uint8_t value) {
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2024 Paul Derbyshire
|
||||
* Copyright 2020-2024 emsesp.org - proddy, MichaelDvP
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
Reference in New Issue
Block a user