Stop accessing the internals of dc_descriptor_t

This removes our own declaration of dc_descriptor_t and all our accesses
to its internals, and switches to use the libdivecomputer functions to
access those instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
Anton Lundin 2016-12-29 15:41:44 +01:00 committed by Subsurface
parent d11dfd2f45
commit 70e2404492
3 changed files with 5 additions and 12 deletions

View file

@ -1079,14 +1079,14 @@ dc_status_t libdc_buffer_parser(struct dive *dive, device_data_t *data, unsigned
dc_status_t rc;
dc_parser_t *parser = NULL;
switch (data->descriptor->type) {
switch (dc_descriptor_get_type(data->descriptor)) {
case DC_FAMILY_UWATEC_ALADIN:
case DC_FAMILY_UWATEC_MEMOMOUSE:
rc = uwatec_memomouse_parser_create(&parser, data->context, 0, 0);
break;
case DC_FAMILY_UWATEC_SMART:
case DC_FAMILY_UWATEC_MERIDIAN:
rc = uwatec_smart_parser_create (&parser, data->context, data->descriptor->model, 0, 0);
rc = uwatec_smart_parser_create (&parser, data->context, dc_descriptor_get_model(data->descriptor), 0, 0);
break;
case DC_FAMILY_HW_OSTC:
#if defined(SSRF_CUSTOM_SERIAL)
@ -1120,7 +1120,7 @@ dc_status_t libdc_buffer_parser(struct dive *dive, device_data_t *data, unsigned
}
// Do not parse Aladin/Memomouse headers as they are fakes
// Do not return on error, we can still parse the samples
if (data->descriptor->type != DC_FAMILY_UWATEC_ALADIN && data->descriptor->type != DC_FAMILY_UWATEC_MEMOMOUSE) {
if (dc_descriptor_get_type(data->descriptor) != DC_FAMILY_UWATEC_ALADIN && dc_descriptor_get_type(data->descriptor) != DC_FAMILY_UWATEC_MEMOMOUSE) {
rc = libdc_header_parser (parser, data, dive);
if (rc != DC_STATUS_SUCCESS) {
report_error("Error parsing the dive header data. Dive # %d\nStatus = %s", dive->number, errmsg(rc));

View file

@ -18,13 +18,6 @@
extern "C" {
#endif
struct dc_descriptor_t {
const char *vendor;
const char *product;
dc_family_t type;
unsigned int model;
};
/* don't forget to include the UI toolkit specific display-XXX.h first
to get the definition of progressbar_t */
typedef struct device_data_t

View file

@ -20,8 +20,8 @@ static int ostc_prepare_data(int data_model, dc_family_t dc_fam, device_data_t *
data_descriptor = get_descriptor(dc_fam, data_model);
if (data_descriptor) {
dev_data->descriptor = data_descriptor;
dev_data->vendor = copy_string(data_descriptor->vendor);
dev_data->model = copy_string(data_descriptor->product);
dev_data->vendor = copy_string(dc_descriptor_get_vendor(data_descriptor));
dev_data->model = copy_string(dc_descriptor_get_product(data_descriptor));
} else {
return 0;
}