On Tue, Jun 3, 2014 at 8:51 PM, Jef Driesen <[email protected]> wrote:
> >> hw_frog_device_version(data->device, hw_data, 10); >> > > This part is still wrong. If you call hw_frog_device_version, you should > check for DC_FAMILY_HW_FROG. Otherwise the call will always fail with > DC_STATUS_INVALIDARGS. > > Jef > I had missed that one. The attached patch fixes this. -- Thanks, Joshua
From 5d835c15516c29c79fb1300eb80f873119fa0330 Mon Sep 17 00:00:00 2001 From: "Joseph W. Joshua" <[email protected]> Date: Wed, 4 Jun 2014 07:25:41 +0300 Subject: [PATCH 5/5] 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 <[email protected]> --- qt-ui/configuredivecomputer.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index fcd8fbc..ae71ea6 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; -- 2.0.0
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
