Add support for parsing the dive mode.
This commit is contained in:
parent
7a3d921725
commit
651123de53
@ -467,6 +467,22 @@ doparse (FILE *fp, dc_device_t *device, const unsigned char data[], unsigned int
|
||||
tank.beginpressure, tank.endpressure);
|
||||
}
|
||||
|
||||
// Parse the dive mode.
|
||||
message ("Parsing the dive mode.\n");
|
||||
dc_divemode_t divemode = DC_DIVEMODE_OC;
|
||||
rc = dc_parser_get_field (parser, DC_FIELD_DIVEMODE, 0, &divemode);
|
||||
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
|
||||
WARNING ("Error parsing the dive mode.");
|
||||
dc_parser_destroy (parser);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (rc != DC_STATUS_UNSUPPORTED) {
|
||||
const char *names[] = {"freedive", "gauge", "oc", "cc"};
|
||||
fprintf (fp, "<divemode>%s</divemode>\n",
|
||||
names[divemode]);
|
||||
}
|
||||
|
||||
// Parse the salinity.
|
||||
message ("Parsing the salinity.\n");
|
||||
dc_salinity_t salinity = {DC_WATER_FRESH, 0.0};
|
||||
|
||||
@ -58,7 +58,8 @@ typedef enum dc_field_type_t {
|
||||
DC_FIELD_TEMPERATURE_MINIMUM,
|
||||
DC_FIELD_TEMPERATURE_MAXIMUM,
|
||||
DC_FIELD_TANK_COUNT,
|
||||
DC_FIELD_TANK
|
||||
DC_FIELD_TANK,
|
||||
DC_FIELD_DIVEMODE
|
||||
} dc_field_type_t;
|
||||
|
||||
typedef enum parser_sample_event_t {
|
||||
@ -115,6 +116,13 @@ typedef enum dc_water_t {
|
||||
DC_WATER_SALT
|
||||
} dc_water_t;
|
||||
|
||||
typedef enum dc_divemode_t {
|
||||
DC_DIVEMODE_FREEDIVE,
|
||||
DC_DIVEMODE_GAUGE,
|
||||
DC_DIVEMODE_OC, /* Open circuit */
|
||||
DC_DIVEMODE_CC /* Closed circuit */
|
||||
} dc_divemode_t;
|
||||
|
||||
typedef enum dc_deco_type_t {
|
||||
DC_DECO_NDL,
|
||||
DC_DECO_SAFETYSTOP,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user