mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
BLE: try to pick the correct descriptor to write to
The ordering on Mac appears to be random, but after looking through the various successful logs of BLE downloads, it seems we always wrote to the ClientCharacteristicConfiguration descriptor. So try to find that one first, and only grab the first descriptor in the list if we didn't find a ClientCharacteristicConfiguration descriptor. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
26e610c3f4
commit
90d73924c2
1 changed files with 13 additions and 2 deletions
|
@ -382,8 +382,19 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d
|
|||
qDebug() << "Descriptor:" << d.name() << "uuid:" << d.uuid().toString();
|
||||
|
||||
if (!l.isEmpty()) {
|
||||
d = l.first();
|
||||
qDebug() << "now writing \"0x0100\" to the first descriptor";
|
||||
bool foundCCC = false;
|
||||
foreach (d, l) {
|
||||
if (d.type() == QBluetoothUuid::ClientCharacteristicConfiguration) {
|
||||
// pick the correct characteristic
|
||||
foundCCC = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundCCC)
|
||||
// if we didn't find a ClientCharacteristicConfiguration, try the first one
|
||||
d = l.first();
|
||||
|
||||
qDebug() << "now writing \"0x0100\" to the descriptor" << d.uuid().toString();
|
||||
|
||||
ble->preferredService()->writeDescriptor(d, QByteArray::fromHex("0100"));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue