Settings.h 710 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <Arduino.h>
  2. #include <StringStream.h>
  3. #ifndef _SETTINGS_H_INCLUDED
  4. #define _SETTINGS_H_INCLUDED
  5. #define SETTINGS_FILE "/config.json"
  6. #define SETTINGS_TERMINATOR '\0'
  7. #define WEB_INDEX_FILENAME "/index.html"
  8. class Settings {
  9. public:
  10. Settings() :
  11. adminUsername(""),
  12. adminPassword(""),
  13. // CE and CSN pins from nrf24l01
  14. cePin(D0),
  15. csnPin(D8)
  16. { }
  17. static void deserialize(Settings& settings, String json);
  18. static void load(Settings& settings);
  19. void save();
  20. String toJson(const bool prettyPrint = true);
  21. void serialize(Stream& stream, const bool prettyPrint = false);
  22. String adminUsername;
  23. String adminPassword;
  24. uint8_t cePin;
  25. uint8_t csnPin;
  26. };
  27. #endif