mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-10-16 03:51:27 +08:00
removes heretic functions...
apply astyle
This commit is contained in:
parent
ba6b0b708d
commit
03c9e3868c
@ -45,12 +45,19 @@ uint8_t ESP3DOutput::_outputflags = ESP_ALL_CLIENTS;
|
|||||||
#endif //DISPLAY_DEVICE
|
#endif //DISPLAY_DEVICE
|
||||||
|
|
||||||
//tool function to avoid string corrupt JSON files
|
//tool function to avoid string corrupt JSON files
|
||||||
const char * encodeString(const char * s){
|
const char * encodeString(const char * s)
|
||||||
|
{
|
||||||
static String tmp;
|
static String tmp;
|
||||||
tmp = s;
|
tmp = s;
|
||||||
while(tmp.indexOf("'")!=-1)tmp.replace("'", "'");
|
while(tmp.indexOf("'")!=-1) {
|
||||||
while(tmp.indexOf("\"")!=-1)tmp.replace("\"", """);
|
tmp.replace("'", "'");
|
||||||
if (tmp =="") tmp=" ";
|
}
|
||||||
|
while(tmp.indexOf("\"")!=-1) {
|
||||||
|
tmp.replace("\"", """);
|
||||||
|
}
|
||||||
|
if (tmp =="") {
|
||||||
|
tmp=" ";
|
||||||
|
}
|
||||||
return tmp.c_str();
|
return tmp.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ bool Commands::ESP410(const char* cmd_params, level_authenticate_type auth_type,
|
|||||||
if (!plain) {
|
if (!plain) {
|
||||||
output->print ("{\"SSID\":\"");
|
output->print ("{\"SSID\":\"");
|
||||||
output->print (encodeString(WiFi.SSID (i).c_str()));
|
output->print (encodeString(WiFi.SSID (i).c_str()));
|
||||||
} else output->print (WiFi.SSID (i).c_str());
|
} else {
|
||||||
|
output->print (WiFi.SSID (i).c_str());
|
||||||
|
}
|
||||||
if (!plain) {
|
if (!plain) {
|
||||||
output->print ("\",\"SIGNAL\":\"");
|
output->print ("\",\"SIGNAL\":\"");
|
||||||
} else {
|
} else {
|
||||||
|
@ -341,8 +341,11 @@ bool Commands::ESP420(const char* cmd_params, level_authenticate_type auth_type,
|
|||||||
} else {
|
} else {
|
||||||
output->print (": ");
|
output->print (": ");
|
||||||
}
|
}
|
||||||
if (!plain)output->print (encodeString(NetConfig::hostname()));
|
if (!plain) {
|
||||||
else output->print (NetConfig::hostname());
|
output->print (encodeString(NetConfig::hostname()));
|
||||||
|
} else {
|
||||||
|
output->print (NetConfig::hostname());
|
||||||
|
}
|
||||||
|
|
||||||
if (!plain) {
|
if (!plain) {
|
||||||
output->print ("\"}");
|
output->print ("\"}");
|
||||||
@ -731,8 +734,11 @@ bool Commands::ESP420(const char* cmd_params, level_authenticate_type auth_type,
|
|||||||
output->print (": ");
|
output->print (": ");
|
||||||
}
|
}
|
||||||
if (WiFi.isConnected()) {
|
if (WiFi.isConnected()) {
|
||||||
if (!plain) output->print (encodeString(WiFi.SSID().c_str()));
|
if (!plain) {
|
||||||
else output->print (WiFi.SSID().c_str());
|
output->print (encodeString(WiFi.SSID().c_str()));
|
||||||
|
} else {
|
||||||
|
output->print (WiFi.SSID().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!plain) {
|
if (!plain) {
|
||||||
output->print ("\"}");
|
output->print ("\"}");
|
||||||
@ -913,8 +919,11 @@ bool Commands::ESP420(const char* cmd_params, level_authenticate_type auth_type,
|
|||||||
} else {
|
} else {
|
||||||
output->print (": ");
|
output->print (": ");
|
||||||
}
|
}
|
||||||
if (!plain)output->print (encodeString(WiFiConfig::AP_SSID()));
|
if (!plain) {
|
||||||
else output->print (WiFiConfig::AP_SSID());
|
output->print (encodeString(WiFiConfig::AP_SSID()));
|
||||||
|
} else {
|
||||||
|
output->print (WiFiConfig::AP_SSID());
|
||||||
|
}
|
||||||
if (!plain) {
|
if (!plain) {
|
||||||
output->print ("\"}");
|
output->print ("\"}");
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,17 +43,6 @@ int ChannelAttached2Pin[16]= {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
|
|||||||
uint32_t Hal::_analogWriteRange = 255;
|
uint32_t Hal::_analogWriteRange = 255;
|
||||||
uint32_t Hal::_analogWriteFreq = 1000;
|
uint32_t Hal::_analogWriteFreq = 1000;
|
||||||
|
|
||||||
//Contructor
|
|
||||||
Hal::Hal()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Destructor
|
|
||||||
Hal::~Hal()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hal::clearAnalogChannels()
|
void Hal::clearAnalogChannels()
|
||||||
{
|
{
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
class Hal
|
class Hal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hal();
|
|
||||||
~Hal();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static void wait (uint32_t milliseconds);
|
static void wait (uint32_t milliseconds);
|
||||||
|
@ -174,13 +174,6 @@ const uint8_t DEFAULT_ADDRESS_VALUE[] = {0, 0, 0, 0};
|
|||||||
uint8_t Settings_ESP3D::_FirmwareTarget = UNKNOWN_FW;
|
uint8_t Settings_ESP3D::_FirmwareTarget = UNKNOWN_FW;
|
||||||
bool Settings_ESP3D::_SDdevice = ESP_NO_SD;
|
bool Settings_ESP3D::_SDdevice = ESP_NO_SD;
|
||||||
|
|
||||||
Settings_ESP3D::Settings_ESP3D()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
Settings_ESP3D::~Settings_ESP3D()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings_ESP3D::begin()
|
bool Settings_ESP3D::begin()
|
||||||
{
|
{
|
||||||
if(GetSettingsVersion() == -1) {
|
if(GetSettingsVersion() == -1) {
|
||||||
|
@ -102,8 +102,6 @@
|
|||||||
class Settings_ESP3D
|
class Settings_ESP3D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Settings_ESP3D();
|
|
||||||
~Settings_ESP3D();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static uint8_t get_default_byte_value(int pos);
|
static uint8_t get_default_byte_value(int pos);
|
||||||
static uint32_t get_default_int32_value(int pos);
|
static uint32_t get_default_int32_value(int pos);
|
||||||
|
@ -47,16 +47,6 @@ uint8_t AuthenticationService::_current_nb_ip = 0;
|
|||||||
#define MAX_AUTH_IP 10
|
#define MAX_AUTH_IP 10
|
||||||
//#define ALLOW_MULTIPLE_SESSIONS
|
//#define ALLOW_MULTIPLE_SESSIONS
|
||||||
|
|
||||||
AuthenticationService::AuthenticationService()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
AuthenticationService::~AuthenticationService()
|
|
||||||
{
|
|
||||||
#if defined (HTTP_FEATURE) && defined (AUTHENTICATION_FEATURE)
|
|
||||||
end();
|
|
||||||
#endif //HTTP_FEATURE && AUTHENTICATION_FEATURE
|
|
||||||
}
|
|
||||||
|
|
||||||
//check authentification
|
//check authentification
|
||||||
level_authenticate_type AuthenticationService::authenticated_level(const char * pwd)
|
level_authenticate_type AuthenticationService::authenticated_level(const char * pwd)
|
||||||
{
|
{
|
||||||
|
@ -58,8 +58,6 @@ typedef void Authwebserver;
|
|||||||
class AuthenticationService
|
class AuthenticationService
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AuthenticationService();
|
|
||||||
~AuthenticationService();
|
|
||||||
static level_authenticate_type authenticated_level(const char * pwd = nullptr);
|
static level_authenticate_type authenticated_level(const char * pwd = nullptr);
|
||||||
#ifdef AUTHENTICATION_FEATURE
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
static bool begin(Authwebserver * webserver);
|
static bool begin(Authwebserver * webserver);
|
||||||
|
@ -45,14 +45,6 @@
|
|||||||
|
|
||||||
bool DevicesServices::_started = false;
|
bool DevicesServices::_started = false;
|
||||||
|
|
||||||
DevicesServices::DevicesServices()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
DevicesServices::~DevicesServices()
|
|
||||||
{
|
|
||||||
end();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DevicesServices::begin()
|
bool DevicesServices::begin()
|
||||||
{
|
{
|
||||||
bool res = true;
|
bool res = true;
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
class DevicesServices
|
class DevicesServices
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DevicesServices();
|
|
||||||
~DevicesServices();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static void handle();
|
static void handle();
|
||||||
|
@ -32,14 +32,6 @@
|
|||||||
#include "ethconfig.h"
|
#include "ethconfig.h"
|
||||||
bool EthConfig::_started = false;
|
bool EthConfig::_started = false;
|
||||||
const uint8_t DEFAULT_AP_MASK_VALUE[] = {255, 255, 255, 0};
|
const uint8_t DEFAULT_AP_MASK_VALUE[] = {255, 255, 255, 0};
|
||||||
EthConfig::EthConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EthConfig::~EthConfig()
|
|
||||||
{
|
|
||||||
end();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EthConfig::StartSTA()
|
bool EthConfig::StartSTA()
|
||||||
{
|
{
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
class EthConfig
|
class EthConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EthConfig();
|
|
||||||
~EthConfig();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static bool StartSTA();
|
static bool StartSTA();
|
||||||
//static bool StartSRV();
|
//static bool StartSRV();
|
||||||
|
@ -31,16 +31,6 @@ File tFile_handle[ESP_MAX_OPENHANDLE];
|
|||||||
|
|
||||||
bool ESP_FileSystem::_started = false;
|
bool ESP_FileSystem::_started = false;
|
||||||
|
|
||||||
//constructor
|
|
||||||
ESP_FileSystem::ESP_FileSystem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//destructor
|
|
||||||
ESP_FileSystem::~ESP_FileSystem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//helper to format size to readable string
|
//helper to format size to readable string
|
||||||
String & ESP_FileSystem::formatBytes (uint64_t bytes)
|
String & ESP_FileSystem::formatBytes (uint64_t bytes)
|
||||||
{
|
{
|
||||||
|
@ -65,8 +65,6 @@ class ESP_FileSystem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static String & formatBytes (uint64_t bytes);
|
static String & formatBytes (uint64_t bytes);
|
||||||
ESP_FileSystem();
|
|
||||||
~ESP_FileSystem();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static size_t totalBytes();
|
static size_t totalBytes();
|
||||||
|
@ -42,16 +42,6 @@ bool ESP_GBFS::isavailable(uint8_t FS)
|
|||||||
|
|
||||||
uint8_t ESP_GBFS::_nbFS = 0;
|
uint8_t ESP_GBFS::_nbFS = 0;
|
||||||
String ESP_GBFS::_rootlist[MAX_FS];
|
String ESP_GBFS::_rootlist[MAX_FS];
|
||||||
//constructor
|
|
||||||
ESP_GBFS::ESP_GBFS()
|
|
||||||
{
|
|
||||||
_nbFS = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//destructor
|
|
||||||
ESP_GBFS::~ESP_GBFS()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//helper to format size to readable string
|
//helper to format size to readable string
|
||||||
String & ESP_GBFS::formatBytes (uint64_t bytes)
|
String & ESP_GBFS::formatBytes (uint64_t bytes)
|
||||||
|
@ -80,8 +80,6 @@ private:
|
|||||||
class ESP_GBFS
|
class ESP_GBFS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ESP_GBFS();
|
|
||||||
~ESP_GBFS();
|
|
||||||
static bool isavailable(uint8_t FS);
|
static bool isavailable(uint8_t FS);
|
||||||
static uint64_t totalBytes(uint8_t FS);
|
static uint64_t totalBytes(uint8_t FS);
|
||||||
static uint64_t usedBytes(uint8_t FS);
|
static uint64_t usedBytes(uint8_t FS);
|
||||||
|
@ -49,16 +49,6 @@ uint8_t ESP_SD::setState(uint8_t flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//constructor
|
|
||||||
ESP_SD::ESP_SD()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//destructor
|
|
||||||
ESP_SD::~ESP_SD()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ESP_SD::handle()
|
void ESP_SD::handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -66,8 +66,6 @@ class ESP_SD
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static String & formatBytes (uint64_t bytes);
|
static String & formatBytes (uint64_t bytes);
|
||||||
ESP_SD();
|
|
||||||
~ESP_SD();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void handle();
|
static void handle();
|
||||||
static void end();
|
static void end();
|
||||||
|
@ -42,14 +42,6 @@ uint16_t HTTP_Server::_port = 0;
|
|||||||
WEBSERVER * HTTP_Server::_webserver = nullptr;
|
WEBSERVER * HTTP_Server::_webserver = nullptr;
|
||||||
uint8_t HTTP_Server::_upload_status = UPLOAD_STATUS_NONE;
|
uint8_t HTTP_Server::_upload_status = UPLOAD_STATUS_NONE;
|
||||||
|
|
||||||
HTTP_Server::HTTP_Server()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
HTTP_Server::~HTTP_Server()
|
|
||||||
{
|
|
||||||
end();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HTTP_Server::init_handlers()
|
void HTTP_Server::init_handlers()
|
||||||
{
|
{
|
||||||
_webserver->on("/",HTTP_ANY, handle_root);
|
_webserver->on("/",HTTP_ANY, handle_root);
|
||||||
|
@ -45,8 +45,6 @@ typedef enum {
|
|||||||
class HTTP_Server
|
class HTTP_Server
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HTTP_Server();
|
|
||||||
~HTTP_Server();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static void handle();
|
static void handle();
|
||||||
|
@ -49,14 +49,6 @@ bool NetConfig::_needReconnect2AP = false;
|
|||||||
bool NetConfig::_events_registered = false;
|
bool NetConfig::_events_registered = false;
|
||||||
bool NetConfig::_started = false;
|
bool NetConfig::_started = false;
|
||||||
uint8_t NetConfig::_mode = ESP_RADIO_OFF;
|
uint8_t NetConfig::_mode = ESP_RADIO_OFF;
|
||||||
NetConfig::NetConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NetConfig::~NetConfig()
|
|
||||||
{
|
|
||||||
//end();
|
|
||||||
}
|
|
||||||
|
|
||||||
//just simple helper to convert mac address to string
|
//just simple helper to convert mac address to string
|
||||||
char * NetConfig::mac2str (uint8_t mac [8])
|
char * NetConfig::mac2str (uint8_t mac [8])
|
||||||
|
@ -57,8 +57,6 @@
|
|||||||
class NetConfig
|
class NetConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetConfig();
|
|
||||||
~NetConfig();
|
|
||||||
static bool isValidIP(const char * string);
|
static bool isValidIP(const char * string);
|
||||||
static bool isHostnameValid (const char * hostname);
|
static bool isHostnameValid (const char * hostname);
|
||||||
static uint32_t IP_int_from_string(const char * s);
|
static uint32_t IP_int_from_string(const char * s);
|
||||||
|
@ -74,13 +74,6 @@ DNSServer dnsServer;
|
|||||||
#endif //CAMERA_DEVICE
|
#endif //CAMERA_DEVICE
|
||||||
bool NetServices::_started = false;
|
bool NetServices::_started = false;
|
||||||
bool NetServices::_restart = false;
|
bool NetServices::_restart = false;
|
||||||
NetServices::NetServices()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
NetServices::~NetServices()
|
|
||||||
{
|
|
||||||
end();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NetServices::begin()
|
bool NetServices::begin()
|
||||||
{
|
{
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
class NetServices
|
class NetServices
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetServices();
|
|
||||||
~NetServices();
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static void handle();
|
static void handle();
|
||||||
|
@ -32,14 +32,6 @@
|
|||||||
|
|
||||||
const uint8_t DEFAULT_AP_MASK_VALUE[] = {255, 255, 255, 0};
|
const uint8_t DEFAULT_AP_MASK_VALUE[] = {255, 255, 255, 0};
|
||||||
|
|
||||||
WiFiConfig::WiFiConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
WiFiConfig::~WiFiConfig()
|
|
||||||
{
|
|
||||||
end();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if SSID string is valid
|
* Check if SSID string is valid
|
||||||
|
@ -53,8 +53,6 @@
|
|||||||
class WiFiConfig
|
class WiFiConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WiFiConfig();
|
|
||||||
~WiFiConfig();
|
|
||||||
static bool isPasswordValid (const char * password);
|
static bool isPasswordValid (const char * password);
|
||||||
static bool isSSIDValid (const char * ssid);
|
static bool isSSIDValid (const char * ssid);
|
||||||
static bool StartAP();
|
static bool StartAP();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user