From 2893d341c2542ffae2c88cb976763fa599ff6622 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 10 May 2020 18:39:58 +0200 Subject: [PATCH] fixed error in firmware and api comparison --- ScStwLibraries/sources/ScStw.cpp | 4 ++-- ScStwLibraries/sources/scstwclient.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ScStwLibraries/sources/ScStw.cpp b/ScStwLibraries/sources/ScStw.cpp index ded9515..2855eb7 100644 --- a/ScStwLibraries/sources/ScStw.cpp +++ b/ScStwLibraries/sources/ScStw.cpp @@ -85,13 +85,13 @@ int ScStw::firmwareCompare(QString a, QString b) { * 3: major of b is lower than a */ - if(a.count(".") != 3 || a.length() != 5) + if(a.count(".") != 2 || a.length() != 5) return -4; int aMajor = a.split(".")[0].toInt(); int aMinor = a.split(".")[1].toInt(); int aPatch = a.split(".")[2].toInt(); - if(b.count(".") != 3 || a.length() != 5) + if(b.count(".") != 2 || a.length() != 5) return 4; int bMajor = b.split(".")[0].toInt(); int bMinor = b.split(".")[1].toInt(); diff --git a/ScStwLibraries/sources/scstwclient.cpp b/ScStwLibraries/sources/scstwclient.cpp index 8cd17e2..8197ee5 100644 --- a/ScStwLibraries/sources/scstwclient.cpp +++ b/ScStwLibraries/sources/scstwclient.cpp @@ -66,7 +66,9 @@ bool ScStwClient::init() { } this->apiVersion = initResponse["data"].toMap()["apiVersion"].toString(); - int compareResult = ScStw::firmwareCompare(this->apiVersion, this->API_VERSION); + qDebug() << "[INFO][CLIENT] base station api version is: " << this->apiVersion; + int compareResult = ScStw::firmwareCompare(this->API_VERSION, this->apiVersion); + qDebug() << "compare result is: " << compareResult; if( compareResult == -3 ){ // the client version is out of date!! this->closeConnection();