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>
This commit is contained in:
Anton Lundin 2015-09-25 00:59:03 +02:00 committed by Dirk Hohndel
parent 94a86df9a3
commit 8946c82242
3 changed files with 173 additions and 124 deletions

View file

@ -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;