|
|
@ -117,6 +117,44 @@ Settings::Settings(QObject *parent) : QSettings(parent) |
|
|
|
m_broker.port = this->value("broker/port", 1883).toInt(); |
|
|
|
} |
|
|
|
|
|
|
|
void Settings::setRoomDefaultTemperature(int idx, double temperature) |
|
|
|
{ |
|
|
|
if ((idx < 0) || (idx >= MAX_NB_ZONES)) { |
|
|
|
// ERROR
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this->beginWriteArray("rooms"); |
|
|
|
this->setArrayIndex(idx); |
|
|
|
this->setValue("default_temperature", temperature); |
|
|
|
this->endArray(); |
|
|
|
this->sync(); |
|
|
|
} |
|
|
|
|
|
|
|
void Settings::setRoomPrograms(int idx, QVector<struct Program> &progs) |
|
|
|
{ |
|
|
|
if ((idx < 0) || (idx >= MAX_NB_ZONES)) { |
|
|
|
// ERROR
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this->beginWriteArray("rooms"); |
|
|
|
|
|
|
|
this->setArrayIndex(idx); |
|
|
|
this->remove("temperature_schedule"); |
|
|
|
this->beginWriteArray("temperature_schedule"); |
|
|
|
for (int i = 0; i < progs.count(); i++) { |
|
|
|
this->setArrayIndex(i); |
|
|
|
this->setValue("temperature", progs.at(i).temperature); |
|
|
|
this->setValue("days_of_week", progs.at(i).DoW); |
|
|
|
this->setValue("start_time", progs.at(i).start_time.toString("H:m")); |
|
|
|
this->setValue("end_time", progs.at(i).end_time.toString("H:m")); |
|
|
|
} |
|
|
|
this->endArray(); |
|
|
|
this->endArray(); |
|
|
|
this->sync(); |
|
|
|
} |
|
|
|
|
|
|
|
void Settings::setPowerState(enum power_states state) |
|
|
|
{ |
|
|
|
switch (state) { |
|
|
|