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.

77 lines
1.2 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 <QDateTime>
  12. #include <QVector>
  13. #include <QTime>
  14. #define MAX_NB_ZONES 4
  15. #define FORCE_OFF (-256)
  16. #define FORCE_ON (99)
  17. enum power_states {
  18. OFF,
  19. ON,
  20. AUTO,
  21. MAX_POWER_STATES
  22. };
  23. struct Heater {
  24. QString ctrl_topic;
  25. };
  26. struct Program {
  27. double temperature;
  28. uint8_t DoW;
  29. QTime start_time;
  30. QTime end_time;
  31. };
  32. struct Room {
  33. QString name;
  34. QString sensor_topic;
  35. QString availability_topic;
  36. double default_temperature;
  37. QVector<struct Heater> heaters;
  38. QVector<struct Program> progs;
  39. };
  40. struct Brocker {
  41. QString address;
  42. int port;
  43. };
  44. class Settings : public QSettings
  45. {
  46. Q_OBJECT
  47. public:
  48. static Settings *getInstance(void);
  49. int nbZones(void);
  50. QVector<struct Room> m_rooms;
  51. struct Brocker m_broker;
  52. enum power_states m_state;
  53. QDateTime m_end_holiday;
  54. private:
  55. explicit Settings(QObject *parent = Q_NULLPTR);
  56. ~Settings(void);
  57. static Settings *_singleton;
  58. void set_rooms_default_config(void);
  59. int read_config(void);
  60. };
  61. #endif // SETTINGS_H
  62. /* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */