- moved update binary to libraries

This commit is contained in:
Dorian Zedler 2020-04-07 16:32:35 +02:00
parent e7ecd6730f
commit b350f4636a
Signed by: dorian
GPG key ID: 989DE36109AFA354
4 changed files with 20 additions and 5 deletions

File diff suppressed because one or more lines are too long

View file

@ -26,6 +26,11 @@ HEADERS += \
ScStwLibraries_global.h \
scstwclient.h
RESOURCES += \
ScStwLibrariesShared.qrc
DISTFILES +=
#DEPENDS
CONFIG(release, debug|release): {
DESTDIR="$$PWD/build/release"

View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>ScStwBasestation.sb64</file>
</qresource>
</RCC>

View file

@ -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;
}