- moved update binary to libraries
This commit is contained in:
parent
e7ecd6730f
commit
b350f4636a
4 changed files with 20 additions and 5 deletions
1
ScStwLibraries/ScStwBasestation.sb64
Normal file
1
ScStwLibraries/ScStwBasestation.sb64
Normal file
File diff suppressed because one or more lines are too long
|
@ -26,6 +26,11 @@ HEADERS += \
|
||||||
ScStwLibraries_global.h \
|
ScStwLibraries_global.h \
|
||||||
scstwclient.h
|
scstwclient.h
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
ScStwLibrariesShared.qrc
|
||||||
|
|
||||||
|
DISTFILES +=
|
||||||
|
|
||||||
#DEPENDS
|
#DEPENDS
|
||||||
CONFIG(release, debug|release): {
|
CONFIG(release, debug|release): {
|
||||||
DESTDIR="$$PWD/build/release"
|
DESTDIR="$$PWD/build/release"
|
||||||
|
|
5
ScStwLibraries/ScStwLibrariesShared.qrc
Normal file
5
ScStwLibraries/ScStwLibrariesShared.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>ScStwBasestation.sb64</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -368,16 +368,20 @@ bool ScStwClient::updateFirmware() {
|
||||||
if(this->state != CONNECTED)
|
if(this->state != CONNECTED)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if(this->isFirmwareUpToDate())
|
||||||
|
return true;
|
||||||
|
|
||||||
QString file = ":/ScStwBasestation.sb64";
|
QString file = ":/ScStwBasestation.sb64";
|
||||||
QFile f(file);
|
QFile f(file);
|
||||||
if (!f.open(QFile::ReadOnly)) return false;
|
if (!f.open(QFile::ReadOnly)){
|
||||||
|
qDebug() << "read error " << f.error();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
QString fileContents = f.readAll();
|
QString fileContents = f.readAll();
|
||||||
|
|
||||||
if(this->isFirmwareUpToDate()) {
|
QVariantMap ret = this->sendCommand(5000, fileContents, 15000);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap ret = this->sendCommand(5000, fileContents, true, 15000);
|
qDebug() << "updated firmware, status: " << ret["status"];
|
||||||
|
|
||||||
return ret["status"].toInt() == 200;
|
return ret["status"].toInt() == 200;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue