|
|
|
@ -193,26 +193,26 @@ int ClimbingRace::resetRace() {
|
|
|
|
|
* @param data
|
|
|
|
|
*/
|
|
|
|
|
void ClimbingRace::handleBaseStationSignal(ScStw::SignalKey key, QVariant data) {
|
|
|
|
|
//qDebug() << "got update: " << data;
|
|
|
|
|
qDebug() << "got signal: " << data;
|
|
|
|
|
switch (key) {
|
|
|
|
|
case ScStw::RaceStateChanged:
|
|
|
|
|
{
|
|
|
|
|
// the remote race state has changed
|
|
|
|
|
this->setState( ScStw::RaceState( data.toMap()["data"].toInt() ) );
|
|
|
|
|
this->setState( ScStw::RaceState( data.toInt() ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ScStw::TimersChanged:
|
|
|
|
|
{
|
|
|
|
|
// the remote timers have changed
|
|
|
|
|
this->refreshRemoteTimers(data.toMap()["data"].toList());
|
|
|
|
|
this->refreshRemoteTimers(data.toList());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ScStw::NextStartActionChanged:
|
|
|
|
|
{
|
|
|
|
|
// the next start action has changed
|
|
|
|
|
this->nextStartActionTotalDelay = data.toMap()["data"].toMap()["nextActionDelay"].toDouble();
|
|
|
|
|
this->nextStartActionDelayStartedAt = this->date->currentMSecsSinceEpoch() - (this->nextStartActionTotalDelay * data.toMap()["data"].toMap()["nextActionDelayProg"].toDouble());
|
|
|
|
|
this->nextStartAction = ScStw::NextStartAction( data.toMap()["data"].toMap()["nextAction"].toInt() );
|
|
|
|
|
this->nextStartActionTotalDelay = data.toMap()["nextActionDelay"].toDouble();
|
|
|
|
|
this->nextStartActionDelayStartedAt = this->date->currentMSecsSinceEpoch() - (this->nextStartActionTotalDelay * data.toMap()["nextActionDelayProg"].toDouble());
|
|
|
|
|
this->nextStartAction = ScStw::NextStartAction( data.toMap()["nextAction"].toInt() );
|
|
|
|
|
|
|
|
|
|
emit this->nextStartActionChanged();
|
|
|
|
|
break;
|
|
|
|
@ -222,6 +222,8 @@ void ClimbingRace::handleBaseStationSignal(ScStw::SignalKey key, QVariant data)
|
|
|
|
|
emit this->baseStationConnectionsChanged();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ScStw::InvalidSignal:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -361,7 +363,6 @@ bool ClimbingRace::playSound(QString path) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClimbingRace::setState(ScStw::RaceState newState) {
|
|
|
|
|
|
|
|
|
|
if(newState != this->state) {
|
|
|
|
|
this->state = newState;
|
|
|
|
|
this->stateChanged(newState);
|
|
|
|
@ -576,8 +577,8 @@ int ClimbingRace::getNextStartAction() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClimbingRace::writeSetting(QString key, QVariant value) {
|
|
|
|
|
if(this->mode == REMOTE && this->remoteSettings.contains(key) ){
|
|
|
|
|
this->scStwClient->writeRemoteSetting(remoteSettings[key], value.toString());
|
|
|
|
|
if(this->mode == REMOTE && ScStw::baseStationSettingFromString(key) != ScStw::InvalidSetting ){
|
|
|
|
|
this->scStwClient->writeRemoteSetting(ScStw::baseStationSettingFromString(key), value.toString());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->appSettings->writeSetting(key, value);
|
|
|
|
@ -585,8 +586,8 @@ void ClimbingRace::writeSetting(QString key, QVariant value) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ClimbingRace::readSetting(QString key) {
|
|
|
|
|
if(this->mode == REMOTE && this->remoteSettings.contains(key)){
|
|
|
|
|
return this->scStwClient->readRemoteSetting(this->remoteSettings[key]);
|
|
|
|
|
if(this->mode == REMOTE && ScStw::baseStationSettingFromString(key) != ScStw::InvalidSetting){
|
|
|
|
|
return this->scStwClient->readRemoteSetting(ScStw::baseStationSettingFromString(key));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return this->appSettings->loadSetting(key);
|
|
|
|
|