[PATCH] Add average depth from OSTC/OSTC3 logbook

Anton Lundin glance at acc.umu.se
Tue Jan 20 23:38:59 PST 2015


Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 src/hw_ostc_parser.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c
index a3ee279..800dac4 100644
--- a/src/hw_ostc_parser.c
+++ b/src/hw_ostc_parser.c
@@ -75,6 +75,7 @@ typedef struct hw_ostc_sample_info_t {
 typedef struct hw_ostc_layout_t {
 	unsigned int datetime;
 	unsigned int maxdepth;
+	unsigned int avgdepth;
 	unsigned int divetime;
 	unsigned int atmospheric;
 	unsigned int salinity;
@@ -108,6 +109,7 @@ static const dc_parser_vtable_t hw_ostc_parser_vtable = {
 static const hw_ostc_layout_t hw_ostc_layout_ostc = {
 	3,  /* datetime */
 	8,  /* maxdepth */
+	45, /* avgdepth */
 	10, /* divetime */
 	15, /* atmospheric */
 	43, /* salinity */
@@ -121,6 +123,7 @@ static const hw_ostc_layout_t hw_ostc_layout_ostc = {
 static const hw_ostc_layout_t hw_ostc_layout_frog = {
 	9,  /* datetime */
 	14, /* maxdepth */
+	UNSUPPORTED, /* avgdepth */
 	16, /* divetime */
 	21, /* atmospheric */
 	43, /* salinity */
@@ -134,6 +137,7 @@ static const hw_ostc_layout_t hw_ostc_layout_frog = {
 static const hw_ostc_layout_t hw_ostc_layout_ostc3 = {
 	12, /* datetime */
 	17, /* maxdepth */
+	73, /* avgdepth */
 	19, /* divetime */
 	24, /* atmospheric */
 	70, /* salinity */
@@ -329,6 +333,11 @@ hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned
 		case DC_FIELD_MAXDEPTH:
 			*((double *) value) = array_uint16_le (data + layout->maxdepth) / 100.0;
 			break;
+		case DC_FIELD_AVGDEPTH:
+			if (version == 0x22)
+				return DC_STATUS_UNSUPPORTED;
+			*((double *) value) = array_uint16_le (data + layout->avgdepth) / 100.0;
+			break;
 		case DC_FIELD_GASMIX_COUNT:
 			if (version == 0x22) {
 				*((unsigned int *) value) = 3;
-- 
2.1.0



More information about the devel mailing list