From 547203693193ab1428cb7e1e8c4704d7e68ed3bd Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Sat, 12 Sep 2015 22:37:35 +0200 Subject: Connect up custom serial in dc configuration This connects up the custom serial code in the configure dive computer dialogs. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- configuredivecomputer.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'configuredivecomputer.cpp') diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp index 9e03bc66e..1262492de 100644 --- a/configuredivecomputer.cpp +++ b/configuredivecomputer.cpp @@ -632,7 +632,28 @@ QString ConfigureDiveComputer::dc_open(device_data_t *data) dc_context_set_logfunc(data->context, logfunc, fp); } - rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); +#if defined(SSRF_CUSTOM_SERIAL) + dc_serial_t *serial_device = NULL; + + if (data->bluetooth_mode) { + rc = dc_serial_qt_open(&serial_device, data->context, data->devname); +#ifdef SERIAL_FTDI + } else if (!strcmp(data->devname, "ftdi")) { + rc = dc_serial_ftdi_open(&serial_device, data->context); +#endif + } + + if (rc != DC_STATUS_SUCCESS) { + return errmsg(rc); + } else if (serial_device) { + rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device); + } else { +#else + { +#endif + rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); + } + if (rc != DC_STATUS_SUCCESS) { return tr("Could not a establish connection to the dive computer."); } -- cgit v1.2.3-70-g09d2