diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-06-18 14:17:00 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-06-19 07:53:10 +0000 |
commit | b6c0e2af96129c297b87c25796a36c3fbc680269 (patch) | |
tree | 8d0b4f47b311716f62fdcb9a9d0dadd113062a24 /src/bluetooth | |
parent | 8bdacf17c5b00b462984004a936882d1c8b0e234 (diff) |
QtBluetooth - handle timeous in characteristic writes (Darwin OS)
This can allegedly happen when executing write with notification.
While never observed so far, can easily be predicted/emulated,
resulting in QLEC stuck in queued write/read requests and not
progressing any futher.
Task-number: QTBUG-68707
Change-Id: I3321257bb84a83a8ea25f9ae4e8acbdb95568cfa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth')
-rw-r--r-- | src/bluetooth/osx/osxbtcentralmanager.mm | 8 | ||||
-rw-r--r-- | src/bluetooth/osx/osxbtcentralmanager_p.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm index b56dc0d5..9254bd98 100644 --- a/src/bluetooth/osx/osxbtcentralmanager.mm +++ b/src/bluetooth/osx/osxbtcentralmanager.mm @@ -229,6 +229,9 @@ QT_END_NAMESPACE qCWarning(QT_BT_OSX, "Timeout while reading a descriptor"); [self peripheral:peripheral didUpdateValueForDescriptor:objectUnderWatch error:nsError]; break; + case OperationTimeout::characteristicWrite: + qCWarning(QT_BT_OSX, "Timeout while writing a characteristic with response"); + [self peripheral:peripheral didWriteValueForCharacteristic:objectUnderWatch error:nsError]; default:; } } @@ -751,6 +754,7 @@ QT_END_NAMESPACE return [self performNextRequest]; requestPending = true; + [self watchAfter:characteristic timeout:OperationTimeout::characteristicWrite]; [peripheral writeValue:data.data() forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse]; } else { @@ -1621,6 +1625,10 @@ QT_END_NAMESPACE QT_BT_MAC_AUTORELEASEPOOL; + if (characteristic != objectUnderWatch) + return; + + [self stopWatchdog]; requestPending = false; diff --git a/src/bluetooth/osx/osxbtcentralmanager_p.h b/src/bluetooth/osx/osxbtcentralmanager_p.h index c0f278b2..e172d874 100644 --- a/src/bluetooth/osx/osxbtcentralmanager_p.h +++ b/src/bluetooth/osx/osxbtcentralmanager_p.h @@ -95,7 +95,8 @@ enum class OperationTimeout characteristicsDiscovery, characteristicRead, descriptorsDiscovery, - descriptorRead + descriptorRead, + characteristicWrite }; // In Qt we work with handles and UUIDs. Core Bluetooth |