diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/downloadfromdcthread.cpp | 1 | ||||
-rw-r--r-- | core/libdivecomputer.h | 2 | ||||
-rw-r--r-- | core/qt-ble.cpp | 6 | ||||
-rw-r--r-- | core/qt-ble.h | 2 | ||||
-rw-r--r-- | core/qtserialbluetooth.cpp | 1 |
5 files changed, 11 insertions, 1 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index e4dc80176..95f6b7f75 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -70,6 +70,7 @@ void DownloadThread::run() auto internalData = m_data->internalData(); internalData->descriptor = descriptorLookup[m_data->vendor() + m_data->product()]; internalData->download_table = &downloadTable; + internalData->btname = strdup(m_data->devBluetoothName().toUtf8()); #if defined(Q_OS_ANDROID) // on Android we either use BT, a USB device, or we download via FTDI cable if (!internalData->bluetooth_mode && (same_string(internalData->devname, "FTDI") || same_string(internalData->devname, ""))) diff --git a/core/libdivecomputer.h b/core/libdivecomputer.h index e1964eb9a..b06b5ae0d 100644 --- a/core/libdivecomputer.h +++ b/core/libdivecomputer.h @@ -30,7 +30,7 @@ typedef struct dc_user_device_t { dc_descriptor_t *descriptor; const char *vendor, *product, *devname; - const char *model; + const char *model, *btname; unsigned char *fingerprint; unsigned int fsize, fdiveid; uint32_t libdc_firmware, libdc_serial; diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index ba75c8472..b2f2edf47 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -542,4 +542,10 @@ dc_status_t qt_ble_write(void *io, const void* data, size_t size, size_t *actual return ble->write(data, size, actual); } +const char *qt_ble_get_name(void *io) +{ + BLEObject *ble = (BLEObject *) io; + return ble->get_name(); +} + } /* extern "C" */ diff --git a/core/qt-ble.h b/core/qt-ble.h index f9600ad19..65e23964a 100644 --- a/core/qt-ble.h +++ b/core/qt-ble.h @@ -23,6 +23,7 @@ public: inline void set_timeout(int value) { timeout = value; } dc_status_t write(const void* data, size_t size, size_t *actual); dc_status_t read(void* data, size_t size, size_t *actual); + inline const char *get_name() { return device->btname; } inline QLowEnergyService *preferredService() { return preferred; } inline int descriptorWritten() { return desc_written; } @@ -63,6 +64,7 @@ dc_status_t qt_ble_set_timeout(void *io, int timeout); dc_status_t qt_ble_read(void *io, void* data, size_t size, size_t *actual); dc_status_t qt_ble_write(void *io, const void* data, size_t size, size_t *actual); dc_status_t qt_ble_close(void *io); +const char *qt_ble_get_name(void *io); } #endif diff --git a/core/qtserialbluetooth.cpp b/core/qtserialbluetooth.cpp index be1cda686..cd1fde6f1 100644 --- a/core/qtserialbluetooth.cpp +++ b/core/qtserialbluetooth.cpp @@ -424,6 +424,7 @@ ble_packet_open(dc_iostream_t **iostream, dc_context_t *context, const char* dev NULL, /* purge */ qt_custom_sleep, /* sleep */ qt_ble_close, /* close */ + qt_ble_get_name, /* get_name */ }; rc = qt_ble_open(&io, context, devaddr, (dc_user_device_t *) userdata); |