Add support for salinity and atmospheric pressure

This adds a new type dc_salinity_t and associated enum dc_water_t.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-11-13 11:43:18 -08:00 committed by Jef Driesen
parent 909679a48c
commit 360a318334
2 changed files with 24 additions and 1 deletions

View File

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

View File

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