diff --git a/include/libdivecomputer/parser.h b/include/libdivecomputer/parser.h index 18b4a96..b0cf444 100644 --- a/include/libdivecomputer/parser.h +++ b/include/libdivecomputer/parser.h @@ -47,7 +47,9 @@ typedef enum dc_field_type_t { DC_FIELD_MAXDEPTH, DC_FIELD_AVGDEPTH, DC_FIELD_GASMIX_COUNT, - DC_FIELD_GASMIX + DC_FIELD_GASMIX, + DC_FIELD_SALINITY, + DC_FIELD_ATMOSPHERIC } dc_field_type_t; typedef enum parser_sample_event_t { @@ -93,6 +95,16 @@ typedef enum parser_sample_vendor_t { SAMPLE_VENDOR_OCEANIC_ATOM2 } parser_sample_vendor_t; +typedef enum dc_water_t { + DC_WATER_FRESH, + DC_WATER_SALT +} dc_water_t; + +typedef struct dc_salinity_t { + dc_water_t type; + double density; +} dc_salinity_t; + typedef struct dc_gasmix_t { double helium; double oxygen; diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index e0801f2..541f6ff 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -211,6 +211,7 @@ hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned data += 6; dc_gasmix_t *gasmix = (dc_gasmix_t *) value; + dc_salinity_t *water = (dc_salinity_t *) value; if (value) { switch (type) { @@ -234,6 +235,16 @@ hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned gasmix->helium = data[20 + 2 * flags] / 100.0; gasmix->nitrogen = 1.0 - gasmix->oxygen - gasmix->helium; break; + case DC_FIELD_SALINITY: + if (data[43] == 100) + water->type = DC_WATER_FRESH; + else + water->type = DC_WATER_SALT; + water->density = data[43] * 10.0; + break; + case DC_FIELD_ATMOSPHERIC: + *((double *) value) = array_uint16_le (data + 15) / 1000.0; + break; default: return DC_STATUS_UNSUPPORTED; }