diff options
author | Joseph W. Joshua <joejoshw@gmail.com> | 2014-06-04 07:25:41 +0300 |
---|---|---|
committer | Thiago Macieira <thiago@macieira.org> | 2014-08-09 12:01:56 -0300 |
commit | a08d239af598632eec5a8bb951aeda4cfc441fc8 (patch) | |
tree | 5dd4919a4eefbe8614d40e4e245ea05108fb7cab /qt-ui/configuredivecomputer.cpp | |
parent | 3e127a059f598a30e9cfd71411783d71f40b315f (diff) | |
download | subsurface-a08d239af598632eec5a8bb951aeda4cfc441fc8.tar.gz |
Change dive computer family detection
Following suggestions on the mailing list, this changes the
method used to detect the dive computer family. Detection is
now done using: dc_device_get_type.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui/configuredivecomputer.cpp')
-rw-r--r-- | qt-ui/configuredivecomputer.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index fcd8fbc80..ae71ea627 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -83,13 +83,12 @@ ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data) void ReadSettingsThread::run() { - QString vendor = data->vendor; dc_status_t rc; rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); if (rc == DC_STATUS_SUCCESS) { - if (vendor.trimmed() == "Heinrichs Weikamp") { + if (dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3) { unsigned char hw_data[10]; - hw_frog_device_version(data->device, hw_data, 10); + hw_ostc3_device_version(data->device, hw_data, 10); QTextStream (&result) << "Device Version: " << hw_data; //just a test. I will work on decoding this } else { lastError = tr("This feature is not yet available for the selected dive computer."); @@ -112,18 +111,21 @@ void WriteSettingsThread::run() { bool supported = false; dc_status_t rc; - QString product = data->product; - QString vendor = data->vendor; rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); if (rc == DC_STATUS_SUCCESS) { dc_status_t result; - if (product.trimmed() == "OSTC 3") { + if (dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3) { if (m_settingName == "Name") { supported = true; result = hw_ostc3_device_customtext(data->device, m_settingValue.toByteArray().data()); } + } else if ( dc_device_get_type(data->device) == DC_FAMILY_HW_FROG ) { + if (m_settingName == "Name") { + supported = true; + result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data()); + } } - if (vendor.trimmed() == "Heinrichs Weikamp" && m_settingName == "DateAndTime") { + if ( dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3 && m_settingName == "DateTime" ) { supported = true; QDateTime timeToSet = m_settingValue.toDateTime(); dc_datetime_t time; |