diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-03-15 13:19:46 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-04-05 08:41:58 +0000 |
commit | 6520f8af711a9b61b194d163bb8f1db53b514ef6 (patch) | |
tree | 738fb51c63408e936b7b89a6efaef063fc4c8211 /examples/bluetooth/heartrate-game/devicehandler.h | |
parent | 39ed984d372f66299eba86be4e80e6ebffb96926 (diff) |
Permit BlueZ platforms to set the address type in heartrate-game
BlueZ is the only platform that requires to set the BTLE address type.
The patch introduces a new UI button which allows the user to toggle
the address type.
The UI element is disabled on all platforms but Linux/BlueZ systems.
The number of devices returned in simulator mode is reduced to
four devices. This was done purely for esthetical reasons as the
additional address type button takes screen real estate away and
five simulator devices require more screen real estate than the
remaining space for device list. This avoid the need for scrolling.
Change-Id: I14cf26b3c821db7768b9d018c2d09441cd97679a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'examples/bluetooth/heartrate-game/devicehandler.h')
-rw-r--r-- | examples/bluetooth/heartrate-game/devicehandler.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/bluetooth/heartrate-game/devicehandler.h b/examples/bluetooth/heartrate-game/devicehandler.h index 08831cb3..950ed6e9 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.h +++ b/examples/bluetooth/heartrate-game/devicehandler.h @@ -63,11 +63,21 @@ class DeviceHandler : public BluetoothBaseClass Q_PROPERTY(float average READ average NOTIFY statsChanged) Q_PROPERTY(int time READ time NOTIFY statsChanged) Q_PROPERTY(float calories READ calories NOTIFY statsChanged) + Q_PROPERTY(AddressType addressType READ addressType WRITE setAddressType) public: + enum class AddressType { + PublicAddress, + RandomAddress + }; + Q_ENUM(AddressType) + DeviceHandler(QObject *parent = 0); void setDevice(DeviceInfo *device); + void setAddressType(AddressType type); + AddressType addressType() const; + bool measuring() const; bool alive() const; @@ -122,6 +132,7 @@ private: QDateTime m_stop; QVector<int> m_measurements; + QLowEnergyController::RemoteAddressType m_addressType = QLowEnergyController::PublicAddress; #ifdef SIMULATOR QTimer m_demoTimer; |