From 5f762499230aa17276551dcecb25339666eab060 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 21 Nov 2014 12:55:11 -0800 Subject: [PATCH] Pass the serial number from the devinfo to the OSTC parsers This way we can analyze the data in the parser and return it to the application. Signed-off-by: Dirk Hohndel --- include/libdivecomputer/hw_ostc.h | 2 +- src/hw_ostc_parser.c | 4 +++- src/parser.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/libdivecomputer/hw_ostc.h b/include/libdivecomputer/hw_ostc.h index 4dfb523..91fe714 100644 --- a/include/libdivecomputer/hw_ostc.h +++ b/include/libdivecomputer/hw_ostc.h @@ -65,7 +65,7 @@ dc_status_t hw_ostc_extract_dives (dc_device_t *device, const unsigned char data[], unsigned int size, dc_dive_callback_t callback, void *userdata); dc_status_t -hw_ostc_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int frog); +hw_ostc_parser_create (dc_parser_t **parser, dc_context_t *context, unsigned int serial, unsigned int frog); dc_status_t hw_ostc_device_fwupdate (dc_device_t *abstract, const char *filename); diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index f919832..706ac58 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -95,6 +95,7 @@ typedef struct hw_ostc_gasmix_t { typedef struct hw_ostc_parser_t { dc_parser_t base; unsigned int frog; + unsigned int serial; // Cached fields. unsigned int cached; unsigned int version; @@ -282,7 +283,7 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser) } dc_status_t -hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int frog) +hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int serial, unsigned int frog) { if (out == NULL) return DC_STATUS_INVALIDARGS; @@ -310,6 +311,7 @@ hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int fr parser->gasmix[i].oxygen = 0; parser->gasmix[i].helium = 0; } + parser->serial = serial; *out = (dc_parser_t *) parser; diff --git a/src/parser.c b/src/parser.c index 4d0d97e..d8a137a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -111,11 +111,11 @@ dc_parser_new (dc_parser_t **out, dc_device_t *device) rc = mares_iconhd_parser_create (&parser, context, device->devinfo.model); break; case DC_FAMILY_HW_OSTC: - rc = hw_ostc_parser_create (&parser, context, 0); + rc = hw_ostc_parser_create (&parser, context, device->devinfo.serial, 0); break; case DC_FAMILY_HW_FROG: case DC_FAMILY_HW_OSTC3: - rc = hw_ostc_parser_create (&parser, context, 1); + rc = hw_ostc_parser_create (&parser, context, device->devinfo.serial, 1); break; case DC_FAMILY_CRESSI_EDY: case DC_FAMILY_ZEAGLE_N2ITION3: