From 13f5c75ac49d88bd1d1f45e798a5e75b6426aa81 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 16 Apr 2018 18:14:59 -0700 Subject: Convert our custom IO model to new libdivecomputer IO model This converts our old custom IO model to the new model that libdivecomputer introduced. This is partly based on Jef's rough patch to make things build, with further work by me. The FTDI code is temporarily disabled here, because it will need to be integrated with the new way of opening devices. The ble_serial code goes away entirely, since now libdivecomputer knows about BLE transport natively, and doesn't need to have any serial wrapper around it. Signed-off-by: Jef Driesen Signed-off-by: Linus Torvalds --- core/configuredivecomputer.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'core/configuredivecomputer.cpp') diff --git a/core/configuredivecomputer.cpp b/core/configuredivecomputer.cpp index b59f1916b..6fef1eb21 100644 --- a/core/configuredivecomputer.cpp +++ b/core/configuredivecomputer.cpp @@ -635,24 +635,16 @@ QString ConfigureDiveComputer::dc_open(device_data_t *data) fprintf(data->libdc_logfile, "built with libdivecomputer v%s\n", dc_version(NULL)); } -#if defined(SSRF_CUSTOM_IO) if (data->bluetooth_mode) { -#if defined(BT_SUPPORT) && defined(SSRF_CUSTOM_IO) - rc = dc_context_set_custom_io(data->context, get_qt_serial_ops(), data); -#endif -#ifdef SERIAL_FTDI - } else if (!strcmp(data->devname, "ftdi")) { - rc = dc_context_set_custom_io(data->context, &serial_ftdi_ops, data); +#if defined(BT_SUPPORT) + rc = ble_packet_open(&data->iostream, data->context, data->devname, data); #endif } if (rc != DC_STATUS_SUCCESS) { report_error(errmsg(rc)); } else { -#else - { -#endif - rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); + rc = dc_device_open(&data->device, data->context, data->descriptor, data->iostream); } if (rc != DC_STATUS_SUCCESS) { @@ -672,6 +664,8 @@ void ConfigureDiveComputer::dc_close(device_data_t *data) if (data->context) dc_context_free(data->context); data->context = NULL; + dc_iostream_close(data->iostream); + data->iostream = NULL; if (data->libdc_logfile) fclose(data->libdc_logfile); -- cgit v1.2.3-70-g09d2