fixed error in firmware and api comparison
This commit is contained in:
parent
7a960fbcfa
commit
2893d341c2
2 changed files with 5 additions and 3 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Reference in a new issue