- 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 \
|
||||
scstwclient.h
|
||||
|
||||
RESOURCES += \
|
||||
ScStwLibrariesShared.qrc
|
||||
|
||||
DISTFILES +=
|
||||
|
||||
#DEPENDS
|
||||
CONFIG(release, debug|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)
|
||||
return false;
|
||||
|
||||
if(this->isFirmwareUpToDate())
|
||||
return true;
|
||||
|
||||
QString file = ":/ScStwBasestation.sb64";
|
||||
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();
|
||||
|
||||
if(this->isFirmwareUpToDate()) {
|
||||
return true;
|
||||
}
|
||||
QVariantMap ret = this->sendCommand(5000, fileContents, 15000);
|
||||
|
||||
QVariantMap ret = this->sendCommand(5000, fileContents, true, 15000);
|
||||
qDebug() << "updated firmware, status: " << ret["status"];
|
||||
|
||||
return ret["status"].toInt() == 200;
|
||||
}
|
||||
|
|
Reference in a new issue