My Project
 All Classes Functions Variables Pages
GeneralUtils.h
1 /*
2  * GeneralUtils.h
3  *
4  * Created on: May 20, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_CPP_UTILS_GENERALUTILS_H_
9 #define COMPONENTS_CPP_UTILS_GENERALUTILS_H_
10 #include <stdint.h>
11 #include <string>
12 #include <esp_err.h>
13 #include <algorithm>
14 #include <vector>
15 
19 class GeneralUtils {
20 public:
21  static bool base64Decode(const std::string& in, std::string* out);
22  static bool base64Encode(const std::string& in, std::string* out);
23  static void dumpInfo();
24  static bool endsWith(std::string str, char c);
25  static const char* errorToString(esp_err_t errCode);
26  static const char* wifiErrorToString(uint8_t value);
27  static void hexDump(const uint8_t* pData, uint32_t length);
28  static std::string ipToString(uint8_t* ip);
29  static std::vector<std::string> split(std::string source, char delimiter);
30  static std::string toLower(std::string& value);
31  static std::string trim(const std::string& str);
32 
33 };
34 
35 #endif /* COMPONENTS_CPP_UTILS_GENERALUTILS_H_ */
General utilities.
Definition: GeneralUtils.h:19
static void dumpInfo()
Dump general info to the log. Data includes:
Definition: GeneralUtils.cpp:108
static bool endsWith(std::string str, char c)
Does the string end with a specific character?
Definition: GeneralUtils.cpp:126
static std::vector< std::string > split(std::string source, char delimiter)
Split a string into parts based on a delimiter.
Definition: GeneralUtils.cpp:349
static const char * errorToString(esp_err_t errCode)
Convert an ESP error code to a string.
Definition: GeneralUtils.cpp:366
static bool base64Encode(const std::string &in, std::string *out)
Encode a string into base 64.
Definition: GeneralUtils.cpp:59
static std::string toLower(std::string &value)
Convert a string to lower case.
Definition: GeneralUtils.cpp:522
static bool base64Decode(const std::string &in, std::string *out)
Decode a chunk of data that is base64 encoded.
Definition: GeneralUtils.cpp:163
static std::string trim(const std::string &str)
Remove white space from a string.
Definition: GeneralUtils.cpp:533
static const char * wifiErrorToString(uint8_t value)
Convert a wifi_err_reason_t code to a string.
Definition: GeneralUtils.cpp:448
static std::string ipToString(uint8_t *ip)
Convert an IP address to string.
Definition: GeneralUtils.cpp:336
static void hexDump(const uint8_t *pData, uint32_t length)
Dump a representation of binary data to the console.
Definition: GeneralUtils.cpp:293