summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_bluez.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-10-25 14:49:47 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-11-03 13:08:51 +0000
commitfbf36811672de79f2a648af97ca73d6c0e3b1608 (patch)
treeaee123e7d84a4451118a389d62d0e32cd6635692 /src/bluetooth/qlowenergycontroller_bluez.cpp
parent7a9d2e77befb13c1f714f842d4b0ee3fea2d4a6c (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>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_bluez.cpp')
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp188
1 files changed, 94 insertions, 94 deletions
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 &params,
+void QLowEnergyControllerPrivateCommon::startAdvertising(const QLowEnergyAdvertisingParameters &params,
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 &params)
+void QLowEnergyControllerPrivateCommon::requestConnectionUpdate(const QLowEnergyConnectionParameters &params)
{
// 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)