My Project
 All Classes Functions Variables Pages
Static Public Member Functions | List of all members
GeneralUtils Class Reference

General utilities. More...

#include <GeneralUtils.h>

Static Public Member Functions

static bool base64Decode (const std::string &in, std::string *out)
 Decode a chunk of data that is base64 encoded. More...
 
static bool base64Encode (const std::string &in, std::string *out)
 Encode a string into base 64. More...
 
static void dumpInfo ()
 Dump general info to the log. Data includes: More...
 
static bool endsWith (std::string str, char c)
 Does the string end with a specific character? More...
 
static const char * errorToString (esp_err_t errCode)
 Convert an ESP error code to a string. More...
 
static const char * wifiErrorToString (uint8_t value)
 Convert a wifi_err_reason_t code to a string. More...
 
static void hexDump (const uint8_t *pData, uint32_t length)
 Dump a representation of binary data to the console. More...
 
static std::string ipToString (uint8_t *ip)
 Convert an IP address to string. More...
 
static std::vector< std::string > split (std::string source, char delimiter)
 Split a string into parts based on a delimiter. More...
 
static std::string toLower (std::string &value)
 Convert a string to lower case. More...
 
static std::string trim (const std::string &str)
 Remove white space from a string.
 

Detailed Description

General utilities.

Member Function Documentation

bool GeneralUtils::base64Decode ( const std::string &  in,
std::string *  out 
)
static

Decode a chunk of data that is base64 encoded.

Parameters
[in]inThe string to be decoded.
[out]outThe resulting data.
bool GeneralUtils::base64Encode ( const std::string &  in,
std::string *  out 
)
static

Encode a string into base 64.

Parameters
[in]in
[out]out
void GeneralUtils::dumpInfo ( )
static

Dump general info to the log. Data includes:

  • Amount of free RAM
bool GeneralUtils::endsWith ( std::string  str,
char  c 
)
static

Does the string end with a specific character?

Parameters
[in]strThe string to examine.
[in]cThe character to look form.
Returns
True if the string ends with the given character.
const char * GeneralUtils::errorToString ( esp_err_t  errCode)
static

Convert an ESP error code to a string.

Parameters
[in]errCodeThe errCode to be converted.
Returns
A string representation of the error code.
void GeneralUtils::hexDump ( const uint8_t *  pData,
uint32_t  length 
)
static

Dump a representation of binary data to the console.

Parameters
[in]pDataPointer to the start of data to be logged.
[in]lengthLength of the data (in bytes) to be logged.
Returns
N/A.
std::string GeneralUtils::ipToString ( uint8_t *  ip)
static

Convert an IP address to string.

Parameters
ipThe 4 byte IP address.
Returns
A string representation of the IP address.
std::vector< std::string > GeneralUtils::split ( std::string  source,
char  delimiter 
)
static

Split a string into parts based on a delimiter.

Parameters
[in]sourceThe source string to split.
[in]delimiterThe delimiter characters.
Returns
A vector of strings that are the split of the input.
std::string GeneralUtils::toLower ( std::string &  value)
static

Convert a string to lower case.

Parameters
[in]valueThe string to convert to lower case.
Returns
A lower case representation of the string.
const char * GeneralUtils::wifiErrorToString ( uint8_t  errCode)
static

Convert a wifi_err_reason_t code to a string.

Parameters
[in]errCodeThe errCode to be converted.
Returns
A string representation of the error code.
Note
: wifi_err_reason_t values as of April 2018 are: (1-24, 200-204) and are defined in ~/esp-idf/components/esp32/include/esp_wifi_types.h.

The documentation for this class was generated from the following files: