summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager.mm8
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager_p.h3
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