the extensions are also using the update protocol now
This commit is contained in:
parent
79b3c346fa
commit
8f295735da
3 changed files with 19 additions and 2 deletions
|
@ -110,6 +110,8 @@ public slots:
|
|||
|
||||
Q_INVOKABLE bool refreshConnections();
|
||||
|
||||
void setConnections(QVariantList connections);
|
||||
|
||||
// functions for the qml adapter
|
||||
QString getIP() const;
|
||||
void setIP(const QString &ipAdress);
|
||||
|
|
|
@ -50,13 +50,15 @@ bool BaseConn::init() {
|
|||
this->setState("connected");
|
||||
|
||||
// init remote session
|
||||
QJsonArray updateSubs = {"onRaceStateChanged", "onTimersChanged"};
|
||||
QJsonArray updateSubs = {"onRaceStateChanged", "onTimersChanged", "onExtensionConnectionsChanged"};
|
||||
QJsonObject sessionParams = {{"updateSubs", updateSubs}};
|
||||
|
||||
if(this->sendCommand(1, sessionParams)["status"] != 200) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this->refreshConnections();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -385,3 +387,10 @@ QVariant BaseConn::getConnections() {
|
|||
//QVariantList conns = {conn, conn1};
|
||||
//return conns;
|
||||
}
|
||||
|
||||
void BaseConn::setConnections(QVariantList connections) {
|
||||
if(this->connections != connections){
|
||||
this->connections = connections;
|
||||
emit this->connectionsChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent)
|
|||
this->baseStationSyncTimer->setInterval(1000);
|
||||
this->baseStationSyncTimer->setSingleShot(true);
|
||||
this->baseStationSyncTimer->connect(this->baseStationSyncTimer, &QTimer::timeout, this, &ClimbingRace::syncWithBaseStation);
|
||||
this->baseStationSyncTimer->start();
|
||||
//this->baseStationSyncTimer->start();
|
||||
|
||||
this->timerTextRefreshTimer = new QTimer(this);
|
||||
this->timerTextRefreshTimer->setInterval(1);
|
||||
|
@ -284,6 +284,12 @@ void ClimbingRace::handleBaseStationUpdate(QVariant data) {
|
|||
this->refreshRemoteTimers(data.toMap()["data"].toList());
|
||||
break;
|
||||
}
|
||||
case 9002:
|
||||
{
|
||||
// the extension connections have changed
|
||||
this->baseConn->setConnections(data.toMap()["data"].toList());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue