diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-10-25 14:49:47 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-11-03 13:08:51 +0000 |
commit | fbf36811672de79f2a648af97ca73d6c0e3b1608 (patch) | |
tree | aee123e7d84a4451118a389d62d0e32cd6635692 | |
parent | 7a9d2e77befb13c1f714f842d4b0ee3fea2d4a6c (diff) |
Rename various QLEControllerPrivate classes
The base class is renamed to QLEControllerPrivate and
the existing QLEControllerPrivate becomes
QLEControllerPrivateCommon.
This is necessary to re-enable Q_DECLARE_PRIVATE. The macro uses by
convention the "Private" class prefix which is currently broken
because not every implementation uses QLEControllerPrivate as
d-pointer type. This also avoids a SC/BC break in
qlowenergycontroller.h as the d-pointer remains the same and the
functions declared via Q_DECLARE_PRIVATE still return the same
type.
Change-Id: I84890b06280b2c473a4d370606d3bbc58a258eea
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/bluetooth/qbluetoothsocket.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycharacteristic.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller.cpp | 18 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller.h | 4 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_android.cpp | 84 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluez.cpp | 188 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluezdbus.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluezdbus_p.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_p.cpp | 34 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_p.h | 8 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt.cpp | 42 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontrollerbase.cpp | 22 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontrollerbase_p.h | 6 | ||||
-rw-r--r-- | src/bluetooth/qlowenergydescriptor.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice.h | 4 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyserviceprivate.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyserviceprivate_p.h | 6 |
17 files changed, 214 insertions, 214 deletions
diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index 3fc2892e..31e32f9a 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -164,7 +164,7 @@ protected: QBluetoothSocketPrivate *d_ptr; private: - friend class QLowEnergyControllerPrivate; + friend class QLowEnergyControllerPrivateCommon; }; #ifndef QT_NO_DEBUG_STREAM diff --git a/src/bluetooth/qlowenergycharacteristic.h b/src/bluetooth/qlowenergycharacteristic.h index 7ce05343..97b60bd2 100644 --- a/src/bluetooth/qlowenergycharacteristic.h +++ b/src/bluetooth/qlowenergycharacteristic.h @@ -96,8 +96,8 @@ protected: QSharedPointer<QLowEnergyServicePrivate> d_ptr; friend class QLowEnergyService; + friend class QLowEnergyControllerPrivateCommon; friend class QLowEnergyControllerPrivate; - friend class QLowEnergyControllerPrivateBase; friend class QLowEnergyControllerPrivateOSX; QLowEnergyCharacteristicPrivate *data; QLowEnergyCharacteristic(QSharedPointer<QLowEnergyServicePrivate> p, diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index b026e4a0..34b7cbec 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -305,9 +305,9 @@ QLowEnergyController::QLowEnergyController( if (isBluez5DbusGatt()) d_ptr = new QLowEnergyControllerPrivateBluezDBus(); else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #endif Q_D(QLowEnergyController); @@ -342,9 +342,9 @@ QLowEnergyController::QLowEnergyController( if (isBluez5DbusGatt()) d_ptr = new QLowEnergyControllerPrivateBluezDBus(); else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #endif Q_D(QLowEnergyController); @@ -382,9 +382,9 @@ QLowEnergyController::QLowEnergyController( if (isBluez5DbusGatt()) d_ptr = new QLowEnergyControllerPrivateBluezDBus(); else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #endif Q_D(QLowEnergyController); @@ -434,9 +434,9 @@ QLowEnergyController::QLowEnergyController(QObject *parent) if (isBluez5DbusGatt()) d_ptr = new QLowEnergyControllerPrivateBluezDBus(); else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #else - d_ptr = new QLowEnergyControllerPrivate(); + d_ptr = new QLowEnergyControllerPrivateCommon(); #endif Q_D(QLowEnergyController); @@ -783,7 +783,7 @@ QLowEnergyService *QLowEnergyController::addService(const QLowEnergyServiceData return newService; } -QLowEnergyService *QLowEnergyControllerPrivate::addServiceHelper( +QLowEnergyService *QLowEnergyControllerPrivateCommon::addServiceHelper( const QLowEnergyServiceData &service) { // Spec says services "should" be grouped by uuid length (16-bit first, then 128-bit). diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h index 782d042a..f9e6ef5d 100644 --- a/src/bluetooth/qlowenergycontroller.h +++ b/src/bluetooth/qlowenergycontroller.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QLowEnergyAdvertisingParameters; class QLowEnergyConnectionParameters; -class QLowEnergyControllerPrivateBase; +class QLowEnergyControllerPrivate; class QLowEnergyServiceData; class Q_BLUETOOTH_EXPORT QLowEnergyController : public QObject @@ -152,7 +152,7 @@ private: explicit QLowEnergyController(QObject *parent = nullptr); // For the peripheral role. Q_DECLARE_PRIVATE(QLowEnergyController) - QLowEnergyControllerPrivateBase *d_ptr; + QLowEnergyControllerPrivate *d_ptr; }; QT_END_NAMESPACE diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp index 137fbea1..b775e299 100644 --- a/src/bluetooth/qlowenergycontroller_android.cpp +++ b/src/bluetooth/qlowenergycontroller_android.cpp @@ -69,14 +69,14 @@ static QAndroidJniObject javaUuidfromQtUuid(const QBluetoothUuid& uuid) return javaUuid; } -QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() - : QLowEnergyControllerPrivateBase(), +QLowEnergyControllerPrivateCommon::QLowEnergyControllerPrivateCommon() + : QLowEnergyControllerPrivate(), hub(0) { registerQLowEnergyControllerMetaType(); } -QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() +QLowEnergyControllerPrivateCommon::~QLowEnergyControllerPrivateCommon() { if (role == QLowEnergyController::PeripheralRole) { if (hub) @@ -84,7 +84,7 @@ QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() } } -void QLowEnergyControllerPrivate::init() +void QLowEnergyControllerPrivateCommon::init() { // Android Central/Client support starts with v18 // Peripheral/Server support requires Android API v21 @@ -104,13 +104,13 @@ void QLowEnergyControllerPrivate::init() // we only connect to the peripheral role specific signals // TODO add connections as they get added later on connect(hub, &LowEnergyNotificationHub::connectionUpdated, - this, &QLowEnergyControllerPrivate::connectionUpdated); + this, &QLowEnergyControllerPrivateCommon::connectionUpdated); connect(hub, &LowEnergyNotificationHub::advertisementError, - this, &QLowEnergyControllerPrivate::advertisementError); + this, &QLowEnergyControllerPrivateCommon::advertisementError); connect(hub, &LowEnergyNotificationHub::serverCharacteristicChanged, - this, &QLowEnergyControllerPrivate::serverCharacteristicChanged); + this, &QLowEnergyControllerPrivateCommon::serverCharacteristicChanged); connect(hub, &LowEnergyNotificationHub::serverDescriptorWritten, - this, &QLowEnergyControllerPrivate::serverDescriptorWritten); + this, &QLowEnergyControllerPrivateCommon::serverDescriptorWritten); } else { if (version < 18) { qWarning() << "Qt Bluetooth LE Central/Client support not available" @@ -121,25 +121,25 @@ void QLowEnergyControllerPrivate::init() hub = new LowEnergyNotificationHub(remoteDevice, isPeripheral, this); // we only connect to the central role specific signals connect(hub, &LowEnergyNotificationHub::connectionUpdated, - this, &QLowEnergyControllerPrivate::connectionUpdated); + this, &QLowEnergyControllerPrivateCommon::connectionUpdated); connect(hub, &LowEnergyNotificationHub::servicesDiscovered, - this, &QLowEnergyControllerPrivate::servicesDiscovered); + this, &QLowEnergyControllerPrivateCommon::servicesDiscovered); connect(hub, &LowEnergyNotificationHub::serviceDetailsDiscoveryFinished, - this, &QLowEnergyControllerPrivate::serviceDetailsDiscoveryFinished); + this, &QLowEnergyControllerPrivateCommon::serviceDetailsDiscoveryFinished); connect(hub, &LowEnergyNotificationHub::characteristicRead, - this, &QLowEnergyControllerPrivate::characteristicRead); + this, &QLowEnergyControllerPrivateCommon::characteristicRead); connect(hub, &LowEnergyNotificationHub::descriptorRead, - this, &QLowEnergyControllerPrivate::descriptorRead); + this, &QLowEnergyControllerPrivateCommon::descriptorRead); connect(hub, &LowEnergyNotificationHub::characteristicWritten, - this, &QLowEnergyControllerPrivate::characteristicWritten); + this, &QLowEnergyControllerPrivateCommon::characteristicWritten); connect(hub, &LowEnergyNotificationHub::descriptorWritten, - this, &QLowEnergyControllerPrivate::descriptorWritten); + this, &QLowEnergyControllerPrivateCommon::descriptorWritten); connect(hub, &LowEnergyNotificationHub::characteristicChanged, - this, &QLowEnergyControllerPrivate::characteristicChanged); + this, &QLowEnergyControllerPrivateCommon::characteristicChanged); } } -void QLowEnergyControllerPrivate::connectToDevice() +void QLowEnergyControllerPrivateCommon::connectToDevice() { if (!hub) return; // Android version below v18 @@ -168,7 +168,7 @@ void QLowEnergyControllerPrivate::connectToDevice() } } -void QLowEnergyControllerPrivate::disconnectFromDevice() +void QLowEnergyControllerPrivateCommon::disconnectFromDevice() { /* Catch an Android timeout bug. If the device is connecting but cannot * physically connect it seems to ignore the disconnect call below. @@ -186,7 +186,7 @@ void QLowEnergyControllerPrivate::disconnectFromDevice() setState(QLowEnergyController::UnconnectedState); } -void QLowEnergyControllerPrivate::discoverServices() +void QLowEnergyControllerPrivateCommon::discoverServices() { if (hub && hub->javaObject().callMethod<jboolean>("discoverServices")) { qCDebug(QT_BT_ANDROID) << "Service discovery initiated"; @@ -197,7 +197,7 @@ void QLowEnergyControllerPrivate::discoverServices() } } -void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &service) +void QLowEnergyControllerPrivateCommon::discoverServiceDetails(const QBluetoothUuid &service) { if (!serviceList.contains(service)) { qCWarning(QT_BT_ANDROID) << "Discovery of unknown service" << service.toString() @@ -232,7 +232,7 @@ void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &s qCDebug(QT_BT_ANDROID) << "Discovery of" << service << "started"; } -void QLowEnergyControllerPrivate::writeCharacteristic( +void QLowEnergyControllerPrivateCommon::writeCharacteristic( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QByteArray &newValue, @@ -286,7 +286,7 @@ void QLowEnergyControllerPrivate::writeCharacteristic( service->setError(QLowEnergyService::CharacteristicWriteError); } -void QLowEnergyControllerPrivate::writeDescriptor( +void QLowEnergyControllerPrivateCommon::writeDescriptor( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descHandle, @@ -337,7 +337,7 @@ void QLowEnergyControllerPrivate::writeDescriptor( service->setError(QLowEnergyService::DescriptorWriteError); } -void QLowEnergyControllerPrivate::readCharacteristic( +void QLowEnergyControllerPrivateCommon::readCharacteristic( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle) { @@ -365,7 +365,7 @@ void QLowEnergyControllerPrivate::readCharacteristic( service->setError(QLowEnergyService::CharacteristicReadError); } -void QLowEnergyControllerPrivate::readDescriptor( +void QLowEnergyControllerPrivateCommon::readDescriptor( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle /*charHandle*/, const QLowEnergyHandle descriptorHandle) @@ -391,7 +391,7 @@ void QLowEnergyControllerPrivate::readDescriptor( service->setError(QLowEnergyService::DescriptorReadError); } -void QLowEnergyControllerPrivate::connectionUpdated( +void QLowEnergyControllerPrivateCommon::connectionUpdated( QLowEnergyController::ControllerState newState, QLowEnergyController::Error errorCode) { @@ -407,7 +407,7 @@ void QLowEnergyControllerPrivate::connectionUpdated( } // called if server/peripheral -void QLowEnergyControllerPrivate::peripheralConnectionUpdated( +void QLowEnergyControllerPrivateCommon::peripheralConnectionUpdated( QLowEnergyController::ControllerState newState, QLowEnergyController::Error errorCode) { @@ -437,7 +437,7 @@ void QLowEnergyControllerPrivate::peripheralConnectionUpdated( } // called if client/central -void QLowEnergyControllerPrivate::centralConnectionUpdated( +void QLowEnergyControllerPrivateCommon::centralConnectionUpdated( QLowEnergyController::ControllerState newState, QLowEnergyController::Error errorCode) { @@ -482,7 +482,7 @@ void QLowEnergyControllerPrivate::centralConnectionUpdated( } } -void QLowEnergyControllerPrivate::servicesDiscovered( +void QLowEnergyControllerPrivateCommon::servicesDiscovered( QLowEnergyController::Error errorCode, const QString &foundServices) { Q_Q(QLowEnergyController); @@ -513,7 +513,7 @@ void QLowEnergyControllerPrivate::servicesDiscovered( } } -void QLowEnergyControllerPrivate::serviceDetailsDiscoveryFinished( +void QLowEnergyControllerPrivateCommon::serviceDetailsDiscoveryFinished( const QString &serviceUuid, int startHandle, int endHandle) { const QBluetoothUuid service(serviceUuid); @@ -561,7 +561,7 @@ void QLowEnergyControllerPrivate::serviceDetailsDiscoveryFinished( pointer->setState(QLowEnergyService::ServiceDiscovered); } -void QLowEnergyControllerPrivate::characteristicRead( +void QLowEnergyControllerPrivateCommon::characteristicRead( const QBluetoothUuid &serviceUuid, int handle, const QBluetoothUuid &charUuid, int properties, const QByteArray &data) { @@ -592,7 +592,7 @@ void QLowEnergyControllerPrivate::characteristicRead( } } -void QLowEnergyControllerPrivate::descriptorRead( +void QLowEnergyControllerPrivateCommon::descriptorRead( const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid, int descHandle, const QBluetoothUuid &descUuid, const QByteArray &data) { @@ -633,7 +633,7 @@ void QLowEnergyControllerPrivate::descriptorRead( } } -void QLowEnergyControllerPrivate::characteristicWritten( +void QLowEnergyControllerPrivateCommon::characteristicWritten( int charHandle, const QByteArray &data, QLowEnergyService::ServiceError errorCode) { QSharedPointer<QLowEnergyServicePrivate> service = @@ -662,7 +662,7 @@ void QLowEnergyControllerPrivate::characteristicWritten( emit service->characteristicWritten(characteristic, data); } -void QLowEnergyControllerPrivate::descriptorWritten( +void QLowEnergyControllerPrivateCommon::descriptorWritten( int descHandle, const QByteArray &data, QLowEnergyService::ServiceError errorCode) { QSharedPointer<QLowEnergyServicePrivate> service = @@ -689,7 +689,7 @@ void QLowEnergyControllerPrivate::descriptorWritten( emit service->descriptorWritten(descriptor, data); } -void QLowEnergyControllerPrivate::serverDescriptorWritten( +void QLowEnergyControllerPrivateCommon::serverDescriptorWritten( const QAndroidJniObject &jniDesc, const QByteArray &newValue) { qCDebug(QT_BT_ANDROID) << "Server descriptor change notification" << newValue.toHex(); @@ -754,7 +754,7 @@ void QLowEnergyControllerPrivate::serverDescriptorWritten( } } -void QLowEnergyControllerPrivate::characteristicChanged( +void QLowEnergyControllerPrivateCommon::characteristicChanged( int charHandle, const QByteArray &data) { QSharedPointer<QLowEnergyServicePrivate> service = @@ -779,7 +779,7 @@ void QLowEnergyControllerPrivate::characteristicChanged( emit service->characteristicChanged(characteristic, data); } -void QLowEnergyControllerPrivate::serverCharacteristicChanged( +void QLowEnergyControllerPrivateCommon::serverCharacteristicChanged( const QAndroidJniObject &characteristic, const QByteArray &newValue) { qCDebug(QT_BT_ANDROID) << "Server characteristic change notification" << newValue.toHex(); @@ -828,7 +828,7 @@ void QLowEnergyControllerPrivate::serverCharacteristicChanged( QLowEnergyCharacteristic(servicePrivate, foundHandle), newValue); } -void QLowEnergyControllerPrivate::serviceError( +void QLowEnergyControllerPrivateCommon::serviceError( int attributeHandle, QLowEnergyService::ServiceError errorCode) { // ignore call if it isn't really an error @@ -844,7 +844,7 @@ void QLowEnergyControllerPrivate::serviceError( service->setError(errorCode); } -void QLowEnergyControllerPrivate::advertisementError(int errorCode) +void QLowEnergyControllerPrivateCommon::advertisementError(int errorCode) { Q_Q(QLowEnergyController); @@ -995,7 +995,7 @@ static QAndroidJniObject createJavaAdvertiseSettings(const QLowEnergyAdvertising } -void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingParameters ¶ms, +void QLowEnergyControllerPrivateCommon::startAdvertising(const QLowEnergyAdvertisingParameters ¶ms, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData) { @@ -1022,13 +1022,13 @@ void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingPa } } -void QLowEnergyControllerPrivate::stopAdvertising() +void QLowEnergyControllerPrivateCommon::stopAdvertising() { setState(QLowEnergyController::UnconnectedState); hub->javaObject().callMethod<void>("stopAdvertising"); } -void QLowEnergyControllerPrivate::requestConnectionUpdate(const QLowEnergyConnectionParameters ¶ms) +void QLowEnergyControllerPrivateCommon::requestConnectionUpdate(const QLowEnergyConnectionParameters ¶ms) { // Possible since Android v21 // Android does not permit specification of specific latency or min/max @@ -1167,7 +1167,7 @@ static int setupDescPermissions(const QLowEnergyDescriptorData &descData) return permissions; } -void QLowEnergyControllerPrivate::addToGenericAttributeList(const QLowEnergyServiceData &serviceData, +void QLowEnergyControllerPrivateCommon::addToGenericAttributeList(const QLowEnergyServiceData &serviceData, QLowEnergyHandle startHandle) { QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(startHandle); diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 1622ffb3..84c2970f 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -263,8 +263,8 @@ template<> void putDataAndIncrement(const QByteArray &value, char *&dst) dst += value.count(); } -QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() - : QLowEnergyControllerPrivateBase(), +QLowEnergyControllerPrivateCommon::QLowEnergyControllerPrivateCommon() + : QLowEnergyControllerPrivate(), lastLocalHandle(0), l2cpSocket(0), requestPending(false), mtuSize(ATT_DEFAULT_LE_MTU), @@ -278,7 +278,7 @@ QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() qRegisterMetaType<QList<QLowEnergyHandle> >(); } -void QLowEnergyControllerPrivate::init() +void QLowEnergyControllerPrivateCommon::init() { hciManager = new HciManager(localAdapter, this); if (!hciManager->isValid()) @@ -329,12 +329,12 @@ void QLowEnergyControllerPrivate::init() requestTimer->setSingleShot(true); requestTimer->setInterval(gattRequestTimeout); connect(requestTimer, &QTimer::timeout, - this, &QLowEnergyControllerPrivate::handleGattRequestTimeout); + this, &QLowEnergyControllerPrivateCommon::handleGattRequestTimeout); } } } -void QLowEnergyControllerPrivate::handleGattRequestTimeout() +void QLowEnergyControllerPrivateCommon::handleGattRequestTimeout() { // antyhing open that might require cancellation or a warning? if (encryptionChangePending) { @@ -409,7 +409,7 @@ void QLowEnergyControllerPrivate::handleGattRequestTimeout() } } -QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() +QLowEnergyControllerPrivateCommon::~QLowEnergyControllerPrivateCommon() { closeServerSocket(); delete cmacCalculator; @@ -465,7 +465,7 @@ private: }; -void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingParameters ¶ms, +void QLowEnergyControllerPrivateCommon::startAdvertising(const QLowEnergyAdvertisingParameters ¶ms, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData) { @@ -474,7 +474,7 @@ void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingPa advertiser = new QLeAdvertiserBluez(params, advertisingData, scanResponseData, *hciManager, this); connect(advertiser, &QLeAdvertiser::errorOccurred, this, - &QLowEnergyControllerPrivate::handleAdvertisingError); + &QLowEnergyControllerPrivateCommon::handleAdvertisingError); } setState(QLowEnergyController::AdvertisingState); advertiser->startAdvertising(); @@ -495,16 +495,16 @@ void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingPa const int socketFd = serverSocket.takeSocket(); serverSocketNotifier = new QSocketNotifier(socketFd, QSocketNotifier::Read, this); connect(serverSocketNotifier, &QSocketNotifier::activated, this, - &QLowEnergyControllerPrivate::handleConnectionRequest); + &QLowEnergyControllerPrivateCommon::handleConnectionRequest); } -void QLowEnergyControllerPrivate::stopAdvertising() +void QLowEnergyControllerPrivateCommon::stopAdvertising() { setState(QLowEnergyController::UnconnectedState); advertiser->stopAdvertising(); } -void QLowEnergyControllerPrivate::requestConnectionUpdate(const QLowEnergyConnectionParameters ¶ms) +void QLowEnergyControllerPrivateCommon::requestConnectionUpdate(const QLowEnergyConnectionParameters ¶ms) { // The spec says that the connection update command can be used by both slave and master // devices, but BlueZ allows it only for master devices. So for slave devices, we have to use a @@ -516,7 +516,7 @@ void QLowEnergyControllerPrivate::requestConnectionUpdate(const QLowEnergyConnec hciManager->sendConnectionParameterUpdateRequest(connectionHandle, params); } -void QLowEnergyControllerPrivate::connectToDevice() +void QLowEnergyControllerPrivateCommon::connectToDevice() { if (remoteDevice.isNull()) { qCWarning(QT_BT_BLUEZ) << "Invalid/null remote device address"; @@ -548,7 +548,7 @@ void QLowEnergyControllerPrivate::connectToDevice() if (!device1Manager) { device1Manager = new RemoteDeviceManager(localAdapter, this); connect(device1Manager, &RemoteDeviceManager::finished, - this, &QLowEnergyControllerPrivate::activeConnectionTerminationDone); + this, &QLowEnergyControllerPrivateCommon::activeConnectionTerminationDone); } QVector<QBluetoothAddress> connectedAddresses; @@ -566,7 +566,7 @@ void QLowEnergyControllerPrivate::connectToDevice() /*! * Handles outcome of attempts to close external connections. */ -void QLowEnergyControllerPrivate::activeConnectionTerminationDone() +void QLowEnergyControllerPrivateCommon::activeConnectionTerminationDone() { if (!device1Manager) return; @@ -588,7 +588,7 @@ void QLowEnergyControllerPrivate::activeConnectionTerminationDone() /*! * Establishes the L2CP client socket. */ -void QLowEnergyControllerPrivate::establishL2cpClientSocket() +void QLowEnergyControllerPrivateCommon::establishL2cpClientSocket() { //we are already in Connecting state @@ -644,7 +644,7 @@ void QLowEnergyControllerPrivate::establishL2cpClientSocket() loadSigningDataIfNecessary(LocalSigningKey); } -void QLowEnergyControllerPrivate::createServicesForCentralIfRequired() +void QLowEnergyControllerPrivateCommon::createServicesForCentralIfRequired() { bool ok = false; int value = qEnvironmentVariableIntValue("QT_DEFAULT_CENTRAL_SERVICES", &ok); @@ -710,7 +710,7 @@ void QLowEnergyControllerPrivate::createServicesForCentralIfRequired() service->setParent(q); } -void QLowEnergyControllerPrivate::l2cpConnected() +void QLowEnergyControllerPrivateCommon::l2cpConnected() { Q_Q(QLowEnergyController); @@ -721,14 +721,14 @@ void QLowEnergyControllerPrivate::l2cpConnected() emit q->connected(); } -void QLowEnergyControllerPrivate::disconnectFromDevice() +void QLowEnergyControllerPrivateCommon::disconnectFromDevice() { setState(QLowEnergyController::ClosingState); l2cpSocket->close(); resetController(); } -void QLowEnergyControllerPrivate::l2cpDisconnected() +void QLowEnergyControllerPrivateCommon::l2cpDisconnected() { Q_Q(QLowEnergyController); @@ -740,7 +740,7 @@ void QLowEnergyControllerPrivate::l2cpDisconnected() emit q->disconnected(); } -void QLowEnergyControllerPrivate::l2cpErrorChanged(QBluetoothSocket::SocketError e) +void QLowEnergyControllerPrivateCommon::l2cpErrorChanged(QBluetoothSocket::SocketError e) { switch (e) { case QBluetoothSocket::HostNotFoundError: @@ -773,7 +773,7 @@ void QLowEnergyControllerPrivate::l2cpErrorChanged(QBluetoothSocket::SocketError } -void QLowEnergyControllerPrivate::resetController() +void QLowEnergyControllerPrivateCommon::resetController() { openRequests.clear(); openPrepareWriteRequests.clear(); @@ -790,7 +790,7 @@ void QLowEnergyControllerPrivate::resetController() advertiser->stopAdvertising(); } -void QLowEnergyControllerPrivate::restartRequestTimer() +void QLowEnergyControllerPrivateCommon::restartRequestTimer() { if (!requestTimer) return; @@ -799,7 +799,7 @@ void QLowEnergyControllerPrivate::restartRequestTimer() requestTimer->start(gattRequestTimeout); } -void QLowEnergyControllerPrivate::l2cpReadyRead() +void QLowEnergyControllerPrivateCommon::l2cpReadyRead() { const QByteArray incomingPacket = l2cpSocket->readAll(); qCDebug(QT_BT_BLUEZ) << "Received size:" << incomingPacket.size() << "data:" @@ -897,7 +897,7 @@ void QLowEnergyControllerPrivate::l2cpReadyRead() * callback is called. The first pending request in the queue is the request * that triggered the encryption request. */ -void QLowEnergyControllerPrivate::encryptionChangedEvent( +void QLowEnergyControllerPrivateCommon::encryptionChangedEvent( const QBluetoothAddress &address, bool wasSuccess) { if (!encryptionChangePending) // somebody else caused change event @@ -946,7 +946,7 @@ void QLowEnergyControllerPrivate::encryptionChangedEvent( sendNextPendingRequest(); } -void QLowEnergyControllerPrivate::sendPacket(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::sendPacket(const QByteArray &packet) { qint64 result = l2cpSocket->write(packet.constData(), packet.size()); @@ -965,7 +965,7 @@ void QLowEnergyControllerPrivate::sendPacket(const QByteArray &packet) } -void QLowEnergyControllerPrivate::sendNextPendingRequest() +void QLowEnergyControllerPrivateCommon::sendNextPendingRequest() { if (openRequests.isEmpty() || requestPending || encryptionChangePending) return; @@ -1030,7 +1030,7 @@ QLowEnergyHandle parseReadByTypeIncludeDiscovery( return attributeHandle; } -void QLowEnergyControllerPrivate::processReply( +void QLowEnergyControllerPrivateCommon::processReply( const Request &request, const QByteArray &response) { Q_Q(QLowEnergyController); @@ -1568,12 +1568,12 @@ void QLowEnergyControllerPrivate::processReply( } } -void QLowEnergyControllerPrivate::discoverServices() +void QLowEnergyControllerPrivateCommon::discoverServices() { sendReadByGroupRequest(0x0001, 0xFFFF, GATT_PRIMARY_SERVICE); } -void QLowEnergyControllerPrivate::sendReadByGroupRequest( +void QLowEnergyControllerPrivateCommon::sendReadByGroupRequest( QLowEnergyHandle start, QLowEnergyHandle end, quint16 type) { //call for primary and secondary services @@ -1598,7 +1598,7 @@ void QLowEnergyControllerPrivate::sendReadByGroupRequest( sendNextPendingRequest(); } -void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &service) +void QLowEnergyControllerPrivateCommon::discoverServiceDetails(const QBluetoothUuid &service) { if (!serviceList.contains(service)) { qCWarning(QT_BT_BLUEZ) << "Discovery of unknown service" << service.toString() @@ -1611,7 +1611,7 @@ void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &s sendReadByTypeRequest(serviceData, serviceData->startHandle, GATT_INCLUDED_SERVICE); } -void QLowEnergyControllerPrivate::sendReadByTypeRequest( +void QLowEnergyControllerPrivateCommon::sendReadByTypeRequest( QSharedPointer<QLowEnergyServicePrivate> serviceData, QLowEnergyHandle nextHandle, quint16 attributeType) { @@ -1647,7 +1647,7 @@ void QLowEnergyControllerPrivate::sendReadByTypeRequest( \a readCharacteristics determines whether we intend to read a characteristic; otherwise we read a descriptor. */ -void QLowEnergyControllerPrivate::readServiceValues( +void QLowEnergyControllerPrivateCommon::readServiceValues( const QBluetoothUuid &serviceUuid, bool readCharacteristics) { quint8 packet[READ_REQUEST_HEADER_SIZE]; @@ -1741,7 +1741,7 @@ void QLowEnergyControllerPrivate::readServiceValues( open requests to finish the current value read up before starting the next read request. */ -void QLowEnergyControllerPrivate::readServiceValuesByOffset( +void QLowEnergyControllerPrivateCommon::readServiceValuesByOffset( uint handleData, quint16 offset, bool isLastValue) { const QLowEnergyHandle charHandle = (handleData & 0xffff); @@ -1780,7 +1780,7 @@ void QLowEnergyControllerPrivate::readServiceValuesByOffset( openRequests.prepend(request); } -void QLowEnergyControllerPrivate::discoverServiceDescriptors( +void QLowEnergyControllerPrivateCommon::discoverServiceDescriptors( const QBluetoothUuid &serviceUuid) { qCDebug(QT_BT_BLUEZ) << "Discovering descriptor values for" @@ -1800,7 +1800,7 @@ void QLowEnergyControllerPrivate::discoverServiceDescriptors( discoverNextDescriptor(service, keys, keys[0]); } -void QLowEnergyControllerPrivate::processUnsolicitedReply(const QByteArray &payload) +void QLowEnergyControllerPrivateCommon::processUnsolicitedReply(const QByteArray &payload) { const char *data = payload.constData(); bool isNotification = (data[0] == ATT_OP_HANDLE_VAL_NOTIFICATION); @@ -1824,7 +1824,7 @@ void QLowEnergyControllerPrivate::processUnsolicitedReply(const QByteArray &payl } } -void QLowEnergyControllerPrivate::exchangeMTU() +void QLowEnergyControllerPrivateCommon::exchangeMTU() { qCDebug(QT_BT_BLUEZ) << "Exchanging MTU"; @@ -1843,7 +1843,7 @@ void QLowEnergyControllerPrivate::exchangeMTU() sendNextPendingRequest(); } -int QLowEnergyControllerPrivate::securityLevel() const +int QLowEnergyControllerPrivateCommon::securityLevel() const { int socket = l2cpSocket->socketDescriptor(); if (socket < 0) { @@ -1882,7 +1882,7 @@ int QLowEnergyControllerPrivate::securityLevel() const return -1; } -bool QLowEnergyControllerPrivate::setSecurityLevel(int level) +bool QLowEnergyControllerPrivateCommon::setSecurityLevel(int level) { if (level > BT_SECURITY_HIGH || level < BT_SECURITY_LOW) return false; @@ -1929,7 +1929,7 @@ bool QLowEnergyControllerPrivate::setSecurityLevel(int level) return false; } -void QLowEnergyControllerPrivate::discoverNextDescriptor( +void QLowEnergyControllerPrivateCommon::discoverNextDescriptor( QSharedPointer<QLowEnergyServicePrivate> serviceData, const QList<QLowEnergyHandle> pendingCharHandles, const QLowEnergyHandle startingHandle) @@ -1966,7 +1966,7 @@ void QLowEnergyControllerPrivate::discoverNextDescriptor( sendNextPendingRequest(); } -void QLowEnergyControllerPrivate::sendNextPrepareWriteRequest( +void QLowEnergyControllerPrivateCommon::sendNextPrepareWriteRequest( const QLowEnergyHandle handle, const QByteArray &newValue, quint16 offset) { @@ -2021,7 +2021,7 @@ void QLowEnergyControllerPrivate::sendNextPrepareWriteRequest( Otherwise this function sends an execute request for all pending prepare write requests. */ -void QLowEnergyControllerPrivate::sendExecuteWriteRequest( +void QLowEnergyControllerPrivateCommon::sendExecuteWriteRequest( const QLowEnergyHandle attrHandle, const QByteArray &newValue, bool isCancelation) { @@ -2053,7 +2053,7 @@ void QLowEnergyControllerPrivate::sendExecuteWriteRequest( TODO Reliable/prepare write across multiple characteristics is not supported */ -void QLowEnergyControllerPrivate::writeCharacteristic( +void QLowEnergyControllerPrivateCommon::writeCharacteristic( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QByteArray &newValue, @@ -2071,7 +2071,7 @@ void QLowEnergyControllerPrivate::writeCharacteristic( writeCharacteristicForCentral(service, charHandle, charData.valueHandle, newValue, mode); } -void QLowEnergyControllerPrivate::writeDescriptor( +void QLowEnergyControllerPrivateCommon::writeDescriptor( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle, @@ -2090,7 +2090,7 @@ void QLowEnergyControllerPrivate::writeDescriptor( Reads the value of one specific characteristic. */ -void QLowEnergyControllerPrivate::readCharacteristic( +void QLowEnergyControllerPrivateCommon::readCharacteristic( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle) { @@ -2128,7 +2128,7 @@ void QLowEnergyControllerPrivate::readCharacteristic( sendNextPendingRequest(); } -void QLowEnergyControllerPrivate::readDescriptor( +void QLowEnergyControllerPrivateCommon::readDescriptor( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle) @@ -2167,7 +2167,7 @@ void QLowEnergyControllerPrivate::readDescriptor( * Returns true if the encryption change was successfully requested. * The request is triggered if we got a related ATT error. */ -bool QLowEnergyControllerPrivate::increaseEncryptLevelfRequired(quint8 errorCode) +bool QLowEnergyControllerPrivateCommon::increaseEncryptLevelfRequired(quint8 errorCode) { if (securityLevelValue == BT_SECURITY_HIGH) return false; @@ -2195,14 +2195,14 @@ bool QLowEnergyControllerPrivate::increaseEncryptLevelfRequired(quint8 errorCode return false; } -void QLowEnergyControllerPrivate::handleAdvertisingError() +void QLowEnergyControllerPrivateCommon::handleAdvertisingError() { qCWarning(QT_BT_BLUEZ) << "received advertising error"; setError(QLowEnergyController::AdvertisingError); setState(QLowEnergyController::UnconnectedState); } -bool QLowEnergyControllerPrivate::checkPacketSize(const QByteArray &packet, int minSize, +bool QLowEnergyControllerPrivateCommon::checkPacketSize(const QByteArray &packet, int minSize, int maxSize) { if (maxSize == -1) @@ -2215,7 +2215,7 @@ bool QLowEnergyControllerPrivate::checkPacketSize(const QByteArray &packet, int return false; } -bool QLowEnergyControllerPrivate::checkHandle(const QByteArray &packet, QLowEnergyHandle handle) +bool QLowEnergyControllerPrivateCommon::checkHandle(const QByteArray &packet, QLowEnergyHandle handle) { if (handle != 0 && handle <= lastLocalHandle) return true; @@ -2223,7 +2223,7 @@ bool QLowEnergyControllerPrivate::checkHandle(const QByteArray &packet, QLowEner return false; } -bool QLowEnergyControllerPrivate::checkHandlePair(quint8 request, QLowEnergyHandle startingHandle, +bool QLowEnergyControllerPrivateCommon::checkHandlePair(quint8 request, QLowEnergyHandle startingHandle, QLowEnergyHandle endingHandle) { if (startingHandle == 0 || startingHandle > endingHandle) { @@ -2234,7 +2234,7 @@ bool QLowEnergyControllerPrivate::checkHandlePair(quint8 request, QLowEnergyHand return true; } -void QLowEnergyControllerPrivate::handleExchangeMtuRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleExchangeMtuRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.2 @@ -2261,7 +2261,7 @@ void QLowEnergyControllerPrivate::handleExchangeMtuRequest(const QByteArray &pac qCDebug(QT_BT_BLUEZ) << "Sending server RX MTU" << ATT_MAX_LE_MTU; } -void QLowEnergyControllerPrivate::handleFindInformationRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleFindInformationRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.3.1-2 @@ -2294,7 +2294,7 @@ void QLowEnergyControllerPrivate::handleFindInformationRequest(const QByteArray } -void QLowEnergyControllerPrivate::handleFindByTypeValueRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleFindByTypeValueRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.3.3-4 @@ -2329,7 +2329,7 @@ void QLowEnergyControllerPrivate::handleFindByTypeValueRequest(const QByteArray sendListResponse(responsePrefix, elemSize, results, elemWriter); } -void QLowEnergyControllerPrivate::handleReadByTypeRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleReadByTypeRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.4.1-2 @@ -2382,7 +2382,7 @@ void QLowEnergyControllerPrivate::handleReadByTypeRequest(const QByteArray &pack sendListResponse(responsePrefix, elementSize, results, elemWriter); } -void QLowEnergyControllerPrivate::handleReadRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleReadRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.4.3-4 @@ -2409,7 +2409,7 @@ void QLowEnergyControllerPrivate::handleReadRequest(const QByteArray &packet) sendPacket(response); } -void QLowEnergyControllerPrivate::handleReadBlobRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleReadBlobRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.4.5-6 @@ -2448,7 +2448,7 @@ void QLowEnergyControllerPrivate::handleReadBlobRequest(const QByteArray &packet sendPacket(response); } -void QLowEnergyControllerPrivate::handleReadMultipleRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleReadMultipleRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.4.7-8 @@ -2484,7 +2484,7 @@ void QLowEnergyControllerPrivate::handleReadMultipleRequest(const QByteArray &pa sendPacket(response); } -void QLowEnergyControllerPrivate::handleReadByGroupTypeRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleReadByGroupTypeRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.4.9-10 @@ -2543,7 +2543,7 @@ void QLowEnergyControllerPrivate::handleReadByGroupTypeRequest(const QByteArray sendListResponse(responsePrefix, elementSize, results, elemWriter); } -void QLowEnergyControllerPrivate::updateLocalAttributeValue( +void QLowEnergyControllerPrivateCommon::updateLocalAttributeValue( QLowEnergyHandle handle, const QByteArray &value, QLowEnergyCharacteristic &characteristic, @@ -2577,7 +2577,7 @@ void QLowEnergyControllerPrivate::updateLocalAttributeValue( static bool isNotificationEnabled(quint16 clientConfigValue) { return clientConfigValue & 0x1; } static bool isIndicationEnabled(quint16 clientConfigValue) { return clientConfigValue & 0x2; } -void QLowEnergyControllerPrivate::writeCharacteristicForPeripheral( +void QLowEnergyControllerPrivateCommon::writeCharacteristicForPeripheral( QLowEnergyServicePrivate::CharData &charData, const QByteArray &newValue) { @@ -2634,7 +2634,7 @@ void QLowEnergyControllerPrivate::writeCharacteristicForPeripheral( } } -void QLowEnergyControllerPrivate::writeCharacteristicForCentral(const QSharedPointer<QLowEnergyServicePrivate> &service, +void QLowEnergyControllerPrivateCommon::writeCharacteristicForCentral(const QSharedPointer<QLowEnergyServicePrivate> &service, QLowEnergyHandle charHandle, QLowEnergyHandle valueHandle, const QByteArray &newValue, @@ -2708,7 +2708,7 @@ void QLowEnergyControllerPrivate::writeCharacteristicForCentral(const QSharedPoi sendNextPendingRequest(); } -void QLowEnergyControllerPrivate::writeDescriptorForPeripheral( +void QLowEnergyControllerPrivateCommon::writeDescriptorForPeripheral( const QSharedPointer<QLowEnergyServicePrivate> &service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle, @@ -2725,7 +2725,7 @@ void QLowEnergyControllerPrivate::writeDescriptorForPeripheral( service->characteristicList[charHandle].descriptorList[descriptorHandle].value = newValue; } -void QLowEnergyControllerPrivate::writeDescriptorForCentral( +void QLowEnergyControllerPrivateCommon::writeDescriptorForCentral( const QLowEnergyHandle charHandle, const QLowEnergyHandle descriptorHandle, const QByteArray &newValue) @@ -2758,7 +2758,7 @@ void QLowEnergyControllerPrivate::writeDescriptorForCentral( sendNextPendingRequest(); } -void QLowEnergyControllerPrivate::handleWriteRequestOrCommand(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleWriteRequestOrCommand(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.5.1-3 @@ -2852,7 +2852,7 @@ void QLowEnergyControllerPrivate::handleWriteRequestOrCommand(const QByteArray & } } -void QLowEnergyControllerPrivate::handlePrepareWriteRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handlePrepareWriteRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.6.1 @@ -2883,7 +2883,7 @@ void QLowEnergyControllerPrivate::handlePrepareWriteRequest(const QByteArray &pa sendPacket(response); } -void QLowEnergyControllerPrivate::handleExecuteWriteRequest(const QByteArray &packet) +void QLowEnergyControllerPrivateCommon::handleExecuteWriteRequest(const QByteArray &packet) { // Spec v4.2, Vol 3, Part F, 3.4.6.3 @@ -2931,7 +2931,7 @@ void QLowEnergyControllerPrivate::handleExecuteWriteRequest(const QByteArray &pa emit descriptor.d_ptr->descriptorWritten(descriptor, descriptor.value()); } -void QLowEnergyControllerPrivate::sendErrorResponse(quint8 request, quint16 handle, quint8 code) +void QLowEnergyControllerPrivateCommon::sendErrorResponse(quint8 request, quint16 handle, quint8 code) { // An ATT command never receives an error response. if (request == ATT_OP_WRITE_COMMAND || request == ATT_OP_SIGNED_WRITE_COMMAND) @@ -2947,7 +2947,7 @@ void QLowEnergyControllerPrivate::sendErrorResponse(quint8 request, quint16 hand sendPacket(packet); } -void QLowEnergyControllerPrivate::sendListResponse(const QByteArray &packetStart, int elemSize, +void QLowEnergyControllerPrivateCommon::sendListResponse(const QByteArray &packetStart, int elemSize, const QVector<Attribute> &attributes, const ElemWriter &elemWriter) { const int offset = packetStart.count(); @@ -2963,19 +2963,19 @@ void QLowEnergyControllerPrivate::sendListResponse(const QByteArray &packetStart sendPacket(response); } -void QLowEnergyControllerPrivate::sendNotification(QLowEnergyHandle handle) +void QLowEnergyControllerPrivateCommon::sendNotification(QLowEnergyHandle handle) { sendNotificationOrIndication(ATT_OP_HANDLE_VAL_NOTIFICATION, handle); } -void QLowEnergyControllerPrivate::sendIndication(QLowEnergyHandle handle) +void QLowEnergyControllerPrivateCommon::sendIndication(QLowEnergyHandle handle) { Q_ASSERT(!indicationInFlight); indicationInFlight = true; sendNotificationOrIndication(ATT_OP_HANDLE_VAL_INDICATION, handle); } -void QLowEnergyControllerPrivate::sendNotificationOrIndication( +void QLowEnergyControllerPrivateCommon::sendNotificationOrIndication( quint8 opCode, QLowEnergyHandle handle) { @@ -2991,13 +2991,13 @@ void QLowEnergyControllerPrivate::sendNotificationOrIndication( sendPacket(packet); } -void QLowEnergyControllerPrivate::sendNextIndication() +void QLowEnergyControllerPrivateCommon::sendNextIndication() { if (!scheduledIndications.isEmpty()) sendIndication(scheduledIndications.takeFirst()); } -void QLowEnergyControllerPrivate::handleConnectionRequest() +void QLowEnergyControllerPrivateCommon::handleConnectionRequest() { if (state != QLowEnergyController::AdvertisingState) { qCWarning(QT_BT_BLUEZ) << "Incoming connection request in unexpected state" << state; @@ -3023,10 +3023,10 @@ void QLowEnergyControllerPrivate::handleConnectionRequest() closeServerSocket(); l2cpSocket = new QBluetoothSocket(QBluetoothServiceInfo::L2capProtocol, this); connect(l2cpSocket, &QBluetoothSocket::disconnected, - this, &QLowEnergyControllerPrivate::l2cpDisconnected); + this, &QLowEnergyControllerPrivateCommon::l2cpDisconnected); connect(l2cpSocket, static_cast<void (QBluetoothSocket::*)(QBluetoothSocket::SocketError)> - (&QBluetoothSocket::error), this, &QLowEnergyControllerPrivate::l2cpErrorChanged); - connect(l2cpSocket, &QIODevice::readyRead, this, &QLowEnergyControllerPrivate::l2cpReadyRead); + (&QBluetoothSocket::error), this, &QLowEnergyControllerPrivateCommon::l2cpErrorChanged); + connect(l2cpSocket, &QIODevice::readyRead, this, &QLowEnergyControllerPrivateCommon::l2cpReadyRead); l2cpSocket->d_ptr->lowEnergySocketType = addressType == QLowEnergyController::PublicAddress ? BDADDR_LE_PUBLIC : BDADDR_LE_RANDOM; l2cpSocket->setSocketDescriptor(clientSocket, QBluetoothServiceInfo::L2capProtocol, @@ -3039,7 +3039,7 @@ void QLowEnergyControllerPrivate::handleConnectionRequest() emit q->connected(); } -void QLowEnergyControllerPrivate::closeServerSocket() +void QLowEnergyControllerPrivateCommon::closeServerSocket() { if (!serverSocketNotifier) return; @@ -3049,7 +3049,7 @@ void QLowEnergyControllerPrivate::closeServerSocket() serverSocketNotifier = nullptr; } -bool QLowEnergyControllerPrivate::isBonded() const +bool QLowEnergyControllerPrivateCommon::isBonded() const { // Pairing does not necessarily imply bonding, but we don't know whether the // bonding flag was set in the original pairing request. @@ -3057,7 +3057,7 @@ bool QLowEnergyControllerPrivate::isBonded() const != QBluetoothLocalDevice::Unpaired; } -QVector<QLowEnergyControllerPrivate::TempClientConfigurationData> QLowEnergyControllerPrivate::gatherClientConfigData() +QVector<QLowEnergyControllerPrivateCommon::TempClientConfigurationData> QLowEnergyControllerPrivateCommon::gatherClientConfigData() { QVector<TempClientConfigurationData> data; foreach (const auto &service, localServices) { @@ -3078,7 +3078,7 @@ QVector<QLowEnergyControllerPrivate::TempClientConfigurationData> QLowEnergyCont return data; } -void QLowEnergyControllerPrivate::storeClientConfigurations() +void QLowEnergyControllerPrivateCommon::storeClientConfigurations() { if (!isBonded()) { clientConfigData.remove(remoteDevice.toUInt64()); @@ -3097,7 +3097,7 @@ void QLowEnergyControllerPrivate::storeClientConfigurations() clientConfigData.insert(remoteDevice.toUInt64(), clientConfigs); } -void QLowEnergyControllerPrivate::restoreClientConfigurations() +void QLowEnergyControllerPrivateCommon::restoreClientConfigurations() { const QVector<TempClientConfigurationData> &tempConfigList = gatherClientConfigData(); const QVector<ClientConfigurationData> &restoredClientConfigs = isBonded() @@ -3131,7 +3131,7 @@ void QLowEnergyControllerPrivate::restoreClientConfigurations() sendNextIndication(); } -void QLowEnergyControllerPrivate::loadSigningDataIfNecessary(SigningKeyType keyType) +void QLowEnergyControllerPrivateCommon::loadSigningDataIfNecessary(SigningKeyType keyType) { const auto signingDataIt = signingData.constFind(remoteDevice.toUInt64()); if (signingDataIt != signingData.constEnd()) @@ -3163,7 +3163,7 @@ void QLowEnergyControllerPrivate::loadSigningDataIfNecessary(SigningKeyType keyT signingData.insert(remoteDevice.toUInt64(), SigningData(csrk, counter - 1)); } -void QLowEnergyControllerPrivate::storeSignCounter(SigningKeyType keyType) const +void QLowEnergyControllerPrivateCommon::storeSignCounter(SigningKeyType keyType) const { const auto signingDataIt = signingData.constFind(remoteDevice.toUInt64()); if (signingDataIt == signingData.constEnd()) @@ -3184,12 +3184,12 @@ void QLowEnergyControllerPrivate::storeSignCounter(SigningKeyType keyType) const settings.setValue(counterKey, counterValue); } -QString QLowEnergyControllerPrivate::signingKeySettingsGroup(SigningKeyType keyType) const +QString QLowEnergyControllerPrivateCommon::signingKeySettingsGroup(SigningKeyType keyType) const { return QLatin1String(keyType == LocalSigningKey ? "LocalSignatureKey" : "RemoteSignatureKey"); } -QString QLowEnergyControllerPrivate::keySettingsFilePath() const +QString QLowEnergyControllerPrivateCommon::keySettingsFilePath() const { return QString::fromLatin1("/var/lib/bluetooth/%1/%2/info") .arg(localAdapter.toString(), remoteDevice.toString()); @@ -3211,7 +3211,7 @@ static QByteArray uuidToByteArray(const QBluetoothUuid &uuid) return ba; } -void QLowEnergyControllerPrivate::addToGenericAttributeList(const QLowEnergyServiceData &service, +void QLowEnergyControllerPrivateCommon::addToGenericAttributeList(const QLowEnergyServiceData &service, QLowEnergyHandle startHandle) { // Construct generic attribute data for the service with handles as keys. @@ -3321,7 +3321,7 @@ void QLowEnergyControllerPrivate::addToGenericAttributeList(const QLowEnergyServ localAttributes[serviceAttribute.handle] = serviceAttribute; } -void QLowEnergyControllerPrivate::ensureUniformAttributes(QVector<Attribute> &attributes, +void QLowEnergyControllerPrivateCommon::ensureUniformAttributes(QVector<Attribute> &attributes, const std::function<int (const Attribute &)> &getSize) { if (attributes.isEmpty()) @@ -3334,19 +3334,19 @@ void QLowEnergyControllerPrivate::ensureUniformAttributes(QVector<Attribute> &at } -void QLowEnergyControllerPrivate::ensureUniformUuidSizes(QVector<Attribute> &attributes) +void QLowEnergyControllerPrivateCommon::ensureUniformUuidSizes(QVector<Attribute> &attributes) { ensureUniformAttributes(attributes, [](const Attribute &attr) { return getUuidSize(attr.type); }); } -void QLowEnergyControllerPrivate::ensureUniformValueSizes(QVector<Attribute> &attributes) +void QLowEnergyControllerPrivateCommon::ensureUniformValueSizes(QVector<Attribute> &attributes) { ensureUniformAttributes(attributes, [](const Attribute &attr) { return attr.value.count(); }); } -QVector<QLowEnergyControllerPrivate::Attribute> QLowEnergyControllerPrivate::getAttributes(QLowEnergyHandle startHandle, +QVector<QLowEnergyControllerPrivateCommon::Attribute> QLowEnergyControllerPrivateCommon::getAttributes(QLowEnergyHandle startHandle, QLowEnergyHandle endHandle, const AttributePredicate &attributePredicate) { QVector<Attribute> results; @@ -3365,7 +3365,7 @@ QVector<QLowEnergyControllerPrivate::Attribute> QLowEnergyControllerPrivate::get return results; } -int QLowEnergyControllerPrivate::checkPermissions(const Attribute &attr, +int QLowEnergyControllerPrivateCommon::checkPermissions(const Attribute &attr, QLowEnergyCharacteristic::PropertyType type) { const bool isReadAccess = type == QLowEnergyCharacteristic::Read; @@ -3399,12 +3399,12 @@ int QLowEnergyControllerPrivate::checkPermissions(const Attribute &attr, return 0; } -int QLowEnergyControllerPrivate::checkReadPermissions(const Attribute &attr) +int QLowEnergyControllerPrivateCommon::checkReadPermissions(const Attribute &attr) { return checkPermissions(attr, QLowEnergyCharacteristic::Read); } -int QLowEnergyControllerPrivate::checkReadPermissions(QVector<Attribute> &attributes) +int QLowEnergyControllerPrivateCommon::checkReadPermissions(QVector<Attribute> &attributes) { if (attributes.isEmpty()) return 0; @@ -3424,7 +3424,7 @@ int QLowEnergyControllerPrivate::checkReadPermissions(QVector<Attribute> &attrib return 0; } -bool QLowEnergyControllerPrivate::verifyMac(const QByteArray &message, const quint128 &csrk, +bool QLowEnergyControllerPrivateCommon::verifyMac(const QByteArray &message, const quint128 &csrk, quint32 signCounter, quint64 expectedMac) { if (!cmacCalculator) diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp index dc8fc721..95721e0c 100644 --- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp +++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QLowEnergyControllerPrivateBluezDBus::QLowEnergyControllerPrivateBluezDBus() - : QLowEnergyControllerPrivateBase() + : QLowEnergyControllerPrivate() { } diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus_p.h b/src/bluetooth/qlowenergycontroller_bluezdbus_p.h index fb7f3e7a..b10199f5 100644 --- a/src/bluetooth/qlowenergycontroller_bluezdbus_p.h +++ b/src/bluetooth/qlowenergycontroller_bluezdbus_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -class QLowEnergyControllerPrivateBluezDBus : public QLowEnergyControllerPrivateBase +class QLowEnergyControllerPrivateBluezDBus : public QLowEnergyControllerPrivate { Q_OBJECT public: diff --git a/src/bluetooth/qlowenergycontroller_p.cpp b/src/bluetooth/qlowenergycontroller_p.cpp index 5c82c1fe..f75c92e2 100644 --- a/src/bluetooth/qlowenergycontroller_p.cpp +++ b/src/bluetooth/qlowenergycontroller_p.cpp @@ -44,8 +44,8 @@ QT_BEGIN_NAMESPACE -QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() - : QLowEnergyControllerPrivateBase(), +QLowEnergyControllerPrivateCommon::QLowEnergyControllerPrivateCommon() + : QLowEnergyControllerPrivate(), lastLocalHandle(0) { #ifndef QT_IOS_BLUETOOTH @@ -54,15 +54,15 @@ QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() registerQLowEnergyControllerMetaType(); } -QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() +QLowEnergyControllerPrivateCommon::~QLowEnergyControllerPrivateCommon() { } -void QLowEnergyControllerPrivate::init() +void QLowEnergyControllerPrivateCommon::init() { } -void QLowEnergyControllerPrivate::connectToDevice() +void QLowEnergyControllerPrivateCommon::connectToDevice() { // required to pass unit test on default backend if (remoteDevice.isNull()) { @@ -71,39 +71,39 @@ void QLowEnergyControllerPrivate::connectToDevice() return; } - qWarning() << "QLowEnergyControllerPrivate::connectToDevice(): Not implemented"; + qWarning() << "QLowEnergyControllerPrivateCommon::connectToDevice(): Not implemented"; setError(QLowEnergyController::UnknownError); } -void QLowEnergyControllerPrivate::disconnectFromDevice() +void QLowEnergyControllerPrivateCommon::disconnectFromDevice() { } -void QLowEnergyControllerPrivate::discoverServices() +void QLowEnergyControllerPrivateCommon::discoverServices() { } -void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &/*service*/) +void QLowEnergyControllerPrivateCommon::discoverServiceDetails(const QBluetoothUuid &/*service*/) { } -void QLowEnergyControllerPrivate::readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> /*service*/, +void QLowEnergyControllerPrivateCommon::readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> /*service*/, const QLowEnergyHandle /*charHandle*/) { } -void QLowEnergyControllerPrivate::readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> /*service*/, +void QLowEnergyControllerPrivateCommon::readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> /*service*/, const QLowEnergyHandle /*charHandle*/, const QLowEnergyHandle /*descriptorHandle*/) { } -void QLowEnergyControllerPrivate::writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> /*service*/, +void QLowEnergyControllerPrivateCommon::writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> /*service*/, const QLowEnergyHandle /*charHandle*/, const QByteArray &/*newValue*/, QLowEnergyService::WriteMode /*writeMode*/) @@ -111,7 +111,7 @@ void QLowEnergyControllerPrivate::writeCharacteristic(const QSharedPointer<QLowE } -void QLowEnergyControllerPrivate::writeDescriptor( +void QLowEnergyControllerPrivateCommon::writeDescriptor( const QSharedPointer<QLowEnergyServicePrivate> /*service*/, const QLowEnergyHandle /*charHandle*/, const QLowEnergyHandle /*descriptorHandle*/, @@ -120,21 +120,21 @@ void QLowEnergyControllerPrivate::writeDescriptor( } -void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingParameters &/* params */, +void QLowEnergyControllerPrivateCommon::startAdvertising(const QLowEnergyAdvertisingParameters &/* params */, const QLowEnergyAdvertisingData &/* advertisingData */, const QLowEnergyAdvertisingData &/* scanResponseData */) { } -void QLowEnergyControllerPrivate::stopAdvertising() +void QLowEnergyControllerPrivateCommon::stopAdvertising() { } -void QLowEnergyControllerPrivate::requestConnectionUpdate(const QLowEnergyConnectionParameters & /* params */) +void QLowEnergyControllerPrivateCommon::requestConnectionUpdate(const QLowEnergyConnectionParameters & /* params */) { } -void QLowEnergyControllerPrivate::addToGenericAttributeList(const QLowEnergyServiceData &/* service */, +void QLowEnergyControllerPrivateCommon::addToGenericAttributeList(const QLowEnergyServiceData &/* service */, QLowEnergyHandle /* startHandle */) { } diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h index c00a56a0..0cf62ad7 100644 --- a/src/bluetooth/qlowenergycontroller_p.h +++ b/src/bluetooth/qlowenergycontroller_p.h @@ -109,12 +109,12 @@ extern void registerQLowEnergyControllerMetaType(); class QLeAdvertiser; -class QLowEnergyControllerPrivate : public QLowEnergyControllerPrivateBase +class QLowEnergyControllerPrivateCommon : public QLowEnergyControllerPrivate { Q_OBJECT public: - QLowEnergyControllerPrivate(); - ~QLowEnergyControllerPrivate(); + QLowEnergyControllerPrivateCommon(); + ~QLowEnergyControllerPrivateCommon(); void init() override; @@ -451,7 +451,7 @@ private: }; -Q_DECLARE_TYPEINFO(QLowEnergyControllerPrivate::Attribute, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QLowEnergyControllerPrivateCommon::Attribute, Q_MOVABLE_TYPE); QT_END_NAMESPACE diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index 37195bad..891f1ea4 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -274,8 +274,8 @@ signals: QLowEnergyHandle startHandle, QLowEnergyHandle endHandle); }; -QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() - : QLowEnergyControllerPrivateBase() +QLowEnergyControllerPrivateCommon::QLowEnergyControllerPrivateCommon() + : QLowEnergyControllerPrivate() { qCDebug(QT_BT_WINRT) << __FUNCTION__; @@ -283,7 +283,7 @@ QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() qRegisterMetaType<QLowEnergyDescriptor>(); } -QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() +QLowEnergyControllerPrivateCommon::~QLowEnergyControllerPrivateCommon() { if (mDevice && mStatusChangedToken.value) mDevice->remove_ConnectionStatusChanged(mStatusChangedToken); @@ -293,11 +293,11 @@ QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() entry.characteristic->remove_ValueChanged(entry.token); } -void QLowEnergyControllerPrivate::init() +void QLowEnergyControllerPrivateCommon::init() { } -void QLowEnergyControllerPrivate::connectToDevice() +void QLowEnergyControllerPrivateCommon::connectToDevice() { qCDebug(QT_BT_WINRT) << __FUNCTION__; Q_Q(QLowEnergyController); @@ -415,7 +415,7 @@ void QLowEnergyControllerPrivate::connectToDevice() } } -void QLowEnergyControllerPrivate::disconnectFromDevice() +void QLowEnergyControllerPrivateCommon::disconnectFromDevice() { qCDebug(QT_BT_WINRT) << __FUNCTION__; Q_Q(QLowEnergyController); @@ -427,7 +427,7 @@ void QLowEnergyControllerPrivate::disconnectFromDevice() } } -ComPtr<IGattDeviceService> QLowEnergyControllerPrivate::getNativeService(const QBluetoothUuid &serviceUuid) +ComPtr<IGattDeviceService> QLowEnergyControllerPrivateCommon::getNativeService(const QBluetoothUuid &serviceUuid) { ComPtr<IGattDeviceService> deviceService; HRESULT hr; @@ -437,7 +437,7 @@ ComPtr<IGattDeviceService> QLowEnergyControllerPrivate::getNativeService(const Q return deviceService; } -ComPtr<IGattCharacteristic> QLowEnergyControllerPrivate::getNativeCharacteristic(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid) +ComPtr<IGattCharacteristic> QLowEnergyControllerPrivateCommon::getNativeCharacteristic(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid) { ComPtr<IGattDeviceService> service = getNativeService(serviceUuid); if (!service) @@ -452,7 +452,7 @@ ComPtr<IGattCharacteristic> QLowEnergyControllerPrivate::getNativeCharacteristic return characteristic; } -void QLowEnergyControllerPrivate::registerForValueChanges(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid) +void QLowEnergyControllerPrivateCommon::registerForValueChanges(const QBluetoothUuid &serviceUuid, const QBluetoothUuid &charUuid) { qCDebug(QT_BT_WINRT) << "Registering characteristic" << charUuid << "in service" << serviceUuid << "for value changes"; @@ -485,7 +485,7 @@ void QLowEnergyControllerPrivate::registerForValueChanges(const QBluetoothUuid & << serviceUuid << "registered for value changes"; } -void QLowEnergyControllerPrivate::obtainIncludedServices(QSharedPointer<QLowEnergyServicePrivate> servicePointer, +void QLowEnergyControllerPrivateCommon::obtainIncludedServices(QSharedPointer<QLowEnergyServicePrivate> servicePointer, ComPtr<IGattDeviceService> service) { Q_Q(QLowEnergyController); @@ -527,7 +527,7 @@ void QLowEnergyControllerPrivate::obtainIncludedServices(QSharedPointer<QLowEner } } -void QLowEnergyControllerPrivate::discoverServices() +void QLowEnergyControllerPrivateCommon::discoverServices() { Q_Q(QLowEnergyController); @@ -569,7 +569,7 @@ void QLowEnergyControllerPrivate::discoverServices() emit q->discoveryFinished(); } -void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &service) +void QLowEnergyControllerPrivateCommon::discoverServiceDetails(const QBluetoothUuid &service) { qCDebug(QT_BT_WINRT) << __FUNCTION__ << service; if (!serviceList.contains(service)) { @@ -654,22 +654,22 @@ void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &s thread->start(); } -void QLowEnergyControllerPrivate::startAdvertising(const QLowEnergyAdvertisingParameters &, const QLowEnergyAdvertisingData &, const QLowEnergyAdvertisingData &) +void QLowEnergyControllerPrivateCommon::startAdvertising(const QLowEnergyAdvertisingParameters &, const QLowEnergyAdvertisingData &, const QLowEnergyAdvertisingData &) { Q_UNIMPLEMENTED(); } -void QLowEnergyControllerPrivate::stopAdvertising() +void QLowEnergyControllerPrivateCommon::stopAdvertising() { Q_UNIMPLEMENTED(); } -void QLowEnergyControllerPrivate::requestConnectionUpdate(const QLowEnergyConnectionParameters &) +void QLowEnergyControllerPrivateCommon::requestConnectionUpdate(const QLowEnergyConnectionParameters &) { Q_UNIMPLEMENTED(); } -void QLowEnergyControllerPrivate::readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service, +void QLowEnergyControllerPrivateCommon::readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle) { qCDebug(QT_BT_WINRT) << __FUNCTION__ << service << charHandle; @@ -727,7 +727,7 @@ void QLowEnergyControllerPrivate::readCharacteristic(const QSharedPointer<QLowEn Q_ASSERT_SUCCEEDED(hr); } -void QLowEnergyControllerPrivate::readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service, +void QLowEnergyControllerPrivateCommon::readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descHandle) { @@ -852,7 +852,7 @@ void QLowEnergyControllerPrivate::readDescriptor(const QSharedPointer<QLowEnergy Q_ASSERT_SUCCEEDED(hr); } -void QLowEnergyControllerPrivate::writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service, +void QLowEnergyControllerPrivateCommon::writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QByteArray &newValue, QLowEnergyService::WriteMode mode) @@ -935,7 +935,7 @@ void QLowEnergyControllerPrivate::writeCharacteristic(const QSharedPointer<QLowE Q_ASSERT_SUCCEEDED(hr); } -void QLowEnergyControllerPrivate::writeDescriptor( +void QLowEnergyControllerPrivateCommon::writeDescriptor( const QSharedPointer<QLowEnergyServicePrivate> service, const QLowEnergyHandle charHandle, const QLowEnergyHandle descHandle, @@ -1074,12 +1074,12 @@ void QLowEnergyControllerPrivate::writeDescriptor( } -void QLowEnergyControllerPrivate::addToGenericAttributeList(const QLowEnergyServiceData &, QLowEnergyHandle) +void QLowEnergyControllerPrivateCommon::addToGenericAttributeList(const QLowEnergyServiceData &, QLowEnergyHandle) { Q_UNIMPLEMENTED(); } -void QLowEnergyControllerPrivate::characteristicChanged( +void QLowEnergyControllerPrivateCommon::characteristicChanged( int charHandle, const QByteArray &data) { QSharedPointer<QLowEnergyServicePrivate> service = diff --git a/src/bluetooth/qlowenergycontrollerbase.cpp b/src/bluetooth/qlowenergycontrollerbase.cpp index 0b8218e9..22fdd52b 100644 --- a/src/bluetooth/qlowenergycontrollerbase.cpp +++ b/src/bluetooth/qlowenergycontrollerbase.cpp @@ -44,16 +44,16 @@ QT_BEGIN_NAMESPACE -QLowEnergyControllerPrivateBase::QLowEnergyControllerPrivateBase() +QLowEnergyControllerPrivate::QLowEnergyControllerPrivate() : QObject() { } -QLowEnergyControllerPrivateBase::~QLowEnergyControllerPrivateBase() +QLowEnergyControllerPrivate::~QLowEnergyControllerPrivate() { } -bool QLowEnergyControllerPrivateBase::isValidLocalAdapter() +bool QLowEnergyControllerPrivate::isValidLocalAdapter() { #ifdef QT_WINRT_BLUETOOTH return true; @@ -75,7 +75,7 @@ bool QLowEnergyControllerPrivateBase::isValidLocalAdapter() } -void QLowEnergyControllerPrivateBase::setError( +void QLowEnergyControllerPrivate::setError( QLowEnergyController::Error newError) { Q_Q(QLowEnergyController); @@ -111,7 +111,7 @@ void QLowEnergyControllerPrivateBase::setError( emit q->error(newError); } -void QLowEnergyControllerPrivateBase::setState( +void QLowEnergyControllerPrivate::setState( QLowEnergyController::ControllerState newState) { Q_Q(QLowEnergyController); @@ -126,7 +126,7 @@ void QLowEnergyControllerPrivateBase::setState( emit q->stateChanged(state); } -QSharedPointer<QLowEnergyServicePrivate> QLowEnergyControllerPrivateBase::serviceForHandle( +QSharedPointer<QLowEnergyServicePrivate> QLowEnergyControllerPrivate::serviceForHandle( QLowEnergyHandle handle) { ServiceDataMap ¤tList = serviceList; @@ -145,7 +145,7 @@ QSharedPointer<QLowEnergyServicePrivate> QLowEnergyControllerPrivateBase::servic Returns a valid characteristic if the given handle is the handle of the characteristic itself or one of its descriptors */ -QLowEnergyCharacteristic QLowEnergyControllerPrivateBase::characteristicForHandle( +QLowEnergyCharacteristic QLowEnergyControllerPrivate::characteristicForHandle( QLowEnergyHandle handle) { QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(handle); @@ -176,7 +176,7 @@ QLowEnergyCharacteristic QLowEnergyControllerPrivateBase::characteristicForHandl Returns a valid descriptor if \a handle belongs to a descriptor; otherwise an invalid one. */ -QLowEnergyDescriptor QLowEnergyControllerPrivateBase::descriptorForHandle( +QLowEnergyDescriptor QLowEnergyControllerPrivate::descriptorForHandle( QLowEnergyHandle handle) { const QLowEnergyCharacteristic matchingChar = characteristicForHandle(handle); @@ -196,7 +196,7 @@ QLowEnergyDescriptor QLowEnergyControllerPrivateBase::descriptorForHandle( /*! Returns the length of the updated characteristic value. */ -quint16 QLowEnergyControllerPrivateBase::updateValueOfCharacteristic( +quint16 QLowEnergyControllerPrivate::updateValueOfCharacteristic( QLowEnergyHandle charHandle,const QByteArray &value, bool appendValue) { QSharedPointer<QLowEnergyServicePrivate> service = serviceForHandle(charHandle); @@ -220,7 +220,7 @@ quint16 QLowEnergyControllerPrivateBase::updateValueOfCharacteristic( /*! Returns the length of the updated descriptor value. */ -quint16 QLowEnergyControllerPrivateBase::updateValueOfDescriptor( +quint16 QLowEnergyControllerPrivate::updateValueOfDescriptor( QLowEnergyHandle charHandle, QLowEnergyHandle descriptorHandle, const QByteArray &value, bool appendValue) { @@ -247,7 +247,7 @@ quint16 QLowEnergyControllerPrivateBase::updateValueOfDescriptor( return 0; } -void QLowEnergyControllerPrivateBase::invalidateServices() +void QLowEnergyControllerPrivate::invalidateServices() { foreach (const QSharedPointer<QLowEnergyServicePrivate> service, serviceList.values()) { service->setController(0); diff --git a/src/bluetooth/qlowenergycontrollerbase_p.h b/src/bluetooth/qlowenergycontrollerbase_p.h index 3555e7e8..27ab47ec 100644 --- a/src/bluetooth/qlowenergycontrollerbase_p.h +++ b/src/bluetooth/qlowenergycontrollerbase_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE typedef QMap<QBluetoothUuid, QSharedPointer<QLowEnergyServicePrivate> > ServiceDataMap; -class QLowEnergyControllerPrivateBase : public QObject +class QLowEnergyControllerPrivate : public QObject { Q_OBJECT public: @@ -72,8 +72,8 @@ public: // Bluez has a low level ATT protocol stack implementation and a DBus // implementation. - QLowEnergyControllerPrivateBase(); - virtual ~QLowEnergyControllerPrivateBase(); + QLowEnergyControllerPrivate(); + virtual ~QLowEnergyControllerPrivate(); // interface definition virtual void init() = 0; diff --git a/src/bluetooth/qlowenergydescriptor.h b/src/bluetooth/qlowenergydescriptor.h index efc748a3..b1ed38bd 100644 --- a/src/bluetooth/qlowenergydescriptor.h +++ b/src/bluetooth/qlowenergydescriptor.h @@ -78,8 +78,8 @@ protected: friend class QLowEnergyCharacteristic; friend class QLowEnergyService; + friend class QLowEnergyControllerPrivateCommon; friend class QLowEnergyControllerPrivate; - friend class QLowEnergyControllerPrivateBase; friend class QLowEnergyControllerPrivateOSX; QLowEnergyDescriptorPrivate *data; diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index 3f6cfd88..eb453ad3 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QLowEnergyServicePrivate; -class QLowEnergyControllerPrivate; +class QLowEnergyControllerPrivateCommon; class Q_BLUETOOTH_EXPORT QLowEnergyService : public QObject { Q_OBJECT @@ -134,7 +134,7 @@ private: // QLowEnergyController is the factory for this class friend class QLowEnergyController; - friend class QLowEnergyControllerPrivate; + friend class QLowEnergyControllerPrivateCommon; QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> p, QObject *parent = nullptr); }; diff --git a/src/bluetooth/qlowenergyserviceprivate.cpp b/src/bluetooth/qlowenergyserviceprivate.cpp index e16aec72..83724d4e 100644 --- a/src/bluetooth/qlowenergyserviceprivate.cpp +++ b/src/bluetooth/qlowenergyserviceprivate.cpp @@ -57,7 +57,7 @@ QLowEnergyServicePrivate::~QLowEnergyServicePrivate() { } -void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivateBase *control) +void QLowEnergyServicePrivate::setController(QLowEnergyControllerPrivate *control) { controller = control; diff --git a/src/bluetooth/qlowenergyserviceprivate_p.h b/src/bluetooth/qlowenergyserviceprivate_p.h index 3a0edd8a..7727b583 100644 --- a/src/bluetooth/qlowenergyserviceprivate_p.h +++ b/src/bluetooth/qlowenergyserviceprivate_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE -class QLowEnergyControllerPrivateBase; +class QLowEnergyControllerPrivate; class QLowEnergyServicePrivate : public QObject { @@ -92,7 +92,7 @@ public: Characteristic = 0x2803 }; - void setController(QLowEnergyControllerPrivateBase* control); + void setController(QLowEnergyControllerPrivate* control); void setError(QLowEnergyService::ServiceError newError); void setState(QLowEnergyService::ServiceState newState); @@ -122,7 +122,7 @@ public: QHash<QLowEnergyHandle, CharData> characteristicList; - QPointer<QLowEnergyControllerPrivateBase> controller; + QPointer<QLowEnergyControllerPrivate> controller; #if defined(QT_ANDROID_BLUETOOTH) // reference to the BluetoothGattService object |