utils.cpp File Reference
`#include "utils.h"`
`#include "options.h"`
`#include "stdarg.h"`
`#include <Wire.h>`
`#include "main.h"`
`#include "item.h"`
`#include <PubSubClient.h>`
`#include <HardwareSerial.h>`

## Classes

struct | serial_st

## Macros

#define | ARDBUFFER 16
#define | serialModesNum sizeof(serialModes_P)/sizeof(serial_st)

## Functions

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

## Variables

int8_t | configLocked
int8_t | ethernetIdleCount
PubSubClient | mqttClient
const char outTopic[] | PROGMEM = OUTTOPIC
char * | deviceName
aJsonObject * | topics
const char | HEXSTR [] = "0123456789ABCDEF"

## Macro Definition Documentation

## ARDBUFFER

#define ARDBUFFER 16

## serialModesNum

#define serialModesNum sizeof(serialModes_P)/sizeof(serial_st)

## Function Documentation

## __attribute__()

__attribute__ | ( | (section(".ramfunc")) |  | ) |

## _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

  addr | ip address in network order to convert
  buf | target buffer where the string is stored
  buflen | length 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
| ) |  |

## executeCommand() [2/2]

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

## getInt()

int getInt | ( | char ** | chan | ) |

## getNumber()

itemCmd getNumber | ( | char ** | chan | ) |

## HEX2DEC()

byte HEX2DEC | ( | char | i | ) |

## isTimeOver()

bool isTimeOver | ( | uint32_t | timestamp,
|  | uint32_t | currTime,
|  | uint32_t | time,
|  | uint32_t | modulo
| ) |  |

## log()

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

## mapInt()

itemCmd mapInt | ( | int32_t | arg,
|  | aJsonObject * | map
| ) |  |

## millisNZ()

unsigned long millisNZ | ( | uint8_t | shift | ) |

## 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
| ) |  |

## 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
| ) |  |

## str2SerialParam()

serialParamType str2SerialParam | ( | char * | str | ) |

## toString()

String toString | ( | const IPAddress & | address | ) |

## Variable Documentation

## configLocked

int8_t configLocked

extern

## deviceName

char* deviceName

extern

## ethernetIdleCount

int8_t ethernetIdleCount

extern

## HEXSTR

const char HEXSTR[] = "0123456789ABCDEF"

## mqttClient

PubSubClient mqttClient

extern

## PROGMEM

const serial_st serialModes_P [] PROGMEM = OUTTOPIC

## topics

aJsonObject* topics

extern