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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-11-21 12:55:11 -08:00
parent 0ddec2b50f
commit 5f76249923
3 changed files with 6 additions and 4 deletions

View File

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

View File

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

View File

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