Provide for a dive_computer_type variable within dc structure

This patch lays the foundation for differentiating
 between open-circuit(OC)dives and rebreather dives
 (CCR). The following were done:
 1) In dive.h add an enum type dive_computer_type
 2) In dive.h add two more fields to the dc structure:
    a) dctype  (an enum field indicating dc type)
    b) no_o2sensor (indicating number of o2 sensors for this dc)
 3) In parse-xml.c add a function trimspace that strips any
    whitespace from a string. This is used by two functions:
    utf8_string as well as by get_dc_type, described below.
    The pointer to buffer is not changed in order to ensure
    consistency when the buffer is freed.
 4) In parse-xml.c add a function get_dc_type. This parses the
    dc_type string from xml and assigns an enum value which will
    later be returned to the function that parses
    the dc variables.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Willem Ferguson 2014-06-11 19:48:48 +02:00 committed by Dirk Hohndel
parent 6a9c4097c0
commit a0f5a74847
2 changed files with 73 additions and 43 deletions

6
dive.h
View file

@ -41,6 +41,8 @@ extern "C" {
#include <stdbool.h>
#endif
enum dive_comp_type {OC, CCR}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type
struct gasmix {
fraction_t o2;
fraction_t he;
@ -217,7 +219,9 @@ struct divecomputer {
depth_t maxdepth, meandepth;
temperature_t airtemp, watertemp;
pressure_t surface_pressure;
int salinity; // kg per 10000 l
enum dive_comp_type dctype; // dive computer type: OC(default) or CCR
uint8_t no_o2sensors; // rebreathers: number of O2 sensors used
int salinity; // kg per 10000 l
const char *model;
uint32_t deviceid, diveid;
int samples, alloc_samples;