Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dorian Zedler 2020-09-22 15:54:20 +02:00
commit 4efecdc242
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
2 changed files with 11 additions and 9 deletions

View file

@ -51,7 +51,7 @@ class ScStwClient : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(State state READ getState NOTIFY stateChanged) Q_PROPERTY(State state READ getState NOTIFY stateChanged)
Q_PROPERTY(QVariantList extensions READ getExtensions NOTIFY extensionsChanged) Q_PROPERTY(QVariantMap extensions READ getExtensions NOTIFY extensionsChanged)
Q_PROPERTY(QString ipAddress READ getIP WRITE setIP) Q_PROPERTY(QString ipAddress READ getIP WRITE setIP)
public: public:
@ -77,7 +77,7 @@ private:
int errors; int errors;
const static int ERRORS_UNTIL_DISCONNECT = 4; const static int ERRORS_UNTIL_DISCONNECT = 4;
QVariantList extensions; QVariantMap extensions;
QList<ScStw::SignalKey> signalSubscriptions; QList<ScStw::SignalKey> signalSubscriptions;
@ -173,7 +173,7 @@ public slots:
* \brief Function to get the extensions and their state from the base station * \brief Function to get the extensions and their state from the base station
* \return a list with all configured extensions and their state * \return a list with all configured extensions and their state
*/ */
QVariantList getExtensions(); QVariantMap getExtensions();
/*! /*!
* \brief Function to get the time offset of the base station relative to the clients time * \brief Function to get the time offset of the base station relative to the clients time
@ -287,7 +287,7 @@ private slots:
* \see gotSignal() * \see gotSignal()
* \param connections the list to set the chache to * \param connections the list to set the chache to
*/ */
void setExtensions(QVariantList extensions); void setExtensions(QVariantMap extensions);
/*! /*!
* \brief Function to set the local state. * \brief Function to set the local state.

View file

@ -24,7 +24,7 @@ ScStwClient::ScStwClient(QObject * parent, QList<ScStw::SignalKey> signalSubscri
{ {
this->state = DISCONNECTED; this->state = DISCONNECTED;
this->nextConnectionId = 1; this->nextConnectionId = 1;
this->extensions = QVariantList({}); this->extensions = QVariantMap({});
this->signalSubscriptions = signalSubscriptions; this->signalSubscriptions = signalSubscriptions;
this->socket = new QTcpSocket(this); this->socket = new QTcpSocket(this);
@ -121,7 +121,7 @@ void ScStwClient::deInit() {
if(this->state == DISCONNECTED) if(this->state == DISCONNECTED)
return; return;
this->setExtensions(QVariantList({})); this->setExtensions(QVariantMap({}));
this->setState(DISCONNECTED); this->setState(DISCONNECTED);
} }
@ -380,7 +380,7 @@ void ScStwClient::handleSignal(QVariantMap data) {
{ {
// the extension connections have changed // the extension connections have changed
// -> handle locally // -> handle locally
this->setExtensions(data["data"].toList()); this->setExtensions(data["data"].toMap());
return; return;
break; break;
} }
@ -434,7 +434,7 @@ void ScStwClient::setState(ScStwClient::State newState){
} }
} }
QVariantList ScStwClient::getExtensions() { QVariantMap ScStwClient::getExtensions() {
return this->extensions; return this->extensions;
} }
@ -450,7 +450,9 @@ QString ScStwClient::getApiVersion() {
return this->apiVersion; return this->apiVersion;
} }
void ScStwClient::setExtensions(QVariantList extensions) { void ScStwClient::setExtensions(QVariantMap extensions) {
qDebug() << "[CLIENT][DEBUG] Extensions changed: " << extensions;
if(this->extensions != extensions){ if(this->extensions != extensions){
this->extensions = extensions; this->extensions = extensions;
emit this->gotSignal(ScStw::ExtensionsChanged, this->getExtensions()); emit this->gotSignal(ScStw::ExtensionsChanged, this->getExtensions());