EnigmaIOT
0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Auxiliary function definition. More...
#include "helperFunctions.h"
Go to the source code of this file.
Macros | |
#define | MAX_STR_LEN 1000 |
Key length used by selected crypto algorythm. More... | |
#define | MACSTR "%02X:%02X:%02X:%02X:%02X:%02X" |
Functions | |
char * | printHexBuffer (const uint8_t *buffer, uint16_t len) |
Debug helper function that generates a string that represent a buffer hexadecimal values. More... | |
void | initWiFi (uint8_t channel, const char *networkName, const char *networkKey, uint8_t role) |
Initalizes WiFi interfaces on ESP8266 or ESP32. More... | |
uint32_t | calculateCRC32 (const uint8_t *data, size_t length) |
Calculates CRC32 of a buffer. More... | |
char * | mac2str (const uint8_t *mac, char *extBuffer) |
Debug helper function that generates a string that represent a MAC address. More... | |
uint8_t * | str2mac (const char *macAddrString, uint8_t *macBytes) |
Debug helper function that creates MAC address byte array from text representation. More... | |
bool | isNumber (const char *input) |
Checks if input string is numeric. More... | |
bool | isNumber (const char *input, size_t len) |
Checks if input string is numeric. More... | |
bool | isNumber (String input) |
Checks if input string is numeric. More... | |
#define MACSTR "%02X:%02X:%02X:%02X:%02X:%02X" |
Definition at line 83 of file helperFunctions.cpp.
#define MAX_STR_LEN 1000 |
Key length used by selected crypto algorythm.
Definition at line 14 of file helperFunctions.cpp.
uint32_t calculateCRC32 | ( | const uint8_t * | data, |
size_t | length | ||
) |
Calculates CRC32 of a buffer.
data | Input buffer |
length | Input length |
Definition at line 64 of file helperFunctions.cpp.
void initWiFi | ( | uint8_t | channel, |
const char * | networkName, | ||
const char * | networkKey = NULL , |
||
uint8_t | role = 0 |
||
) |
Initalizes WiFi interfaces on ESP8266 or ESP32.
channel | WiFi channel for interface initialization |
role | 0 for node, 1 for gateway |
networkName | Name that gateway AP will take |
networkKey | Network key. This is not required normally as this is provided using configuration web portal |
Definition at line 32 of file helperFunctions.cpp.
bool isNumber | ( | const char * | input | ) |
Checks if input string is numeric.
input | String to check |
true
if string is a number Definition at line 169 of file helperFunctions.cpp.
bool isNumber | ( | const char * | input, |
size_t | len | ||
) |
Checks if input string is numeric.
input | String to check |
len | String length |
true
if string is a number Definition at line 186 of file helperFunctions.cpp.
bool isNumber | ( | String | input | ) |
Checks if input string is numeric.
input | String to check |
true
if string is a number Definition at line 202 of file helperFunctions.cpp.
char* mac2str | ( | const uint8_t * | mac, |
char * | extBuffer = NULL |
||
) |
Debug helper function that generates a string that represent a MAC address.
mac | Pointer to the MAC address |
extBuffer | Buffer that will store resulting address. It must be 18 bytes long at least. If it is NULL a static buffer will be used |
Definition at line 85 of file helperFunctions.cpp.
char* printHexBuffer | ( | const uint8_t * | buffer, |
uint16_t | len | ||
) |
Debug helper function that generates a string that represent a buffer hexadecimal values.
buffer | Pointer to the buffer |
len | Buffer length in number of bytes |
String has to be used inmediatelly. At least before calling printHexBuffer()
again as it uses a static buffer to hold string. It will be overwritten on next call.
Definition at line 16 of file helperFunctions.cpp.
uint8_t* str2mac | ( | const char * | mac, |
uint8_t * | values | ||
) |
Debug helper function that creates MAC address byte array from text representation.
mac | Pointer to the MAC address string |
values | Buffer that will store byte array. It must be 6 bytes long at least |
values
input buffer after writting MAC address Definition at line 104 of file helperFunctions.cpp.