mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-28 15:12:19 +03:00
32 broken
This commit is contained in:
55
include/Utils/FileHelper.h
Normal file
55
include/Utils/FileHelper.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "FS.h"
|
||||
|
||||
#ifdef ESP32
|
||||
#include "LITTLEFS.h"
|
||||
#define LittleFS LITTLEFS
|
||||
#endif
|
||||
#ifdef ESP8266
|
||||
#include <LittleFS.h>
|
||||
#endif
|
||||
|
||||
class FileHelper {
|
||||
public:
|
||||
FileHelper(const String filename);
|
||||
/*
|
||||
* Проверить существование
|
||||
*/
|
||||
void exists();
|
||||
/*
|
||||
* Удалить файл
|
||||
*/
|
||||
void remove();
|
||||
/*
|
||||
* Открыть файл установить позицию @position
|
||||
*/
|
||||
File seek(size_t position = 0);
|
||||
|
||||
/*
|
||||
* Чтение строки с содержащей @substr
|
||||
*/
|
||||
String readFileString(const String substr);
|
||||
|
||||
/*
|
||||
* Добовление строки @str в файл
|
||||
*/
|
||||
String appendStr(const String str);
|
||||
|
||||
/*
|
||||
* Запись строки
|
||||
*/
|
||||
String writeStr(const String);
|
||||
|
||||
/*
|
||||
* Чтение в строку
|
||||
*/
|
||||
String readStr(size_t);
|
||||
|
||||
/*
|
||||
* Размер в байтах
|
||||
*/
|
||||
size_t getSize();
|
||||
};
|
||||
@@ -11,6 +11,7 @@
|
||||
#ifdef ESP8266
|
||||
#include <LittleFS.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Инициализация ФС
|
||||
*/
|
||||
|
||||
32
include/Utils/PrintMessage.h
Normal file
32
include/Utils/PrintMessage.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "CommonTypes.h"
|
||||
#include "Utils\StringUtils.h"
|
||||
#include "Utils\TimeUtils.h"
|
||||
#include "Errors.h"
|
||||
|
||||
#define pm PrintMessage(MODULE)
|
||||
|
||||
class PrintMessage {
|
||||
public:
|
||||
PrintMessage(const char* module) {
|
||||
_module = module;
|
||||
}
|
||||
|
||||
void error(const String str) {
|
||||
print(EL_ERROR, str);
|
||||
}
|
||||
|
||||
void info(const String str) {
|
||||
print(EL_INFO, str);
|
||||
}
|
||||
|
||||
private:
|
||||
void print(const ErrorLevel_t level, const String& str) {
|
||||
Serial.printf("%s [%s] [%s] %s\n", prettyMillis().c_str(), getErrorLevelStr(level).c_str(), _module, str.c_str());
|
||||
}
|
||||
|
||||
private:
|
||||
const char* _module;
|
||||
};
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "CommonTypes.h"
|
||||
|
||||
uint8_t hexStringToUint8(String hex);
|
||||
|
||||
uint16_t hexStringToUint16(String hex);
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
|
||||
void Time_Init();
|
||||
|
||||
void time_check();
|
||||
|
||||
void reconfigTime();
|
||||
|
||||
/*
|
||||
* Получение текущего времени
|
||||
*/
|
||||
@@ -22,7 +18,7 @@ String getTimeUnix();
|
||||
|
||||
/*
|
||||
* Параметр время
|
||||
* Результат выполнения
|
||||
* @result результат
|
||||
*/
|
||||
boolean getUnixTimeStr(String&);
|
||||
|
||||
@@ -38,3 +34,9 @@ String getDateDigitalFormated();
|
||||
int timeToMin(String Time);
|
||||
|
||||
const String prettyMillis(unsigned long time_ms = millis());
|
||||
|
||||
int timeZoneInSeconds(const byte timeZone);
|
||||
|
||||
bool hasTimeSynced();
|
||||
|
||||
int getBiasInSeconds();
|
||||
10
include/Utils/WiFiUtils.h
Normal file
10
include/Utils/WiFiUtils.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
boolean scanWiFi(String ssid);
|
||||
|
||||
void startSTAMode();
|
||||
|
||||
bool startAPMode();
|
||||
|
||||
Reference in New Issue
Block a user