Go to the source code of this file.
Data Structures | |
class | SerialOut |
Macros | |
#define | POLY 0xedb88320 |
CRC-32 (Ethernet, ZIP, etc.) polynomial in reversed bit order. | |
Functions | |
long | secondsSincePowerOn () |
bool | secondsElapsed (long &lastCheckSec, const long &intervalSec) |
bool | secondsElapsedAndUpdate (long &lastCheckSec, const long &intervalSec) |
long | crc32 (long crc, unsigned char *buf, size_t len) |
void | myDebugInfo (String info, bool isWebServer, bool newline) |
void | MyDbg (String info, bool fromWebServer=false, bool newline=true) |
void | myDelayLoop () |
void | MyDelay (long millisDelay) |
String | WifiGetRssiAsQuality (int rssi) |
String | TextToUrl (String data) |
String | TextToXml (String data) |
String | Trim (const String &data, const String &chars) |
String | formatInterval (long secs) |
bool | scanInterval (String interval, long &secs) |
void | SetupOTA () |
A collection of utility functions.
Definition in file Utils.h.
long crc32 | ( | long | crc, |
unsigned char * | buf, | ||
size_t | len | ||
) |
Simple crc function. Can multiple called but the first time crc should be 0.
Definition at line 77 of file Utils.h.
References POLY.
Referenced by MyData::RtcData::getCRC().
String formatInterval | ( | long | secs | ) |
Helper function to format seconds to x days hours:minutes:seconds
Definition at line 191 of file Utils.h.
Referenced by MyMqtt::handleClient(), MyWebServer::handleLoadInfoInfo(), MyWebServer::handleLoadMainInfo(), and MyWebServer::handleLoadSettingsInfo().
void MyDbg | ( | String | info, |
bool | fromWebServer = false , |
||
bool | newline = true |
||
) |
Short version of myDebugInfo. fromWebServer prevents recursive calls when from WebServer
Definition at line 94 of file Utils.h.
References myDebugInfo().
Referenced by MyGsmPower::begin(), MyDeepSleep::begin(), MyVoltage::begin(), MyGsmGps::begin(), MySmsCmd::begin(), MyMqtt::begin(), MyWebServer::begin(), MySmsCmd::checkSms(), MySmsCmd::cmdPsm(), MyGsmGps::deleteSMS(), MyGsmGps::enableGps(), MyGsmGps::getGps(), MyGsmGps::getGpsFromGsm(), MyGsmGps::getSMS(), MyGsmGps::handleClient(), MyMqtt::handleClient(), MyWebServer::handleLoadConsoleInfo(), MyWebServer::handleLoadSettingsInfo(), MyWebServer::handleNotFound(), MyWebServer::handleSaveSettings(), MyOptions::load(), MyWebServer::loadRestart(), MyMqtt::mqttCallback(), MyMqtt::myPublish(), MyMqtt::mySubscribe(), MyGsmPower::off(), MyGsmPower::on(), readFromSpiffs(), MyBME280::readValues(), MyVoltage::readVoltage(), MyOptions::save(), MyGsmGps::sendAT(), MyGsmGps::sendSMS(), setup(), SetupOTA(), MyDeepSleep::sleep(), MyGsmGps::sleepMode2(), and MyGsmGps::stop().
void myDebugInfo | ( | String | info, |
bool | fromWebserver, | ||
bool | newline | ||
) |
This function has to be overwritten to implement the handle of debug informations.
Overwritten Debug Function It logs all the debug calls to the console string-list And call a refresh of the webserver for not blocking the system.
Definition at line 92 of file tracker.ino.
References StringList::addTail(), MyWebServer::handleClient(), MyData::logInfos, myWebServer, StringList::removeTail(), secondsSincePowerOn(), and yield().
Referenced by MyDbg().
void MyDelay | ( | long | millisDelay | ) |
Replacement with background calls when we have to wait. Replace the delay function.
Definition at line 104 of file Utils.h.
References myDelayLoop(), and yield().
Referenced by MyGsmGps::begin(), MyWebServer::begin(), MyMqtt::handleClient(), MyWebServer::loadRestart(), and MyGsmPower::on().
void myDelayLoop | ( | ) |
This function has to be overwritten to implement background delay calls.
Overwritten delay loop for refreshing the webserver on waiting processes.
Definition at line 122 of file tracker.ino.
References MyWebServer::handleClient(), myWebServer, and yield().
Referenced by MyDelay().
bool scanInterval | ( | String | interval, |
long & | secs | ||
) |
Helper function to scan a interval information '[days] hours:minutes:seconds'
Definition at line 210 of file Utils.h.
References Trim().
Referenced by MyWebServer::GetOption().
bool secondsElapsed | ( | long & | lastCheckSec, |
const long & | intervalSec | ||
) |
Checks if the intervalSec is from the last checkIntervalSec elapsed
Definition at line 52 of file Utils.h.
References secondsSincePowerOn().
Referenced by MyGsmGps::handleClient(), MyMqtt::handleClient(), and MyMqtt::waitingForMqtt().
bool secondsElapsedAndUpdate | ( | long & | lastCheckSec, |
const long & | intervalSec | ||
) |
Checks if the intervalSec is from the last checkIntervalSec elapsed and if true it sets the lastCheckSec value
Definition at line 63 of file Utils.h.
References secondsSincePowerOn().
Referenced by MyGsmGps::handleClient(), MySmsCmd::handleClient(), and MyBME280::readValues().
long secondsSincePowerOn | ( | ) |
This function has to be overwritten to return the seconds since power up (not since last deep sleep).
Returns the seconds since power up (not since last deep sleep).
Definition at line 132 of file tracker.ino.
References MyData::secondsSincePowerOn().
Referenced by MyDeepSleep::begin(), MyGsmGps::getGps(), MyGsmGps::getGpsFromGsm(), MyGsmGps::handleClient(), MyMqtt::handleClient(), MyDeepSleep::haveToSleep(), myDebugInfo(), secondsElapsed(), secondsElapsedAndUpdate(), and MyDeepSleep::sleep().
void SetupOTA | ( | ) |
Helper function to start the OTA functionality of the ESP.
Definition at line 264 of file Utils.h.
References MyDbg().
Referenced by MyWebServer::loadUpdate().
String TextToUrl | ( | String | data | ) |
Convert Text to html - URL. Should be decoded with encodeURIComponent() in JavaScript And replace every invalid xml char with '?'.
Definition at line 137 of file Utils.h.
Referenced by MyWebServer::handleLoadConsoleInfo().
String TextToXml | ( | String | data | ) |
Helper HTML text conversation function for special character.
Definition at line 156 of file Utils.h.
Referenced by MyWebServer::AddIntervalInfo(), MyWebServer::AddOption(), and MyWebServer::AddTableTr().
String Trim | ( | const String & | data, |
const String & | chars | ||
) |
Trims the data string on the left and right side every occurrence of a char from chars.
Definition at line 168 of file Utils.h.
Referenced by MyGsmSim808::getSMS(), and scanInterval().
String WifiGetRssiAsQuality | ( | int | rssi | ) |
Conversion of the RSSI value to a quality value.
Definition at line 119 of file Utils.h.
Referenced by MyWebServer::begin(), MyMqtt::handleClient(), MyWebServer::handleLoadInfoInfo(), and MyWebServer::handleLoadMainInfo().