diff options
author | Anton Lundin <glance@acc.umu.se> | 2015-09-25 00:59:03 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-25 09:56:11 -0700 |
commit | 8946c822425d22fb111a96bccbd3d81dd0447f5c (patch) | |
tree | 336ff6dad61df155bfba1b19f8f514ce0750a3b1 /configuredivecomputerthreads.cpp | |
parent | 94a86df9a325b8598b8fb94938cba06c036b0f72 (diff) | |
download | subsurface-8946c822425d22fb111a96bccbd3d81dd0447f5c.tar.gz |
Probe and expose OSTC3 model information
This looks at the OSTC3 hw descriptor and exposes that model info as a
read-only line edit, so you can see in clear text the name of the model
of computer.
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.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index 2c6583e04..00ab07f53 100644 --- a/configuredivecomputerthreads.cpp +++ b/configuredivecomputerthreads.cpp @@ -55,6 +55,13 @@ #define OSTC3_GRAPHICAL_SPEED_INDICATOR 0x40 #define OSTC3_ALWAYS_SHOW_PPO2 0x41 +#define OSTC3_HW_OSTC_3 0x0A +#define OSTC3_HW_OSTC_3P 0x1A +#define OSTC3_HW_OSTC_CR 0x05 +#define OSTC3_HW_OSTC_SPORT 0x12 +#define OSTC3_HW_OSTC_2 0x11 + + #define SUUNTO_VYPER_MAXDEPTH 0x1e #define SUUNTO_VYPER_TOTAL_TIME 0x20 #define SUUNTO_VYPER_NUMBEROFDIVES 0x22 @@ -401,7 +408,34 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev dc_status_t rc; dc_event_progress_t progress; progress.current = 0; - progress.maximum = 51; + progress.maximum = 52; + unsigned char hardware[1]; + + //Read hardware type + rc = hw_ostc3_device_hardware (device, hardware, sizeof (hardware)); + if (rc != DC_STATUS_SUCCESS) + return rc; + EMIT_PROGRESS(); + + // FIXME: can we grab this info from libdivecomputer descriptor + // instead of hard coded here? + switch(hardware[0]) { + case OSTC3_HW_OSTC_3: + m_deviceDetails->model = "3"; + break; + case OSTC3_HW_OSTC_3P: + m_deviceDetails->model = "3+"; + break; + case OSTC3_HW_OSTC_CR: + m_deviceDetails->model = "CR"; + break; + case OSTC3_HW_OSTC_SPORT: + m_deviceDetails->model = "Sport"; + break; + case OSTC3_HW_OSTC_2: + m_deviceDetails->model = "2"; + break; + } //Read gas mixes gas gas1; |