aboutsummaryrefslogtreecommitdiffstats
path: root/core/configuredivecomputer.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-04-16 18:14:59 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-24 17:54:08 -0700
commit13f5c75ac49d88bd1d1f45e798a5e75b6426aa81 (patch)
tree8f8e4021f34dca2551aca707f41b8ef3c509d444 /core/configuredivecomputer.cpp
parentc07faa90f33fac895e8a0b3326adb298a1845063 (diff)
downloadsubsurface-13f5c75ac49d88bd1d1f45e798a5e75b6426aa81.tar.gz
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 <jef@libdivecomputer.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/configuredivecomputer.cpp')
-rw-r--r--core/configuredivecomputer.cpp16
1 files changed, 5 insertions, 11 deletions
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);