diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2017-04-03 16:24:25 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2017-04-06 08:27:29 +0000 |
commit | 26293d827f8c15dcc787acc5aa8f2e0277f9ce5f (patch) | |
tree | d96a37c6504720e305eb03903e18b8096bd0c8a4 /examples/bluetooth/heartrate-game/devicehandler.cpp | |
parent | ba56814fa4f0ca4a20d8448dcee95e5bf7c9d3a5 (diff) |
Update heartrate-game against latest heartlistener example
This patch incorporates the following two heartlistener patch:
1750983d3f053316c735d602c7f9a1b56dc4462b
b01389be13b40833fa3f50a862b164c5d8389d1a
The above two patches were applied to the heartlistener example after
the fork for the new heartrate-game example was done. This patch applies
the missing two patches.
The first patch restricts the communication to Low Energy devices
The second patch ensures that the device properly disables the
heartrate notifications on disconnect events.
Change-Id: Ia2904f2ae3d5cef22abcc9815c5e0c342370e83c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'examples/bluetooth/heartrate-game/devicehandler.cpp')
-rw-r--r-- | examples/bluetooth/heartrate-game/devicehandler.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/bluetooth/heartrate-game/devicehandler.cpp b/examples/bluetooth/heartrate-game/devicehandler.cpp index 96c78313..153a99fb 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.cpp +++ b/examples/bluetooth/heartrate-game/devicehandler.cpp @@ -249,7 +249,7 @@ void DeviceHandler::updateDemoHR() void DeviceHandler::confirmedDescriptorWrite(const QLowEnergyDescriptor &d, const QByteArray &value) { - if (d.isValid() && d == m_notificationDesc && value == QByteArray("0000")) { + if (d.isValid() && d == m_notificationDesc && value == QByteArray::fromHex("0000")) { //disabled notifications -> assume disconnect intent m_control->disconnectFromDevice(); delete m_service; @@ -262,7 +262,8 @@ void DeviceHandler::disconnectService() m_foundHeartRateService = false; //disable notifications - if (m_notificationDesc.isValid() && m_service) { + if (m_notificationDesc.isValid() && m_service + && m_notificationDesc.value() == QByteArray::fromHex("0100")) { m_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0000")); } else { if (m_control) |