summaryrefslogtreecommitdiffstats
path: root/configuredivecomputerthreads.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-10-18 00:33:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-18 15:22:22 -0700
commit74f27a0a399a1f7c63d5542eec744102c301671f (patch)
treebf56cb41966f9e6de5615fbb516e7c3e2aba2821 /configuredivecomputerthreads.cpp
parentd63a3ce420fcaa6a4b576a840b9d17984f776b2a (diff)
downloadsubsurface-74f27a0a399a1f7c63d5542eec744102c301671f.tar.gz
Add support to reset OSTC3 settings to default
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'configuredivecomputerthreads.cpp')
-rw-r--r--configuredivecomputerthreads.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index 63ceb636f..a8465d7a4 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -714,3 +714,34 @@ void FirmwareUpdateThread::run()
emit error(lastError);
}
}
+
+
+ResetSettingsThread::ResetSettingsThread(QObject *parent, device_data_t *data)
+: QThread(parent), m_data(data)
+{
+}
+
+void ResetSettingsThread::run()
+{
+ bool supported = false;
+ dc_status_t rc;
+ rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
+ if (rc == DC_STATUS_SUCCESS) {
+#if DC_VERSION_CHECK(0, 5, 0)
+ if (dc_device_get_type(m_data->device) == DC_FAMILY_HW_OSTC3) {
+ supported = true;
+ hw_ostc3_device_config_reset(m_data->device);
+ }
+#endif // divecomputer 0.5.0
+ 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);
+ }
+}