// SPDX-License-Identifier: GPL-3.0-or-later
|
|
/*
|
|
* Qt mutizone MQTT thermostat
|
|
*
|
|
* Copyright (C) 2019 Richard Genoud
|
|
*
|
|
*/
|
|
|
|
#ifndef SETTINGS_H
|
|
#define SETTINGS_H
|
|
|
|
#include <QSettings>
|
|
#include <QVector>
|
|
#include <QTime>
|
|
|
|
#define MAX_NB_ZONES 4
|
|
#define FORCE_OFF (-256)
|
|
#define FORCE_ON (99)
|
|
|
|
enum power_states {
|
|
OFF,
|
|
ON,
|
|
AUTO,
|
|
MAX_POWER_STATES
|
|
};
|
|
|
|
struct Heater {
|
|
QString ctrl_topic;
|
|
};
|
|
|
|
struct Program {
|
|
double temperature;
|
|
uint8_t DoW;
|
|
QTime start_time;
|
|
QTime end_time;
|
|
};
|
|
|
|
struct Room {
|
|
QString name;
|
|
QString sensor_topic;
|
|
QString availability_topic;
|
|
double default_temperature;
|
|
QVector<struct Heater> heaters;
|
|
QVector<struct Program> progs;
|
|
};
|
|
|
|
struct Brocker {
|
|
QString address;
|
|
int port;
|
|
};
|
|
|
|
class Settings : public QSettings
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
static Settings *getInstance(void);
|
|
int nbZones(void);
|
|
|
|
QVector<struct Room> m_rooms;
|
|
struct Brocker m_broker;
|
|
enum power_states m_state;
|
|
|
|
private:
|
|
explicit Settings(QObject *parent = Q_NULLPTR);
|
|
~Settings(void);
|
|
static Settings *_singleton;
|
|
|
|
void set_rooms_default_config(void);
|
|
int read_config(void);
|
|
};
|
|
|
|
#endif // SETTINGS_H
|
|
|
|
/* vim: set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab: */
|
|
|