diff options
author | Anton Lundin <glance@acc.umu.se> | 2016-09-17 17:27:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-17 15:47:37 -0700 |
commit | ffa3c4859327a78288cfb74e633ac3845a86ed86 (patch) | |
tree | 2576d8a298875a750f7b05ba9bd5bfebdeff9335 /core/configuredivecomputer.cpp | |
parent | 1219dc693170e4a04fff992bd5aed990674779c1 (diff) | |
download | subsurface-ffa3c4859327a78288cfb74e633ac3845a86ed86.tar.gz |
Rewrite libdivecomputer custom serial code
This rewrites the custom serial code to use the new api which I
implemented in the Subsurface-branch of libdivecomputer.
This is a bit to big patch but I haven't had the time to break it down
into more sensible patches.
This rewrite enables us to support more ftdi based divecomputer
communication and is tested with both a OSTC3, OSTC2N and a Suunto
Vyper, all over the libftdi driver.
The bluetooth code paths are tested to, and should work as before.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/configuredivecomputer.cpp')
-rw-r--r-- | core/configuredivecomputer.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/core/configuredivecomputer.cpp b/core/configuredivecomputer.cpp index 2457ffe82..d8aefaecc 100644 --- a/core/configuredivecomputer.cpp +++ b/core/configuredivecomputer.cpp @@ -633,22 +633,18 @@ QString ConfigureDiveComputer::dc_open(device_data_t *data) } #if defined(SSRF_CUSTOM_SERIAL) - dc_serial_t *serial_device = NULL; - if (data->bluetooth_mode) { -#ifdef BT_SUPPORT - rc = dc_serial_qt_open(&serial_device, data->context, data->devname); +#if defined(BT_SUPPORT) && defined(SSRF_CUSTOM_SERIAL) + rc = dc_context_set_custom_serial(data->context, get_qt_serial_ops()); #endif #ifdef SERIAL_FTDI } else if (!strcmp(data->devname, "ftdi")) { - rc = dc_serial_ftdi_open(&serial_device, data->context); + rc = dc_context_set_custom_serial(data->context, &serial_ftdi_ops); #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); + report_error(errmsg(rc)); } else { #else { |