- added list with settings that can be managed remotely

This commit is contained in:
Dorian Zedler 2019-03-27 22:23:12 +01:00
parent 80e4fcfafc
commit dadebe0d65
2 changed files with 13 additions and 14 deletions

View file

@ -52,6 +52,7 @@ private:
// helper vars
QVariantList qmlTimers;
const QStringList remoteSettings = {"ready_en", "ready_delay", "at_marks_en", "at_marks_delay"};
private slots:
// helper functions

View file

@ -7,7 +7,7 @@
* - sounds
* - next start action
* - next start action delay progress
*
* - settings (remote and local)
*/
ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent)
@ -18,7 +18,7 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent)
this->appSettings = new AppSettings;
this->baseConn = new BaseConn;
this->baseConn->setIP("ScStw");
this->baseConn->setIP("192.168.4.1");
connect(this->baseConn, &BaseConn::stateChanged, this, &ClimbingRace::baseStationStateChanged);
this->speedTimers.append( new SpeedTimer );
@ -483,31 +483,29 @@ double ClimbingRace::getNextStartActionDelayProgress() {
void ClimbingRace::writeSetting(QString key, QVariant value) {
this->refreshMode();
switch (this->mode) {
case LOCAL:
this->appSettings->writeSetting(key, value);
break;
case REMOTE:
if(this->mode == REMOTE && this->remoteSettings.contains(key)){
this->baseConn->writeRemoteSetting(key, value.toString());
break;
}
else {
this->appSettings->writeSetting(key, value);
}
}
QString ClimbingRace::readSetting(QString key) {
this->refreshMode();
switch (this->mode) {
case LOCAL:
return this->appSettings->loadSetting(key);
case REMOTE:
if(this->mode == REMOTE && this->remoteSettings.contains(key)){
QVariantMap reply = this->baseConn->sendCommand(3001, key);
if(reply["status"] != 200){
return "false";
}
return reply["data"].toString();
}
else {
return this->appSettings->loadSetting(key);
}
}
bool ClimbingRace::connectBaseStation() {