HAUtils class

class HAUtils

This class provides some useful methods to make life easier.

Public Static Functions

static bool endsWith(const char *str, const char *suffix)

Checks whether the given str ends with the given suffix.

Parameters
  • str – Input string to check.

  • suffix – Suffix to find

Returns

True if the given suffix is present at the end of the given string.

static void byteArrayToStr(char *dst, const byte *src, const uint16_t length)

Converts the given byte array into hex string. Each byte will be represented by two bytes, so the output size will be length * 2

Parameters
  • dst – Destination where the string will be saved.

  • src – Bytes array to convert.

  • length – Length of the bytes array.

static char *byteArrayToStr(const byte *src, const uint16_t length)

Converts the given byte array into hex string. This method allocates a new memory.

Parameters
  • src – Bytes array to convert.

  • length – Length of the bytes array.

Returns

Newly allocated string containing the hex representation.