TxtDataHelpers.h 838 B

1234567891011121314151617181920
  1. #pragma once
  2. #include <stddef.h>
  3. #include <stdint.h>
  4. #define TXT_TYPE_PLAIN 0 // a plain text message
  5. #define TXT_TYPE_CLI_DATA 1 // a CLI command
  6. #define TXT_TYPE_SIGNED_PLAIN 2 // plain text, signed by sender
  7. #define DATA_TYPE_RESERVED 0x0000 // reserved for future use
  8. #define DATA_TYPE_DEV 0xFFFF // developer namespace for experimenting with group/channel datagrams and building apps
  9. class StrHelper {
  10. public:
  11. static void strncpy(char* dest, const char* src, size_t buf_sz);
  12. static void strzcpy(char* dest, const char* src, size_t buf_sz); // pads with trailing nulls
  13. static const char* ftoa(float f);
  14. static const char* ftoa3(float f); //Converts float to string with 3 decimal places
  15. static bool isBlank(const char* str);
  16. static uint32_t fromHex(const char* src);
  17. };