summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_p.h
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-10-24 16:46:03 +0200
committerAlex Blasche <alexander.blasche@qt.io>2017-11-03 13:08:45 +0000
commit59ae3cc2ac7baee7e9df1e6ceffcfc882fbe6121 (patch)
tree1c267a06201507d10dd4571942089b56c2d617f5 /src/bluetooth/qlowenergycontroller_p.h
parent4ab8bd20b590f96763dd93f4436327042fbd27da (diff)
Introduce Base class for QLowEnergyControllerPrivate
This permits alternative implementations selectable at runtime. Currently this is only used by Bluez. Change-Id: I3ddeb7f888f3b09bdc62f10d5b9a36320500f329 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_p.h')
-rw-r--r--src/bluetooth/qlowenergycontroller_p.h60
1 files changed, 17 insertions, 43 deletions
diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h
index 6e866144..a9bd23fc 100644
--- a/src/bluetooth/qlowenergycontroller_p.h
+++ b/src/bluetooth/qlowenergycontroller_p.h
@@ -75,7 +75,7 @@ QT_END_NAMESPACE
#include <QtBluetooth/qbluetooth.h>
#include <QtBluetooth/qlowenergycharacteristic.h>
#include "qlowenergycontroller.h"
-#include "qlowenergyserviceprivate_p.h"
+#include "qlowenergycontrollerbase_p.h"
#if QT_CONFIG(bluez) && !defined(QT_BLUEZ_NO_BTLE)
#include <QtBluetooth/QBluetoothSocket>
@@ -107,47 +107,39 @@ class QWinRTLowEnergyServiceHandler;
extern void registerQLowEnergyControllerMetaType();
-typedef QMap<QBluetoothUuid, QSharedPointer<QLowEnergyServicePrivate> > ServiceDataMap;
class QLeAdvertiser;
-class QLowEnergyControllerPrivate : public QObject
+class QLowEnergyControllerPrivate : public QLowEnergyControllerPrivateBase
{
Q_OBJECT
- Q_DECLARE_PUBLIC(QLowEnergyController)
public:
QLowEnergyControllerPrivate();
~QLowEnergyControllerPrivate();
- void init();
-
- void setError(QLowEnergyController::Error newError);
- bool isValidLocalAdapter();
-
- void setState(QLowEnergyController::ControllerState newState);
+ void init() override;
- void connectToDevice();
- void disconnectFromDevice();
+ void connectToDevice() override;
+ void disconnectFromDevice() override;
- void discoverServices();
+ void discoverServices() override;
void invalidateServices();
- void discoverServiceDetails(const QBluetoothUuid &service);
+ void discoverServiceDetails(const QBluetoothUuid &service) override;
void startAdvertising(const QLowEnergyAdvertisingParameters &params,
const QLowEnergyAdvertisingData &advertisingData,
- const QLowEnergyAdvertisingData &scanResponseData);
- void stopAdvertising();
+ const QLowEnergyAdvertisingData &scanResponseData) override;
+ void stopAdvertising() override;
- void requestConnectionUpdate(const QLowEnergyConnectionParameters &params);
+ void requestConnectionUpdate(const QLowEnergyConnectionParameters &params) override;
// misc helpers
- QSharedPointer<QLowEnergyServicePrivate> serviceForHandle(
- QLowEnergyHandle handle);
+
QLowEnergyCharacteristic characteristicForHandle(
QLowEnergyHandle handle);
QLowEnergyDescriptor descriptorForHandle(
QLowEnergyHandle handle);
- QLowEnergyService *addServiceHelper(const QLowEnergyServiceData &service);
+ QLowEnergyService *addServiceHelper(const QLowEnergyServiceData &service) override;
quint16 updateValueOfCharacteristic(QLowEnergyHandle charHandle,
@@ -160,39 +152,25 @@ public:
// read data
void readCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
- const QLowEnergyHandle charHandle);
+ const QLowEnergyHandle charHandle) override;
void readDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
const QLowEnergyHandle charHandle,
- const QLowEnergyHandle descriptorHandle);
+ const QLowEnergyHandle descriptorHandle) override;
// write data
void writeCharacteristic(const QSharedPointer<QLowEnergyServicePrivate> service,
const QLowEnergyHandle charHandle,
- const QByteArray &newValue, QLowEnergyService::WriteMode mode);
+ const QByteArray &newValue, QLowEnergyService::WriteMode mode) override;
void writeDescriptor(const QSharedPointer<QLowEnergyServicePrivate> service,
const QLowEnergyHandle charHandle,
const QLowEnergyHandle descriptorHandle,
- const QByteArray &newValue);
+ const QByteArray &newValue) override;
void addToGenericAttributeList(const QLowEnergyServiceData &service,
- QLowEnergyHandle startHandle);
+ QLowEnergyHandle startHandle) override;
- QBluetoothAddress remoteDevice;
- QBluetoothAddress localAdapter;
- QLowEnergyController::Role role;
-
- QString remoteName;
-
- QLowEnergyController::ControllerState state;
- QLowEnergyController::Error error;
- QString errorString;
-
- // list of all found service uuids on remote device
- ServiceDataMap serviceList;
QLowEnergyHandle lastLocalHandle;
- // list of all service uuids on local peripheral device
- ServiceDataMap localServices;
struct Attribute {
Attribute() : handle(0) {}
@@ -209,8 +187,6 @@ public:
};
QVector<Attribute> localAttributes;
- QLowEnergyController::RemoteAddressType addressType;
-
private:
#if QT_CONFIG(bluez) && !defined(QT_BLUEZ_NO_BTLE)
quint16 connectionHandle = 0;
@@ -488,8 +464,6 @@ private:
void obtainIncludedServices(QSharedPointer<QLowEnergyServicePrivate> servicePointer,
Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattDeviceService> nativeService);
#endif
-private:
- QLowEnergyController *q_ptr;
};