22 const
QString &adapterPathWithPeripheralSupport)
24 adapterPathWithPeripheralSupport(adapterPathWithPeripheralSupport)
31 qCWarning(QT_BT_BLUEZ) <<
"Low Energy Controller is not Unconnected when deleted."
32 <<
"Deleted in state:" <<
state;
45 &QLowEnergyControllerPrivateBluezDBus::handlePeripheralApplicationError);
48 &QLowEnergyControllerPrivateBluezDBus::handlePeripheralApplicationRegistered);
52 &QLowEnergyControllerPrivateBluezDBus::handlePeripheralCharacteristicValueUpdate);
56 &QLowEnergyControllerPrivateBluezDBus::handlePeripheralDescriptorValueUpdate);
58 peripheralConnectionManager =
63 peripheralConnectionManager,
68 &QLowEnergyControllerPrivateBluezDBus::handlePeripheralConnectivityChanged);
72 &QLowEnergyControllerPrivateBluezDBus::handlePeripheralRemoteDeviceChanged);
76void QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged(
81 qCDebug(QT_BT_BLUEZ) <<
"######" <<
interface << changedProperties;
90 pendingConnect =
false;
91 disconnectSignalRequired =
true;
112 executeClose(newError);
126 for (
const QString &uuidString : newUuidStringList)
131 qCDebug(QT_BT_BLUEZ) << __func__ <<
"Service" << uuid <<
"has been removed";
133 service->setController(
nullptr);
134 dbusServices.
remove(uuid);
140 qCDebug(QT_BT_BLUEZ) <<
"######" <<
interface << changedProperties;
146 || !dbusServices[uuid].hasBatteryService
147 || dbusServices[uuid].batteryInterface.isNull())
155 iter = serviceData->characteristicList.begin();
156 while (
iter != serviceData->characteristicList.end()) {
157 auto &charData =
iter.value();
162 bool cccActive =
false;
173 const QByteArray newValue(1,
char(dbusServices[uuid].batteryInterface->percentage()));
174 qCDebug(QT_BT_BLUEZ) <<
"Battery1 char update" << cccActive
175 << charData.value.toHex() <<
"->" << newValue.toHex();
176 if (cccActive && newValue != charData.value) {
177 qCDebug(QT_BT_BLUEZ) <<
"Property update for Battery1";
178 charData.value = newValue;
180 emit serviceData->characteristicChanged(
ch, newValue);
189void QLowEnergyControllerPrivateBluezDBus::characteristicPropertiesChanged(
215 emit service->characteristicChanged(changedChar, newValue);
218void QLowEnergyControllerPrivateBluezDBus::interfacesRemoved(
const QDBusObjectPath &objectPath,
223 qCWarning(QT_BT_BLUEZ) <<
"DBus Device1 was removed";
226 qCDebug(QT_BT_BLUEZ) <<
"DBus interfaces" << interfaces <<
"were removed from"
227 << objectPath.
path();
229 }
else if (objectPath.
path() == adapter->
path()) {
230 qCWarning(QT_BT_BLUEZ) <<
"DBus Adapter was removed";
235void QLowEnergyControllerPrivateBluezDBus::resetController()
239 managerBluez =
nullptr;
259 advertiser =
nullptr;
262 if (peripheralApplication)
263 peripheralApplication->
reset();
265 if (peripheralConnectionManager)
266 peripheralConnectionManager->
reset();
271 dbusServices.
clear();
275 pendingConnect = disconnectSignalRequired =
false;
279void QLowEnergyControllerPrivateBluezDBus::connectToDeviceHelper()
286 qCWarning(QT_BT_BLUEZ) <<
"Cannot find suitable bluetooth adapter";
291 auto manager = std::make_unique<OrgFreedesktopDBusObjectManagerInterface>(
295 reply.waitForFinished();
296 if (
reply.isError()) {
297 qCWarning(QT_BT_BLUEZ) <<
"Cannot enumerate Bluetooth devices for GATT connect";
315 if (qvariant_cast<QDBusObjectPath>(adapterForCurrentDevice).path() == hostAdapterPath) {
316 devicePath =
it.key().path();
328 qCDebug(QT_BT_BLUEZ) <<
"Cannot find targeted remote device. "
329 "Re-running device discovery might help";
334 managerBluez =
manager.release();
336 this, &QLowEnergyControllerPrivateBluezDBus::interfacesRemoved);
347 this, &QLowEnergyControllerPrivateBluezDBus::devicePropertiesChanged);
352 qCDebug(QT_BT_BLUEZ) <<
"QLowEnergyControllerPrivateBluezDBus::connectToDevice()";
354 connectToDeviceHelper();
360 qCWarning(QT_BT_BLUEZ) <<
"Error: Local adapter is powered off";
369 if (
device->connected() &&
device->servicesResolved()) {
371 disconnectSignalRequired =
true;
379 pendingConnect =
true;
386 if (
reply.isError()) {
387 qCDebug(QT_BT_BLUEZ) <<
"BTLE_DBUS::connect() failed"
388 << reply.reply().errorName()
389 << reply.reply().errorMessage();
390 executeClose(QLowEnergyController::UnknownError);
409 if (
reply.isError()) {
410 qCDebug(QT_BT_BLUEZ) <<
"BTLE_DBUS::disconnect() failed"
411 << reply.reply().errorName()
412 << reply.reply().errorMessage();
413 executeClose(QLowEnergyController::UnknownError);
415 executeClose(QLowEnergyController::NoError);
426 if (emitDisconnected)
427 emit q->disconnected();
434 reply.waitForFinished();
435 if (
reply.isError()) {
436 qCWarning(QT_BT_BLUEZ) <<
"Cannot discover services";
444 auto setupServicePrivate = [&,
q](
446 const QString &
path,
const bool battery1Interface =
false){
450 priv->setController(
this);
452 GattService serviceContainer;
453 serviceContainer.servicePath =
path;
455 if (battery1Interface) {
456 qCDebug(QT_BT_BLUEZ) <<
"Using Battery1 interface to emulate generic interface";
457 serviceContainer.hasBatteryService =
true;
461 dbusServices.
insert(
priv->uuid, serviceContainer);
485 bool gattBatteryService{
false};
491 if (!
it.key().path().startsWith(
device->path()))
494 if (
it.key().path() ==
device->path()) {
497 const QString &iface = battIter.key();
499 qCDebug(QT_BT_BLUEZ) <<
"Dedicated Battery1 service available";
500 batteryServicePath =
it.key().path();
503 for (
auto const& uuid :
507 qCDebug(QT_BT_BLUEZ) <<
"Battery service listed as available service";
508 batteryServicePath =
it.key().path();
517 if (!
it.key().path().startsWith(servicePathPrefix))
521 const QString &iface = jt.key();
529 qCDebug(QT_BT_BLUEZ) <<
"Using battery service via GattService1 interface";
530 gattBatteryService =
true;
532 setupServicePrivate(service->primary()
540 if (!gattBatteryService && !batteryServicePath.
isEmpty()) {
543 batteryServicePath,
true);
547 emit q->discoveryFinished();
550void QLowEnergyControllerPrivateBluezDBus::discoverBatteryServiceDetails(
560 dbusData.batteryInterface = batteryService;
562 serviceData->startHandle = runningHandle++;
582 descriptorHandle = runningHandle++;
590 descriptorHandle = runningHandle++;
595 serviceData->characteristicList[indexHandle] = charData;
596 serviceData->endHandle = runningHandle++;
603 const bool emitDisconnect = disconnectSignalRequired;
610 if (emitDisconnect) {
612 emit q->disconnected();
620 qCWarning(QT_BT_BLUEZ) <<
"Discovery of unknown service" << service.toString()
627 serviceData->characteristicList.
clear();
629 GattService &dbusData = dbusServices[service];
630 dbusData.characteristics.
clear();
632 if (dbusData.hasBatteryService) {
633 qCDebug(QT_BT_BLUEZ) <<
"Triggering Battery1 service discovery on " << dbusData.servicePath;
634 discoverBatteryServiceDetails(dbusData, serviceData);
639 reply.waitForFinished();
640 if (
reply.isError()) {
641 qCWarning(QT_BT_BLUEZ) <<
"Cannot discover services";
651 if (!
it.key().path().startsWith(dbusData.servicePath))
655 const QString &iface = jt.key();
660 GattCharacteristic dbusCharData;
661 dbusCharData.characteristic = charInterface;
662 dbusData.characteristics.append(dbusCharData);
663 }
else if (iface ==
QStringLiteral(
"org.bluez.GattDescriptor1")) {
668 for (GattCharacteristic &dbusCharData : dbusData.characteristics) {
669 if (!descInterface->path().startsWith(
670 dbusCharData.characteristic->path()))
674 dbusCharData.descriptors.append(descInterface);
680 qCWarning(QT_BT_BLUEZ) <<
"Descriptor discovery error";
686 serviceData->startHandle = runningHandle++;
687 for (GattCharacteristic &dbusChar : dbusData.characteristics) {
723 job.flags = GattJob::JobFlags({GattJob::CharRead, GattJob::ServiceDiscovery});
724 job.service = serviceData;
725 job.handle = indexHandle;
730 for (
const auto &descEntry : std::as_const(dbusChar.descriptors)) {
742 dbusChar.characteristic->path(),
748 characteristicPropertiesChanged(indexHandle, interface,
749 changedProperties, removedProperties);
756 job.flags = GattJob::JobFlags({ GattJob::DescRead, GattJob::ServiceDiscovery });
757 job.service = serviceData;
758 job.handle = descriptorHandle;
763 serviceData->characteristicList[indexHandle] = charData;
766 serviceData->endHandle = runningHandle++;
770 GattJob &lastJob = jobs.
last();
771 lastJob.flags.setFlag(GattJob::LastServiceDiscovery,
true);
779void QLowEnergyControllerPrivateBluezDBus::prepareNextJob()
789 if (!jobPending || jobs.
isEmpty()) {
791 qCWarning(QT_BT_BLUEZ) <<
"Aborting onCharReadFinished due to disconnect";
797 Q_ASSERT(nextJob.flags.testFlag(GattJob::CharRead));
801 qCWarning(QT_BT_BLUEZ) <<
"onCharReadFinished: Invalid GATT job. Skipping.";
807 service->characteristicList.value(nextJob.handle);
809 bool isServiceDiscovery = nextJob.flags.testFlag(GattJob::ServiceDiscovery);
811 if (
reply.isError()) {
812 qCWarning(QT_BT_BLUEZ) <<
"Cannot initiate reading of" << charData.
uuid
813 <<
"of service" <<
service->uuid
815 if (!isServiceDiscovery)
818 qCDebug(QT_BT_BLUEZ) <<
"Read Char:" << charData.
uuid <<
reply.value().toHex();
822 if (isServiceDiscovery) {
823 if (nextJob.flags.testFlag(GattJob::LastServiceDiscovery))
837 if (!jobPending || jobs.
isEmpty()) {
839 qCWarning(QT_BT_BLUEZ) <<
"Aborting onDescReadFinished due to disconnect";
845 Q_ASSERT(nextJob.flags.testFlag(GattJob::DescRead));
849 qCWarning(QT_BT_BLUEZ) <<
"onDescReadFinished: Invalid GATT job. Skipping.";
857 qCWarning(QT_BT_BLUEZ) <<
"Cannot find char for desc read (onDescReadFinished 1).";
864 service->characteristicList.value(
ch.attributeHandle());
867 qCWarning(QT_BT_BLUEZ) <<
"Cannot find descriptor (onDescReadFinished 2).";
873 bool isServiceDiscovery = nextJob.flags.testFlag(GattJob::ServiceDiscovery);
876 if (
reply.isError()) {
877 qCWarning(QT_BT_BLUEZ) <<
"Cannot read descriptor (onDescReadFinished 3): "
881 if (!isServiceDiscovery)
887 if (isServiceDiscovery) {
888 if (nextJob.flags.testFlag(GattJob::LastServiceDiscovery))
902 if (!jobPending || jobs.
isEmpty()) {
904 qCWarning(QT_BT_BLUEZ) <<
"Aborting onCharWriteFinished due to disconnect";
910 Q_ASSERT(nextJob.flags.testFlag(GattJob::CharWrite));
914 qCWarning(QT_BT_BLUEZ) <<
"onCharWriteFinished: Invalid GATT job. Skipping.";
921 service->characteristicList.value(nextJob.handle);
924 if (
reply.isError()) {
925 qCWarning(QT_BT_BLUEZ) <<
"Cannot initiate writing of" << charData.
uuid
926 <<
"of service" <<
service->uuid
936 qCDebug(QT_BT_BLUEZ) <<
"Written Char:" << charData.
uuid << nextJob.value.toHex();
947 if (!jobPending || jobs.
isEmpty()) {
949 qCWarning(QT_BT_BLUEZ) <<
"Aborting onDescWriteFinished due to disconnect";
955 Q_ASSERT(nextJob.flags.testFlag(GattJob::DescWrite));
959 qCWarning(QT_BT_BLUEZ) <<
"onDescWriteFinished: Invalid GATT job. Skipping.";
968 qCWarning(QT_BT_BLUEZ) <<
"onDescWriteFinished: Cannot find associated char/desc: "
976 if (
reply.isError()) {
977 qCWarning(QT_BT_BLUEZ) <<
"Cannot initiate writing of" << descriptor.
uuid()
978 <<
"of char" << associatedChar.
uuid()
979 <<
"of service" <<
service->uuid
983 qCDebug(QT_BT_BLUEZ) <<
"Write Desc:" << descriptor.
uuid() << nextJob.value.toHex();
985 nextJob.value,
false);
986 emit service->descriptorWritten(descriptor, nextJob.value);
993void QLowEnergyControllerPrivateBluezDBus::scheduleNextJob()
995 if (jobPending || jobs.
isEmpty())
1003 qCWarning(QT_BT_BLUEZ) <<
"Invalid GATT job (scheduleNextJob). Skipping.";
1008 const GattService &dbusServiceData = dbusServices[
service->uuid];
1010 if (nextJob.flags.testFlag(GattJob::CharRead)) {
1012 if (!
service->characteristicList.contains(nextJob.handle)) {
1013 qCWarning(QT_BT_BLUEZ) <<
"Invalid Char handle when reading. Skipping.";
1019 service->characteristicList.value(nextJob.handle);
1020 bool foundChar =
false;
1021 for (
const auto &gattChar :
std::as_const(dbusServiceData.characteristics)) {
1028 this, &QLowEnergyControllerPrivateBluezDBus::onCharReadFinished);
1035 qCWarning(QT_BT_BLUEZ) <<
"Cannot find char for reading. Skipping.";
1039 }
else if (nextJob.flags.testFlag(GattJob::CharWrite)) {
1041 if (!
service->characteristicList.contains(nextJob.handle)) {
1042 qCWarning(QT_BT_BLUEZ) <<
"Invalid Char handle when writing. Skipping.";
1048 service->characteristicList.value(nextJob.handle);
1049 bool foundChar =
false;
1050 for (
const auto &gattChar :
std::as_const(dbusServiceData.characteristics)) {
1062 this, &QLowEnergyControllerPrivateBluezDBus::onCharWriteFinished);
1069 qCWarning(QT_BT_BLUEZ) <<
"Cannot find char for writing. Skipping.";
1073 }
else if (nextJob.flags.testFlag(GattJob::DescRead)) {
1076 if (!
ch.isValid()) {
1077 qCWarning(QT_BT_BLUEZ) <<
"Invalid GATT job (scheduleReadDesc 1). Skipping.";
1083 service->characteristicList.value(
ch.attributeHandle());
1085 qCWarning(QT_BT_BLUEZ) <<
"Invalid GATT job (scheduleReadDesc 2). Skipping.";
1091 bool foundDesc =
false;
1092 for (
const auto &gattChar :
std::as_const(dbusServiceData.characteristics)) {
1096 for (
const auto &gattDesc :
std::as_const(gattChar.descriptors)) {
1103 this, &QLowEnergyControllerPrivateBluezDBus::onDescReadFinished);
1113 qCWarning(QT_BT_BLUEZ) <<
"Cannot find descriptor for reading. Skipping.";
1117 }
else if (nextJob.flags.testFlag(GattJob::DescWrite)) {
1120 if (!
ch.isValid()) {
1121 qCWarning(QT_BT_BLUEZ) <<
"Invalid GATT job (scheduleWriteDesc 1). Skipping.";
1127 service->characteristicList.value(
ch.attributeHandle());
1129 qCWarning(QT_BT_BLUEZ) <<
"Invalid GATT job (scheduleWriteDesc 2). Skipping.";
1135 bool foundDesc =
false;
1136 for (
const auto &gattChar :
std::as_const(dbusServiceData.characteristics)) {
1140 for (
const auto &gattDesc :
std::as_const(gattChar.descriptors)) {
1150 qCDebug(QT_BT_BLUEZ) <<
"Init CCC change to" <<
value.toHex()
1153 reply = gattChar.characteristic->StartNotify();
1155 reply = gattChar.characteristic->StopNotify();
1158 this, &QLowEnergyControllerPrivateBluezDBus::onDescWriteFinished);
1163 this, &QLowEnergyControllerPrivateBluezDBus::onDescWriteFinished);
1176 qCWarning(QT_BT_BLUEZ) <<
"Cannot find descriptor for writing. Skipping.";
1181 qCWarning(QT_BT_BLUEZ) <<
"Unknown gatt job type. Skipping.";
1191 if (!service->characteristicList.contains(charHandle)) {
1192 qCWarning(QT_BT_BLUEZ) <<
"Read characteristic does not belong to service"
1198 = service->characteristicList[charHandle];
1203 qCWarning(QT_BT_BLUEZ) <<
"Reading non-readable char" << charHandle;
1206 const GattService &gattService = dbusServices[service->uuid];
1207 if (gattService.hasBatteryService && !gattService.batteryInterface.isNull()) {
1209 const QByteArray newValue(1,
char(gattService.batteryInterface->percentage()));
1213 emit service->characteristicRead(
ch, newValue);
1221 job.flags = GattJob::JobFlags({GattJob::CharRead});
1222 job.service = service;
1223 job.handle = charHandle;
1235 if (!service->characteristicList.contains(charHandle))
1239 = service->characteristicList[charHandle];
1243 const GattService &gattService = dbusServices[service->uuid];
1244 if (gattService.hasBatteryService && !gattService.batteryInterface.isNull()) {
1247 emit service->descriptorRead(descriptor, descriptor.
value());
1255 job.flags = GattJob::JobFlags({GattJob::DescRead});
1256 job.service = service;
1257 job.handle = descriptorHandle;
1270 if (!service->characteristicList.contains(charHandle)) {
1271 qCWarning(QT_BT_BLUEZ) <<
"Write characteristic does not belong to service"
1277 const GattService &gattService = dbusServices[service->uuid];
1278 if (gattService.hasBatteryService && !gattService.batteryInterface.isNull()) {
1286 job.flags = GattJob::JobFlags({GattJob::CharWrite});
1287 job.service = service;
1288 job.handle = charHandle;
1289 job.value = newValue;
1290 job.writeMode = writeMode;
1298 qCWarning(QT_BT_BLUEZ) <<
"Characteristic write failed"
1304 charData.
value = newValue;
1315 if (!service->characteristicList.contains(charHandle))
1319 const GattService &gattService = dbusServices[service->uuid];
1320 if (gattService.hasBatteryService && !gattService.batteryInterface.isNull()) {
1331 emit service->descriptorWritten(descriptor, newValue);
1344 job.flags = GattJob::JobFlags({GattJob::DescWrite});
1345 job.service = service;
1346 job.handle = descriptorHandle;
1347 job.value = newValue;
1357 qCWarning(QT_BT_BLUEZ) <<
"CCCD write not supported in peripheral role";
1361 qCWarning(QT_BT_BLUEZ) <<
"Descriptor write failed" <<
desc.uuid();
1365 service->characteristicList[charHandle].descriptorList[descriptorHandle].value = newValue;
1384 advertiser =
nullptr;
1387 adapterPathWithPeripheralSupport,
this);
1389 this, &QLowEnergyControllerPrivateBluezDBus::handleAdvertisingError);
1410 advertiser =
nullptr;
1414void QLowEnergyControllerPrivateBluezDBus::handlePeripheralApplicationRegistered()
1425void QLowEnergyControllerPrivateBluezDBus::handlePeripheralCharacteristicValueUpdate(
1429 if (characteristic.d_ptr
1431 emit characteristic.d_ptr->characteristicChanged(characteristic,
value);
1433 qCWarning(QT_BT_BLUEZ) <<
"Remote characteristic write failed";
1437void QLowEnergyControllerPrivateBluezDBus::handlePeripheralDescriptorValueUpdate(
1444 characteristicHandle, descriptorHandle,
value,
false) ==
value.size()) {
1447 qCWarning(QT_BT_BLUEZ) <<
"Remote descriptor write failed";
1451void QLowEnergyControllerPrivateBluezDBus::handlePeripheralRemoteDeviceChanged(
1461void QLowEnergyControllerPrivateBluezDBus::handleAdvertisingError()
1464 qCWarning(QT_BT_BLUEZ) <<
"An advertising error occurred";
1470void QLowEnergyControllerPrivateBluezDBus::handlePeripheralApplicationError()
1472 qCWarning(QT_BT_BLUEZ) <<
"A Bluez peripheral application error occurred";
1477void QLowEnergyControllerPrivateBluezDBus::handlePeripheralConnectivityChanged(
bool connected)
1480 qCDebug(QT_BT_BLUEZ) <<
"Peripheral application connected change to:" <<
connected;
1487 emit q->disconnected();
1494 qCWarning(QT_BT_BLUEZ) <<
"Connection udpate requests not supported on Bluez DBus";
1503 if (servicePrivate.
isNull())
1505 peripheralApplication->
addService(serviceData, servicePrivate, startHandle);
1516#include "moc_qlowenergycontroller_bluezdbus_p.cpp"
QString findAdapterForAddress(const QBluetoothAddress &wantedAddress, bool *ok=nullptr)
IOBluetoothDevice * device
QDBusPendingReply< ManagedObjectList > GetManagedObjects()
void InterfacesRemoved(const QDBusObjectPath &object_path, const QStringList &interfaces)
void PropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QStringList &invalidated_properties, const QDBusMessage &msg)
@ CharacteristicPresentationFormat
@ ClientCharacteristicConfiguration
static QByteArray fromHex(const QByteArray &hexEncoded)
Returns a decoded copy of the hex encoded array hexEncoded.
QString path() const
Returns the object path that this interface is associated with.
static QDBusConnection systemBus()
Returns a QDBusConnection object opened with the system bus.
QString path() const
Returns this object path.
void finished(QDBusPendingCallWatcher *self=nullptr)
This signal is emitted when the pending call has finished and its reply is available.
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.
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool isEmpty() const noexcept
const T & constFirst() const noexcept
void append(parameter_type t)
The QLowEnergyAdvertisingData class represents the data to be broadcast during Bluetooth Low Energy a...
The QLowEnergyAdvertisingParameters class represents the parameters used for Bluetooth Low Energy adv...
QLowEnergyCharacteristic::PropertyTypes properties() const
Returns the properties of the characteristic.
QBluetoothUuid uuid() const
Returns the UUID of the characteristic if \l isValid() returns true; otherwise a \l {QUuid::isNull()}...
QLowEnergyDescriptor descriptor(const QBluetoothUuid &uuid) const
Returns the descriptor for uuid or an invalid \l QLowEnergyDescriptor instance.
bool isValid() const
Returns true if the QLowEnergyCharacteristic object is valid, otherwise returns false.
The QLowEnergyConnectionParameters class is used when requesting or reporting an update of the parame...
void requestConnectionUpdate(const QLowEnergyConnectionParameters ¶ms) override
void startAdvertising(const QLowEnergyAdvertisingParameters ¶ms, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData) override
void discoverServiceDetails(const QBluetoothUuid &service, QLowEnergyService::DiscoveryMode mode) override
void discoverServices() override
~QLowEnergyControllerPrivateBluezDBus() override
void addToGenericAttributeList(const QLowEnergyServiceData &service, QLowEnergyHandle startHandle) override
void writeCharacteristic(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QByteArray &newValue, QLowEnergyService::WriteMode writeMode) override
void writeDescriptor(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle, const QByteArray &newValue) override
void disconnectFromDevice() override
void readDescriptor(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle) override
void readCharacteristic(const QSharedPointer< QLowEnergyServicePrivate > service, const QLowEnergyHandle charHandle) override
void stopAdvertising() override
void connectToDevice() override
QLowEnergyCharacteristic characteristicForHandle(QLowEnergyHandle handle)
Returns a valid characteristic if the given handle is the handle of the characteristic itself or one ...
QSharedPointer< QLowEnergyServicePrivate > serviceForHandle(QLowEnergyHandle handle)
void invalidateServices()
quint16 updateValueOfDescriptor(QLowEnergyHandle charHandle, QLowEnergyHandle descriptorHandle, const QByteArray &value, bool appendValue)
Returns the length of the updated descriptor value.
QLowEnergyDescriptor descriptorForHandle(QLowEnergyHandle handle)
Returns a valid descriptor if handle belongs to a descriptor; otherwise an invalid one.
ServiceDataMap serviceList
QLowEnergyController::Error error
void setError(QLowEnergyController::Error newError)
QLowEnergyController::Role role
quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle, const QByteArray &value, bool appendValue)
Returns the length of the updated characteristic value.
QBluetoothAddress localAdapter
QLowEnergyController::ControllerState state
QBluetoothAddress remoteDevice
void setState(QLowEnergyController::ControllerState newState)
Error
Indicates all possible error conditions found during the controller's existence.
@ UnknownRemoteDeviceError
@ InvalidBluetoothAdapterError
QBluetoothUuid uuid() const
Returns the UUID of this descriptor if \l isValid() returns true; otherwise a \l {QUuid::isNull()}{nu...
QByteArray value() const
Returns the cached value of the descriptor.
bool isValid() const
Returns true if the QLowEnergyDescriptor object is valid, otherwise returns false.
The QLowEnergyServiceData class is used to set up GATT service data. \inmodule QtBluetooth.
void descriptorWritten(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue)
DiscoveryMode
This enum lists service discovery modes.
@ CharacteristicWriteError
@ CharacteristicReadError
@ RemoteServiceDiscovered
WriteMode
This enum describes the mode to be used when writing a characteristic value.
ServiceType
This enum describes the type of the service.
T value(const Key &key, const T &defaultValue=T()) const
bool contains(const Key &key) const
const_iterator constBegin() const
const_iterator constEnd() const
NetworkError error() const
Returns the error that was found during the processing of this request.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void deleteLater()
\threadsafe
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
static QSharedPointer create(Args &&...arguments)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void clear()
Clears this QSharedPointer object, dropping the reference that it may have had to the pointer.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
bool localDescriptorWrite(QLowEnergyHandle handle, const QByteArray &value)
void unregisterApplication()
void remoteDeviceAccessEvent(const QString &remoteDeviceObjectPath, quint16 mtu)
void registerApplication()
void addService(const QLowEnergyServiceData &serviceData, QSharedPointer< QLowEnergyServicePrivate > servicePrivate, QLowEnergyHandle serviceHandle)
void characteristicValueUpdatedByRemote(QLowEnergyHandle handle, const QByteArray &value)
bool registrationNeeded()
bool localCharacteristicWrite(QLowEnergyHandle handle, const QByteArray &value)
void descriptorValueUpdatedByRemote(QLowEnergyHandle characteristicHandle, QLowEnergyHandle descriptorHandle, const QByteArray &value)
void connectivityStateChanged(bool connected)
void remoteDeviceAccessEvent(const QString &remoteDeviceObjectPath, quint16 mtu)
void remoteDeviceChanged(const QBluetoothAddress &address, const QString &name, quint16 mtu)
list append(new Employee("Blackpool", "Stephen"))
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Q_CORE_EXPORT QtJniTypes::Service service()
constexpr QBindableInterface iface
QMap< QString, QVariant > QVariantMap
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 * iter
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 * interface
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static QT_BEGIN_NAMESPACE gboolean deviceMonitor(GstBus *, GstMessage *message, gpointer m)
#define qCWarning(category,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint64 GLenum void * handle
GLuint GLuint64EXT address
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
#define QStringLiteral(str)
QFutureWatcher< int > watcher
QNetworkAccessManager manager
bool contains(const AT &t) const noexcept
QHash< QLowEnergyHandle, DescData > descriptorList
QLowEnergyHandle valueHandle
QLowEnergyCharacteristic::PropertyTypes properties