fixed error in firmware and api comparison

This commit is contained in:
Dorian Zedler 2020-05-10 18:39:58 +02:00
parent 7a960fbcfa
commit 2893d341c2
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 5 additions and 3 deletions

View file

@ -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();

View file

@ -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();