Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

  1. /*
  2. UTILS MODULE
  3. Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. #pragma once
  6. #include <Arduino.h>
  7. #include "system.h"
  8. #define INLINE inline __attribute__((always_inline))
  9. extern "C" uint32_t _SPIFFS_start;
  10. extern "C" uint32_t _SPIFFS_end;
  11. void setDefaultHostname();
  12. void setBoardName();
  13. const String& getDevice();
  14. const String& getManufacturer();
  15. const String& getCoreVersion();
  16. const String& getCoreRevision();
  17. const String& getVersion();
  18. String getAdminPass();
  19. String getBoardName();
  20. String buildTime();
  21. bool haveRelaysOrSensors();
  22. String getUptime();
  23. void infoHeapStats(const char* name, const HeapStats& stats);
  24. void infoHeapStats(bool show_frag_stats = false);
  25. void infoMemory(const char* name, unsigned int total_memory, unsigned int free_memory);
  26. void info(bool first = false);
  27. bool sslCheckFingerPrint(const char * fingerprint);
  28. bool sslFingerPrintArray(const char * fingerprint, unsigned char * bytearray);
  29. bool sslFingerPrintChar(const char * fingerprint, char * destination);
  30. char* ltrim(char* s);
  31. char* strnstr(const char* buffer, const char* token, size_t n);
  32. bool isNumber(const String&);
  33. void nice_delay(unsigned long ms);
  34. double roundTo(double num, unsigned char positions);
  35. size_t hexEncode(const uint8_t* in, size_t in_size, char* out, size_t out_size);
  36. size_t hexDecode(const char* in, size_t in_size, uint8_t* out, size_t out_size);