summaryrefslogtreecommitdiffstats
path: root/configuredivecomputerthreads.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-23 18:16:27 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:15 -0700
commitcc6c385f3309417727f61b55550d6d47bef004dd (patch)
tree2b86c64b388ad7005cbf952bc3c93ef9abcbb1d3 /configuredivecomputerthreads.cpp
parent8aa7fddb22cd6ab4d533082598be04649bb1ff21 (diff)
downloadsubsurface-cc6c385f3309417727f61b55550d6d47bef004dd.tar.gz
Start Work on Firmware Update
This patch implements the first step towards OSTC 3 firmware update. Its not much, just file selection, but I will build up on it from there. Implements a thread to initiate firmware updates. Currently, this is for the OSTC 3. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'configuredivecomputerthreads.cpp')
-rw-r--r--configuredivecomputerthreads.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index 66506affd..52f946179 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -467,3 +467,35 @@ void WriteSettingsThread::run()
emit error(lastError);
}
}
+
+
+FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName)
+: QThread(parent), m_data(data), m_fileName(fileName)
+{
+
+}
+
+void FirmwareUpdateThread::run()
+{
+ bool supported = false;
+ dc_status_t rc;
+ rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
+ if (rc == DC_STATUS_SUCCESS) {
+ switch (dc_device_get_type(m_data->device)) {
+ case DC_FAMILY_HW_OSTC3:
+ supported = true;
+ //hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
+ break;
+ }
+ dc_device_close(m_data->device);
+
+ if (!supported) {
+ lastError = tr("This feature is not yet available for the selected dive computer.");
+ emit error(lastError);
+ }
+ }
+ else {
+ lastError = tr("Could not a establish connection to the dive computer.");
+ emit error(lastError);
+ }
+}