Add support for the salinity field

This commit is contained in:
Jef Driesen 2016-12-10 22:08:42 +01:00
parent 8c95180578
commit 9d95870f78

View File

@ -333,6 +333,7 @@ mares_iconhd_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsi
}
dc_gasmix_t *gasmix = (dc_gasmix_t *) value;
dc_salinity_t *water = (dc_salinity_t *) value;
if (value) {
switch (type) {
@ -376,6 +377,24 @@ mares_iconhd_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsi
else
*((double *) value) = array_uint16_le (p + 0x22) / 8000.0;
break;
case DC_FIELD_SALINITY:
if (parser->model == SMARTAPNEA) {
unsigned int salinity = parser->settings & 0x003F;
if (salinity == 0) {
water->type = DC_WATER_FRESH;
} else {
water->type = DC_WATER_SALT;
}
water->density = 1000.0 + salinity;
} else {
if (parser->settings & 0x0010) {
water->type = DC_WATER_FRESH;
} else {
water->type = DC_WATER_SALT;
}
water->density = 0.0;
}
break;
case DC_FIELD_TEMPERATURE_MINIMUM:
if (parser->model == SMARTAPNEA)
*((double *) value) = (signed short) array_uint16_le (p + 0x3C) / 10.0;