summaryrefslogtreecommitdiffstats
path: root/core/libdivecomputer.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/libdivecomputer.c')
-rw-r--r--core/libdivecomputer.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index a666ca667..ed5158c69 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -18,11 +18,6 @@
#include "libdivecomputer.h"
#include "core/version.h"
-#if !defined(SSRF_LIBDC_VERSION) || SSRF_LIBDC_VERSION < 2
-#pragma message "Subsurface requires a reasonably current version of the Subsurface-branch"
-#pragma message "of libdivecomputer (at least version 2 of our API)."
-#pragma message "Please get it from http://github.com/Subsurface-divelog/libdc Subsurface-branch"
-#endif
//
// If we have an old libdivecomputer, it doesn't
// have the new DC_TANKINFO bits, but just volume
@@ -1076,6 +1071,7 @@ const char *do_libdivecomputer_import(device_data_t *data)
first_temp_is_air = 0;
data->device = NULL;
data->context = NULL;
+ data->iostream = NULL;
if (data->libdc_log && logfile_name)
fp = subsurface_fopen(logfile_name, "w");
@@ -1095,27 +1091,16 @@ const char *do_libdivecomputer_import(device_data_t *data)
err = translate("gettextFromC", "Unable to open %s %s (%s)");
-#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);
- INFO(0, "setting up ftdi ops");
-#else
- INFO(0, "FTDI disabled");
+#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);
INFO(0, "dc_deveice_open error value of %d", rc);
if (rc != DC_STATUS_SUCCESS && subsurface_access(data->devname, R_OK | W_OK) != 0)
err = translate("gettextFromC", "Error opening the device %s %s (%s).\nIn most cases, in order to debug this issue, a libdivecomputer logfile will be useful.\nYou can create this logfile by selecting the corresponding checkbox in the download dialog.");
@@ -1126,6 +1111,8 @@ const char *do_libdivecomputer_import(device_data_t *data)
/* TODO: Show the logfile to the user on error. */
dc_device_close(data->device);
data->device = NULL;
+ dc_iostream_close(data->iostream);
+ data->iostream = NULL;
if (!downloadTable.nr)
dev_info(data, translate("gettextFromC", "No new dives downloaded from dive computer"));
}