Add an ostc3 specific function with the model number.

To be able to pass the OSTC 3 model number to the parser, and preserve
backwards compatibility, we need a new function. The new function should
also be used for the Frog, by passing zero as the model number.

Using the hw_ostc_parser_create() function with the hwos parameter set
to one, is now deprecated but will remain supported for backwards
compatibility.
This commit is contained in:
Jef Driesen 2016-07-12 19:54:58 +02:00
parent 29caab0673
commit 2829f7ebf9
4 changed files with 20 additions and 2 deletions

View File

@ -64,6 +64,9 @@ hw_ostc3_device_config_reset (dc_device_t *abstract);
dc_status_t
hw_ostc3_device_fwupdate (dc_device_t *abstract, const char *filename);
dc_status_t
hw_ostc3_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -84,6 +84,7 @@ typedef struct hw_ostc_gasmix_t {
typedef struct hw_ostc_parser_t {
dc_parser_t base;
unsigned int hwos;
unsigned int model;
// Cached fields.
unsigned int cached;
unsigned int version;
@ -267,7 +268,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 hwos)
hw_ostc_parser_create_internal (dc_parser_t **out, dc_context_t *context, unsigned int hwos, unsigned int model)
{
hw_ostc_parser_t *parser = NULL;
@ -283,6 +284,7 @@ hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int hw
// Set the default values.
parser->hwos = hwos;
parser->model = model;
parser->cached = 0;
parser->version = 0;
parser->header = 0;
@ -301,6 +303,18 @@ hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int hw
}
dc_status_t
hw_ostc_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int hwos)
{
return hw_ostc_parser_create_internal (out, context, hwos, 0);
}
dc_status_t
hw_ostc3_parser_create (dc_parser_t **out, dc_context_t *context, unsigned int model)
{
return hw_ostc_parser_create_internal (out, context, 1, model);
}
static dc_status_t
hw_ostc_parser_set_data (dc_parser_t *abstract, const unsigned char *data, unsigned int size)
{

View File

@ -63,6 +63,7 @@ oceanic_vtpro_parser_create2
oceanic_veo250_parser_create
oceanic_atom2_parser_create
hw_ostc_parser_create
hw_ostc3_parser_create
cressi_edy_parser_create
cressi_leonardo_parser_create
atomics_cobalt_parser_create

View File

@ -116,7 +116,7 @@ dc_parser_new_internal (dc_parser_t **out, dc_context_t *context, dc_family_t fa
break;
case DC_FAMILY_HW_FROG:
case DC_FAMILY_HW_OSTC3:
rc = hw_ostc_parser_create (&parser, context, 1);
rc = hw_ostc3_parser_create (&parser, context, model);
break;
case DC_FAMILY_CRESSI_EDY:
case DC_FAMILY_ZEAGLE_N2ITION3: