LightHub  v4.0.0
Smarthome controller firmware
utils.h File Reference
#include <Arduino.h>
#include <IPAddress.h>
#include "aJSON.h"
#include "options.h"
#include "item.h"
#include "Streaming.h"

Go to the source code of this file.

Macros

#define Q(x)   #x
 
#define QUOTE(x)   Q(x)
 
#define VALUE_TO_STRING(x)   #x
 
#define VALUE(x)   VALUE_TO_STRING(x)
 
#define VAR_NAME_VALUE(var)   #var "=" VALUE(var)
 
#define serialParamType   uint16_t
 

Enumerations

enum  topicType { T_DEV = 1, T_BCST = 2, T_OUT = 3 }
 

Functions

void PrintBytes (uint8_t *addr, uint8_t count, bool newline)
 
void SetBytes (uint8_t *addr, uint8_t count, char *out)
 
void SetAddr (char *out, uint8_t *addr)
 
uint8_t HEX2DEC (char i)
 
int getInt (char **chan)
 
itemCmd getNumber (char **chan)
 
unsigned long freeRam ()
 
void parseBytes (const char *str, char separator, byte *bytes, int maxBytes, int base)
 
int log (const char *str,...)
 
void printFloatValueToStr (float value, char *valstr)
 
void ReadUniqueID (uint32_t *pdwUniqueID)
 
int _inet_aton (const char *aIPAddrString, IPAddress &aResult)
 
char * _inet_ntoa_r (IPAddress addr, char *buf, int buflen)
 
void printIPAddress (IPAddress ipAddress)
 
char * setTopic (char *buf, int8_t buflen, topicType tt, const char *suffix=NULL)
 
void printUlongValueToStr (char *valstr, unsigned long value)
 
void scan_i2c_bus ()
 
void softRebootFunc ()
 
bool isTimeOver (uint32_t timestamp, uint32_t currTime, uint32_t time, uint32_t modulo=0)
 
bool executeCommand (aJsonObject *cmd, int8_t toggle=-1)
 
bool executeCommand (aJsonObject *cmd, int8_t toggle, itemCmd _itemCmd, aJsonObject *defaultItem=NULL, aJsonObject *defaultEmit=NULL)
 
itemCmd mapInt (int32_t arg, aJsonObject *map)
 
unsigned long millisNZ (uint8_t shift=0)
 
serialParamType str2SerialParam (char *str)
 
String toString (const IPAddress &address)
 

Macro Definition Documentation

◆ Q

#define Q (   x)    #x

◆ QUOTE

#define QUOTE (   x)    Q(x)

◆ serialParamType

#define serialParamType   uint16_t

◆ VALUE

#define VALUE (   x)    VALUE_TO_STRING(x)

◆ VALUE_TO_STRING

#define VALUE_TO_STRING (   x)    #x

◆ VAR_NAME_VALUE

#define VAR_NAME_VALUE (   var)    #var "=" VALUE(var)

Enumeration Type Documentation

◆ topicType

enum topicType
Enumerator
T_DEV 
T_BCST 
T_OUT 

Function Documentation

◆ _inet_aton()

int _inet_aton ( const char *  aIPAddrString,
IPAddress &  aResult 
)

◆ _inet_ntoa_r()

char* _inet_ntoa_r ( IPAddress  addr,
char *  buf,
int  buflen 
)

Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.

Parameters
addrip address in network order to convert
buftarget buffer where the string is stored
buflenlength of buf
Returns
either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small

◆ executeCommand() [1/2]

bool executeCommand ( aJsonObject *  cmd,
int8_t  toggle,
itemCmd  _itemCmd,
aJsonObject *  defaultItem = NULL,
aJsonObject *  defaultEmit = NULL 
)

◆ executeCommand() [2/2]

bool executeCommand ( aJsonObject *  cmd,
int8_t  toggle = -1 
)

◆ freeRam()

unsigned long freeRam ( )

◆ getInt()

int getInt ( char **  chan)

◆ getNumber()

itemCmd getNumber ( char **  chan)

◆ HEX2DEC()

uint8_t HEX2DEC ( char  i)

◆ isTimeOver()

bool isTimeOver ( uint32_t  timestamp,
uint32_t  currTime,
uint32_t  time,
uint32_t  modulo = 0 
)

◆ log()

int log ( const char *  str,
  ... 
)

◆ mapInt()

itemCmd mapInt ( int32_t  arg,
aJsonObject *  map 
)

◆ millisNZ()

unsigned long millisNZ ( uint8_t  shift = 0)

◆ parseBytes()

void parseBytes ( const char *  str,
char  separator,
byte *  bytes,
int  maxBytes,
int  base 
)

◆ PrintBytes()

void PrintBytes ( uint8_t *  addr,
uint8_t  count,
bool  newline 
)

◆ printFloatValueToStr()

void printFloatValueToStr ( float  value,
char *  valstr 
)

◆ printIPAddress()

void printIPAddress ( IPAddress  ipAddress)

◆ printUlongValueToStr()

void printUlongValueToStr ( char *  valstr,
unsigned long  value 
)

◆ ReadUniqueID()

void ReadUniqueID ( uint32_t *  pdwUniqueID)

◆ scan_i2c_bus()

void scan_i2c_bus ( )

◆ SetAddr()

void SetAddr ( char *  out,
uint8_t *  addr 
)

◆ SetBytes()

void SetBytes ( uint8_t *  addr,
uint8_t  count,
char *  out 
)

◆ setTopic()

char* setTopic ( char *  buf,
int8_t  buflen,
topicType  tt,
const char *  suffix = NULL 
)

◆ softRebootFunc()

void softRebootFunc ( )

◆ str2SerialParam()

serialParamType str2SerialParam ( char *  str)

◆ toString()

String toString ( const IPAddress &  address)