mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
c07faa90f3
commit
13f5c75ac4
9 changed files with 169 additions and 374 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue