10#include <QtCore/qloggingcategory.h>
11#include <QtCore/qdebug.h>
12#include <QtCore/qmap.h>
35 NSArray *
const cs = service.characteristics;
40 for (CBCharacteristic *
c in cs) {
41 NSArray *
const ds =
c.descriptors;
56 NSError *nsError = [[NSError alloc] initWithDomain:CBErrorDomain
57 code:CBErrorOperationCancelled
64 return std::find_if(watchdogs.begin(), watchdogs.end(), [
object,
type](
const GCDTimer &
other){
65 return [other objectUnderWatch] == object && [other timeoutType] == type;});
74@interface DarwinBTCentralManager (PrivateAPI)
77- (bool)objectIsUnderWatch:(
id)object operation:(
DarwinBluetooth::OperationTimeout)type;
83- (
void)readCharacteristics:(CBService *)service;
84- (
void)serviceDetailsDiscoveryFinished:(CBService *)service;
91- (CBCharacteristic *)nextCharacteristicForService:(CBService*)service
92 startingFrom:(CBCharacteristic *)from;
93- (CBCharacteristic *)nextCharacteristicForService:(CBService*)service
94 startingFrom:(CBCharacteristic *)from
95 withProperties:(CBCharacteristicProperties)properties;
96- (CBDescriptor *)nextDescriptorForCharacteristic:(CBCharacteristic *)characteristic
97 startingFrom:(CBDescriptor *)descriptor;
99 forCharacteristic:(CBCharacteristic *)ch;
100- (bool)cacheWriteValue:(const
QByteArray &)value for:(NSObject *)obj;
101- (
void)handleReadWriteError:(NSError *)error;
192 [manager setDelegate:nil];
195 [peripheral setDelegate:nil];
196 [peripheral release];
215 [newWatcher watchAfter:object withTimeoutType:type];
217 [newWatcher startWithTimeout:timeoutMS step:200];
237 [watchdog cancelTimer];
248 id cbObject = [watcher objectUnderWatch];
251 Q_ASSERT([self objectIsUnderWatch:cbObject operation:
type]);
253 NSLog(
@"Timeout caused by: %@", cbObject);
259 case OperationTimeout::serviceDiscovery:
260 qCWarning(QT_BT_DARWIN,
"Timeout in services discovery");
261 [
self peripheral:peripheral didDiscoverServices:nsError];
263 case OperationTimeout::includedServicesDiscovery:
264 qCWarning(QT_BT_DARWIN,
"Timeout in included services discovery");
265 [
self peripheral:peripheral didDiscoverIncludedServicesForService:cbObject error:nsError];
267 case OperationTimeout::characteristicsDiscovery:
268 qCWarning(QT_BT_DARWIN,
"Timeout in characteristics discovery");
269 [
self peripheral:peripheral didDiscoverCharacteristicsForService:cbObject error:nsError];
271 case OperationTimeout::characteristicRead:
272 qCWarning(QT_BT_DARWIN,
"Timeout while reading a characteristic");
273 [
self peripheral:peripheral didUpdateValueForCharacteristic:cbObject error:nsError];
275 case OperationTimeout::descriptorsDiscovery:
276 qCWarning(QT_BT_DARWIN,
"Timeout in descriptors discovery");
277 [
self peripheral:peripheral didDiscoverDescriptorsForCharacteristic:cbObject error:nsError];
279 case OperationTimeout::descriptorRead:
280 qCWarning(QT_BT_DARWIN,
"Timeout while reading a descriptor");
281 [
self peripheral:peripheral didUpdateValueForDescriptor:cbObject error:nsError];
283 case OperationTimeout::characteristicWrite:
284 qCWarning(QT_BT_DARWIN,
"Timeout while writing a characteristic with response");
285 [
self peripheral:peripheral didWriteValueForCharacteristic:cbObject error:nsError];
300 manager = [[CBCentralManager alloc] initWithDelegate:self queue:leQueue];
305 qCWarning(QT_BT_DARWIN) <<
"failed to allocate a central manager";
310 [
self retrievePeripheralAndConnect];
320 if ([self isConnected]) {
321 qCDebug(QT_BT_DARWIN) <<
"already connected";
328 [
self connectToPeripheral];
337 qCWarning(QT_BT_DARWIN) <<
"failed to allocate identifiers";
345 uuid_t uuidData = {};
346 std::copy(qtUuidData.data, qtUuidData.data + 16, uuidData);
349 qCWarning(QT_BT_DARWIN) <<
"failed to allocate NSUUID identifier";
355 [uuids addObject:nsUuid];
358 NSArray *
const peripherals = [manager retrievePeripheralsWithIdentifiers:uuids];
359 if (!peripherals || peripherals.count != 1) {
360 qCWarning(QT_BT_DARWIN) <<
"failed to retrieve a peripheral";
366 peripheral = [static_cast<CBPeripheral *>([peripherals objectAtIndex:0]) retain];
367 [
self connectToPeripheral];
379 if ([self isConnected]) {
380 qCDebug(QT_BT_DARWIN) <<
"already connected";
384 [
self setMtu:defaultMtu];
385 qCDebug(QT_BT_DARWIN) <<
"trying to connect";
387 [manager connectPeripheral:peripheral options:nil];
396 return peripheral.state == CBPeripheralStateConnected;
399- (
void)disconnectFromDevice
415 if ([self isConnected])
425 [manager cancelPeripheralConnection:peripheral];
429- (
void)discoverServices
444 [
self watchAfter:peripheral timeout:OperationTimeout::serviceDiscovery];
445 [peripheral discoverServices:nil];
470 CBService *
const s = [services objectAtIndex:currentService];
471 [visitedServices addObject:s];
473 [
self watchAfter:s timeout:OperationTimeout::includedServicesDiscovery];
474 [peripheral discoverIncludedServices:nil forService:s];
479 readValues:(
bool) read
492 qCWarning(QT_BT_DARWIN) <<
"already discovering for"
499 if (CBService *
const service = [self serviceForUUID:serviceUuid]) {
500 const auto mode =
read ? DiscoveryMode::FullDiscovery : DiscoveryMode::SkipValueDiscovery;
502 [
self watchAfter:service timeout:OperationTimeout::characteristicsDiscovery];
503 [peripheral discoverCharacteristics:nil forService:service];
507 qCWarning(QT_BT_DARWIN) <<
"unknown service uuid"
514- (
void)readCharacteristics:(CBService *)service
529 return [
self serviceDetailsDiscoveryFinished:service];
531 NSArray *
const cs =
service.characteristics;
532 for (CBCharacteristic *
c in cs) {
533 if (
c.properties & CBCharacteristicPropertyRead) {
534 [
self watchAfter:c timeout:OperationTimeout::characteristicRead];
535 return [peripheral readValueForCharacteristic:c];
540 [
self discoverDescriptors:service];
543- (
void)discoverDescriptors:(CBService *)service
559 [
self serviceDetailsDiscoveryFinished:service];
562 CBCharacteristic *
ch = [service.characteristics objectAtIndex:0];
563 [
self watchAfter:ch timeout:OperationTimeout::descriptorsDiscovery];
564 [peripheral discoverDescriptorsForCharacteristic:ch];
568- (
void)readDescriptors:(CBService *)service
578 NSArray *
const cs =
service.characteristics;
581 for (CBCharacteristic *
c in cs) {
582 if (
c.descriptors &&
c.descriptors.count) {
584 [
self watchAfter:desc timeout:OperationTimeout::descriptorRead];
585 return [peripheral readValueForDescriptor:desc];
590 [
self serviceDetailsDiscoveryFinished:service];
593- (
void)serviceDetailsDiscoveryFinished:(CBService *)service
608 const QLowEnergyHandle maxHandle = std::numeric_limits<QLowEnergyHandle>::max();
611 qCWarning(QT_BT_DARWIN) <<
"can not allocate more handles";
621 qtService->uuid = serviceUuid;
629 NSArray *
const cs =
service.characteristics;
631 if (cs && cs.count) {
634 for (CBCharacteristic *
c in cs) {
641 const int cbProps =
c.properties & 0xff;
642 newChar.
properties =
static_cast<QLowEnergyCharacteristic::PropertyTypes
>(cbProps);
647 NSArray *
const ds =
c.descriptors;
648 if (ds && ds.count) {
650 for (CBDescriptor *
d in ds) {
658 descList[lastValidHandle] = newDesc;
662 [peripheral setNotifyValue:YES forCharacteristic:c];
672 qtService->characteristicList = charList;
689 case LERequest::CharRead:
690 case LERequest::DescRead:
691 return [
self performNextReadRequest];
692 case LERequest::CharWrite:
693 case LERequest::DescWrite:
694 case LERequest::ClientConfiguration:
695 return [
self performNextWriteRequest];
714 if (
request.type == LERequest::CharRead) {
716 qCWarning(QT_BT_DARWIN) <<
"characteristic with handle"
717 <<
request.handle <<
"not found";
718 return [
self performNextRequest];
725 [peripheral readValueForCharacteristic:charMap[request.handle]];
728 qCWarning(QT_BT_DARWIN) <<
"descriptor with handle"
729 <<
request.handle <<
"not found";
730 return [
self performNextRequest];
736 [peripheral readValueForDescriptor:descMap[request.handle]];
749 ||
requests.
head().type == LERequest::ClientConfiguration,
754 if (
request.type == LERequest::DescWrite) {
758 return [
self performNextRequest];
761 CBDescriptor *
const descriptor =
descMap[request.handle];
765 qCWarning(QT_BT_DARWIN) <<
"failed to allocate an NSData object";
766 return [
self performNextRequest];
773 return [peripheral writeValue:data.data() forDescriptor:descriptor];
776 qCWarning(QT_BT_DARWIN) <<
"characteristic with handle:"
777 <<
request.handle <<
"not found";
778 return [
self performNextRequest];
781 CBCharacteristic *
const characteristic =
charMap[request.handle];
783 if (
request.type == LERequest::ClientConfiguration) {
785 CBDescriptor *
const descriptor = [
self descriptor:qtUuid forCharacteristic:characteristic];
787 "configuration descriptor found");
797 [peripheral setNotifyValue:enable forCharacteristic:characteristic];
802 qCWarning(QT_BT_DARWIN) <<
"failed to allocate NSData object";
803 return [
self performNextRequest];
812 [
self watchAfter:characteristic timeout:OperationTimeout::characteristicWrite];
813 [peripheral writeValue:data.data() forCharacteristic:characteristic
814 type:CBCharacteristicWriteWithResponse];
816 [peripheral writeValue:data.data() forCharacteristic:characteristic
817 type:CBCharacteristicWriteWithoutResponse];
818 [
self performNextRequest];
824- (
void)setMtu:(
int)newMtu
837 if (![self isConnected]) {
838 [
self setMtu:defaultMtu];
843 const NSUInteger maxLen = [peripheral maximumWriteValueLengthForType:
844 CBCharacteristicWriteWithoutResponse];
845 if (maxLen > std::numeric_limits<int>::max() - 3)
846 [
self setMtu:defaultMtu];
848 [
self setMtu:int(maxLen) + 3];
856 [peripheral readRSSI];
868 qCWarning(QT_BT_DARWIN) <<
"unknown characteristic handle"
881 if (![self descriptor:qtUuid forCharacteristic:
charMap[charHandle]]) {
882 qCWarning(QT_BT_DARWIN) <<
"no client characteristic configuration found";
891 request.type = LERequest::ClientConfiguration;
896 [
self performNextRequest];
909 qCWarning(QT_BT_DARWIN) <<
"characteristic:" << charHandle <<
"not found";
919 request.type = LERequest::CharRead;
923 [
self performNextRequest];
929 withResponse:(
bool)withResponse
938 qCWarning(QT_BT_DARWIN) <<
"characteristic:" << charHandle <<
"not found";
947 request.type = LERequest::CharWrite;
948 request.withResponse = withResponse;
953 [
self performNextRequest];
964 qCWarning(QT_BT_DARWIN) <<
"handle:" << descHandle <<
"not found";
973 request.type = LERequest::DescRead;
977 [
self performNextRequest];
989 qCWarning(QT_BT_DARWIN) <<
"handle:" << descHandle <<
"not found";
998 request.type = LERequest::DescWrite;
1003 [
self performNextRequest];
1021 CBService *
const s = [toVisit objectAtIndex:i];
1024 if (![visitedNodes containsObject:
s] &&
s.includedServices &&
s.includedServices.
count) {
1025 [visitedNodes addObject:s];
1026 [toVisitNext addObjectsFromArray:s.includedServices];
1030 if (![toVisitNext
count])
1033 toVisit.
swap(toVisitNext);
1034 toVisitNext.reset([[NSMutableArray alloc]
init], RetainPolicy::noInitialRetain);
1040- (CBCharacteristic *)nextCharacteristicForService:(CBService*)service
1041 startingFrom:(CBCharacteristic *)characteristic
1053 NSArray *
const cs =
service.characteristics;
1058 if ([cs objectAtIndex:
index] == characteristic) {
1059 if (
index + 1 == cs.count)
1062 return [cs objectAtIndex:index + 1];
1067 "characteristic was not found in service.characteristics");
1069 return [cs objectAtIndex:1];
1072- (CBCharacteristic *)nextCharacteristicForService:(CBService*)service
1073 startingFrom:(CBCharacteristic *)characteristic
1074 properties:(CBCharacteristicProperties)properties
1086 NSArray *
const cs =
service.characteristics;
1092 if ([cs objectAtIndex:
index] == characteristic) {
1093 if (
index + 1 == cs.count) {
1104 "characteristic not found in service.characteristics");
1109 CBCharacteristic *
const c = [cs objectAtIndex:index];
1117- (CBDescriptor *)nextDescriptorForCharacteristic:(CBCharacteristic *)characteristic
1118 startingFrom:(CBDescriptor *)descriptor
1127 NSArray *
const ds = characteristic.descriptors;
1132 if ([ds objectAtIndex:
index] == descriptor) {
1133 if (
index + 1 == ds.count)
1136 return [ds objectAtIndex:index + 1];
1141 "descriptor was not found in characteristic.descriptors");
1143 return [ds objectAtIndex:1];
1147 forCharacteristic:(CBCharacteristic *)ch
1154 CBDescriptor *descriptor = nil;
1155 NSArray *
const ds =
ch.descriptors;
1156 if (ds && ds.count) {
1157 for (CBDescriptor *
d in ds) {
1168- (bool)cacheWriteValue:(const
QByteArray &)value for:(NSObject *)obj
1172 if ([
obj isKindOfClass:[CBCharacteristic class]]) {
1173 CBCharacteristic *
const ch =
static_cast<CBCharacteristic *
>(
obj);
1175 qCWarning(QT_BT_DARWIN) <<
"unexpected characteristic, no handle found";
1178 }
else if ([
obj isKindOfClass:[CBDescriptor class]]) {
1179 CBDescriptor *
const d =
static_cast<CBDescriptor *
>(
obj);
1181 qCWarning(QT_BT_DARWIN) <<
"unexpected descriptor, no handle found";
1185 qCWarning(QT_BT_DARWIN) <<
"invalid object, characteristic "
1186 "or descriptor required";
1193 qCWarning(QT_BT_DARWIN) <<
"already has a cached value for this "
1194 "object, the value will be replaced";
1212 [
self stopWatchers];
1216- (
void)handleReadWriteError:(NSError *)error
1220 switch (
error.code) {
1233- (
void)centralManagerDidUpdateState:(CBCentralManager *)central
1237#pragma clang diagnostic push
1238#pragma clang diagnostic ignored "-Wunguarded-availability-new"
1240 const auto state = central.state;
1241 if (
state == CBManagerStateUnknown ||
state == CBManagerStateResetting) {
1251 if (
state == CBManagerStateUnsupported ||
state == CBManagerStateUnauthorized) {
1255 if (
state == CBManagerStateUnsupported)
1260 [
self stopWatchers];
1264 if (
state == CBManagerStatePoweredOff) {
1277 [
self stopWatchers];
1281 if (
state == CBManagerStatePoweredOn) {
1284 [
self retrievePeripheralAndConnect];
1291#pragma clang diagnostic pop
1294- (
void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)aPeripheral
1306 [peripheral setDelegate:self];
1313- (
void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)aPeripheral
1314 error:(NSError *)error
1331- (
void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)aPeripheral
1332 error:(NSError *)error
1342 qCWarning(QT_BT_DARWIN) <<
"failed to disconnect";
1354- (
void)
peripheral:(CBPeripheral *)aPeripheral didDiscoverServices:(NSError *)error
1370 [
self stopWatchingAfter:aPeripheral operation:OperationTimeout::serviceDiscovery];
1383 [
self discoverIncludedServices];
1387 didModifyServices:(NSArray<CBService *> *)invalidatedServices
1392 qCWarning(QT_BT_DARWIN) <<
"The peripheral has modified its services.";
1411- (
void)
peripheral:(CBPeripheral *)aPeripheral didDiscoverIncludedServicesForService:(CBService *)service
1412 error:(NSError *)error
1430 [
self stopWatchingAfter:service operation:OperationTimeout::includedServicesDiscovery];
1434 NSLog(
@"%s: finished with error %@ for service %@",
1436 }
else if (
service.includedServices &&
service.includedServices.count) {
1441 [servicesToVisitNext addObjectsFromArray:service.includedServices];
1448 CBService *
const s = [servicesToVisit objectAtIndex:currentService];
1451 [visitedServices addObject:s];
1453 [
self watchAfter:s timeout:OperationTimeout::includedServicesDiscovery];
1454 return [peripheral discoverIncludedServices:nil forService:s];
1466 CBService *
const s = [servicesToVisit objectAtIndex:currentService];
1468 [visitedServices addObject:s];
1470 [
self watchAfter:s timeout:OperationTimeout::includedServicesDiscovery];
1471 return [peripheral discoverIncludedServices:nil forService:s];
1487- (
void)
peripheral:(CBPeripheral *)aPeripheral didDiscoverCharacteristicsForService:(CBService *)service
1488 error:(NSError *)error
1506 [
self stopWatchingAfter:service operation:OperationTimeout::characteristicsDiscovery];
1521 [
self serviceDetailsDiscoveryFinished:service];
1524 [
self readCharacteristics:service];
1528 didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic
1529 error:(NSError *)error
1540 const bool readMatch = [
self objectIsUnderWatch:characteristic operation:OperationTimeout::characteristicRead];
1542 [
self stopWatchingAfter:characteristic operation:OperationTimeout::characteristicRead];
1549 CBService *
const service = characteristic.service;
1556 if (!isDetailsDiscovery) {
1561 [
self handleReadWriteError:error];
1562 [
self performNextRequest];
1568 if (isDetailsDiscovery) {
1571 CBCharacteristic *
const next = [
self nextCharacteristicForService:characteristic.service
1572 startingFrom:characteristic properties:CBCharacteristicPropertyRead];
1574 [
self watchAfter:next timeout:OperationTimeout::characteristicRead];
1575 [peripheral readValueForCharacteristic:next];
1577 [
self discoverDescriptors:characteristic.service];
1588 qCCritical(QT_BT_DARWIN) <<
"unexpected update notification, "
1589 "no characteristic handle found";
1600 [
self performNextRequest];
1608 didDiscoverDescriptorsForCharacteristic:(CBCharacteristic *)characteristic
1609 error:(NSError *)error
1627 [
self stopWatchingAfter:characteristic operation:OperationTimeout::descriptorsDiscovery];
1635 CBCharacteristic *
const next = [
self nextCharacteristicForService:characteristic.service
1636 startingFrom:characteristic];
1638 [
self watchAfter:next timeout:OperationTimeout::descriptorsDiscovery];
1639 [peripheral discoverDescriptorsForCharacteristic:next];
1641 [
self readDescriptors:characteristic.service];
1646 didUpdateValueForDescriptor:(CBDescriptor *)descriptor
1647 error:(NSError *)error
1665 [
self stopWatchingAfter:descriptor operation:OperationTimeout::descriptorRead];
1667 CBService *
const service = descriptor.characteristic.service;
1675 if (!isDetailsDiscovery) {
1680 [
self handleReadWriteError:error];
1681 [
self performNextRequest];
1687 if (isDetailsDiscovery) {
1689 CBDescriptor *
const next = [
self nextDescriptorForCharacteristic:descriptor.characteristic
1690 startingFrom:descriptor];
1692 [
self watchAfter:next timeout:OperationTimeout::descriptorRead];
1693 [peripheral readValueForDescriptor:next];
1698 CBCharacteristic *
const ch = descriptor.characteristic;
1699 CBCharacteristic *nextCh = [
self nextCharacteristicForService:ch.service
1702 if (nextCh.descriptors && nextCh.descriptors.count) {
1703 CBDescriptor *
desc = [nextCh.descriptors objectAtIndex:0];
1704 [
self watchAfter:desc timeout:OperationTimeout::descriptorRead];
1705 return [peripheral readValueForDescriptor:desc];
1708 nextCh = [
self nextCharacteristicForService:ch.service
1709 startingFrom:nextCh];
1712 [
self serviceDetailsDiscoveryFinished:service];
1716 qCCritical(QT_BT_DARWIN) <<
"unexpected value update notification, "
1717 "no descriptor handle found";
1725 [
self performNextRequest];
1731 didWriteValueForCharacteristic:(CBCharacteristic *)characteristic
1732 error:(NSError *)error
1756 [
self stopWatchingAfter:characteristic operation:OperationTimeout::characteristicWrite];
1762 qCWarning(QT_BT_DARWIN) <<
"no updated value found "
1763 "for characteristic";
1770 [
self handleReadWriteError:error];
1776 [
self performNextRequest];
1780 didWriteValueForDescriptor:(CBDescriptor *)descriptor
1781 error:(NSError *)error
1799 qCWarning(QT_BT_DARWIN) <<
"no updated value found";
1805 [
self handleReadWriteError:error];
1812 [
self performNextRequest];
1816 didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic
1817 error:(NSError *)error
1831 CBDescriptor *
const descriptor = [
self descriptor:qtUuid forCharacteristic:characteristic];
1840 }
else if (nRemoved) {
1845 [
self performNextRequest];
1848- (
void)
peripheral:(CBPeripheral *)aPeripheral didReadRSSI:(NSNumber *)RSSI error:(nullable NSError *)error
1856 NSLog(
@"Reading RSSI finished with error: %@",
error);
1861 qCWarning(QT_BT_DARWIN,
"Reading RSSI returned no value");
1876 [
self stopWatchers];
1877 [
self disconnectFromDevice];
QBluetoothUuid deviceUuid
DarwinBluetooth::ObjCStrongReference< NSMutableArray > servicesToVisit
DarwinBluetooth::ServiceHash serviceMap
DarwinBluetooth::ObjCStrongReference< NSMutableSet > visitedServices
DarwinBluetooth::CharHash charMap
QLowEnergyHandle currentReadHandle
CBPeripheral * peripheral
QLowEnergyHandle lastValidHandle
DarwinBluetooth::RequestQueue requests
DarwinBluetooth::CentralManagerState managerState
DarwinBluetooth::LECBManagerNotifier * notifier
std::vector< DarwinBluetooth::GCDTimer > timeoutWatchdogs
DarwinBluetooth::ValueHash valuesToWrite
QMap< QBluetoothUuid, DiscoveryMode > servicesToDiscoverDetails
NSUInteger currentService
DarwinBluetooth::DescHash descMap
DarwinBluetooth::ObjCStrongReference< NSMutableArray > servicesToVisitNext
std::vector< ObjCStrongReference< CBMutableService > > services
#define QT_BT_MAC_AUTORELEASEPOOL
void performNextRequest()
void performNextReadRequest()
void performNextWriteRequest()
void discoverIncludedServices()
void retrievePeripheralAndConnect()
void connectToPeripheral()
void characteristicUpdated(QLowEnergyHandle charHandle, const QByteArray &value)
void rssiUpdated(qint16 newValue)
void serviceDetailsDiscoveryFinished(QSharedPointer< QLowEnergyServicePrivate > service)
void servicesWereModified()
void characteristicRead(QLowEnergyHandle charHandle, const QByteArray &value)
void descriptorRead(QLowEnergyHandle descHandle, const QByteArray &value)
void mtuChanged(int newValue)
void characteristicWritten(QLowEnergyHandle charHandle, const QByteArray &value)
void CBManagerError(QBluetoothDeviceDiscoveryAgent::Error error)
void serviceDiscoveryFinished()
void descriptorWritten(QLowEnergyHandle descHandle, const QByteArray &value)
void swap(StrongReference &other) noexcept
@ ClientCharacteristicConfiguration
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
bool remove(const Key &key)
Removes the item that has the key from the hash.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
Key key(const T &value) const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
qsizetype size() const noexcept
@ UnknownRemoteDeviceError
@ InvalidBluetoothAdapterError
@ MissingPermissionsError
DiscoveryMode
This enum lists service discovery modes.
@ CharacteristicWriteError
@ CharacteristicReadError
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void deleteLater()
\threadsafe
void enqueue(const T &t)
Adds value t to the tail of the queue.
T & head()
Returns a reference to the queue's head item.
T dequeue()
Removes the head item in the queue and returns it.
Id128Bytes toBytes(QSysInfo::Endian order=QSysInfo::BigEndian) const noexcept
bool isNull() const noexcept
Returns true if this is the null UUID {00000000-0000-0000-0000-000000000000}; otherwise returns false...
for(qsizetype i=0;i< list.size();++i)
ObjCStrongReference< NSError > qt_timeoutNSError(OperationTimeout type)
bool equal_uuids(const QBluetoothUuid &qtUuid, CBUUID *cbUuid)
@ CentralManagerDisconnecting
@ CentralManagerConnecting
@ CentralManagerDiscovering
auto qt_find_watchdog(const std::vector< GCDTimer > &watchdogs, id object, OperationTimeout type)
QByteArray qt_bytearray(NSData *data)
QBluetoothUuid qt_uuid(NSUUID *nsUuid)
@ includedServicesDiscovery
@ characteristicsDiscovery
ObjCStrongReference< DarwinBTGCDTimer > GCDTimer
NSUInteger qt_countGATTEntries(CBService *service)
ObjCStrongReference< NSData > data_from_bytearray(const QByteArray &qtData)
dispatch_queue_t qt_LE_queue()
Combined button and popup list for selecting options.
Q_CORE_EXPORT QtJniTypes::Service service()
static const QCssKnownValue properties[NumProperties - 1]
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qCCritical(category,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
GLenum GLenum GLsizei count
GLbitfield GLuint64 timeout
[4]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_ASSERT_X(cond, x, msg)
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
ReturnedValue read(const char *data)
QFutureWatcher< int > watcher
gzip write("uncompressed data")
QNetworkAccessManager manager
QNetworkRequest request(url)
QHash< QLowEnergyHandle, DescData > descriptorList
QLowEnergyHandle valueHandle
QLowEnergyCharacteristic::PropertyTypes properties