Thermostat pour piloter jusqu'à 4 radiateurs avec fil pilote
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.

75 lines
1.1 KiB

  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. /*
  3. * Qt mutizone MQTT thermostat
  4. *
  5. * Copyright (C) 2019 Richard Genoud
  6. *
  7. */
  8. #ifndef SETTINGS_H
  9. #define SETTINGS_H
  10. #include <QSettings>
  11. #include <QVector>
  12. #include <QTime>
  13. #define MAX_NB_ZONES 4
  14. #define FORCE_OFF (-256)
  15. #define FORCE_ON (99)
  16. enum power_states {
  17. OFF,
  18. ON,
  19. AUTO,
  20. MAX_POWER_STATES
  21. };
  22. struct Heater {
  23. QString ctrl_topic;
  24. };
  25. struct Program {
  26. double temperature;
  27. uint8_t DoW;
  28. QTime start_time;
  29. QTime end_time;
  30. };
  31. struct Room {
  32. QString name;
  33. QString sensor_topic;
  34. QString availability_topic;
  35. double default_temperature;
  36. QVector<struct Heater> heaters;
  37. QVector<struct Program> progs;
  38. };
  39. struct Brocker {
  40. QString address;
  41. int port;
  42. };
  43. class Settings : public QSettings
  44. {
  45. Q_OBJECT
  46. public:
  47. static Settings *getInstance(void);
  48. int nbZones(void);
  49. QVector<struct Room> m_rooms;
  50. struct Brocker m_broker;
  51. enum power_states m_state;
  52. private:
  53. explicit Settings(QObject *parent = Q_NULLPTR);
  54. ~Settings(void);
  55. static Settings *_singleton;
  56. void set_rooms_default_config(void);
  57. int read_config(void);
  58. };
  59. #endif // SETTINGS_H
  60. /* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */