diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-10-20 22:58:21 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-20 18:11:37 -0700 |
commit | adf03c7845a2bf0f4e8d2cf5029b8ded0c0c9367 (patch) | |
tree | c476cdf428580ac013d144e8b9f660d58d603aa3 /configuredivecomputer.cpp | |
parent | c11e2fbb6f102435f0ed8bce278e5fc938ce4768 (diff) | |
download | subsurface-adf03c7845a2bf0f4e8d2cf5029b8ded0c0c9367.tar.gz |
Finish off the firmware update code.
This code connects the final parts of the generic firmware update code.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'configuredivecomputer.cpp')
-rw-r--r-- | configuredivecomputer.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp index 1b2b9e80b..9a708ad6e 100644 --- a/configuredivecomputer.cpp +++ b/configuredivecomputer.cpp @@ -13,7 +13,8 @@ ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) : QObject(parent), readThread(0), writeThread(0), - resetThread(0) + resetThread(0), + firmwareThread(0) { setState(INITIAL); } @@ -512,7 +513,17 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data) { + setState(FWUPDATE); + if (firmwareThread) + firmwareThread->deleteLater(); + + firmwareThread = new FirmwareUpdateThread(this, data, fileName); + connect(firmwareThread, SIGNAL(finished()), + this, SLOT(firmwareThreadFinished()), Qt::QueuedConnection); + connect(firmwareThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + + firmwareThread->start(); } void ConfigureDiveComputer::resetSettings(device_data_t *data) @@ -557,6 +568,15 @@ void ConfigureDiveComputer::writeThreadFinished() } } +void ConfigureDiveComputer::firmwareThreadFinished() +{ + setState(DONE); + if (resetThread->lastError.isEmpty()) { + //No error + emit message(tr("Device firmware successfully updated")); + } +} + void ConfigureDiveComputer::resetThreadFinished() { setState(DONE); |