diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-08-19 15:11:47 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-08-25 14:03:19 +0200 |
commit | 7a3a3f7664e22dbe2e5bc8f016d95ee1f9558a2e (patch) | |
tree | 0eb86096868951ae27b294eb7b6030aceb42e8fe | |
parent | 1da3df99c196ed89696b4c8a10cfd8b191b8b0f0 (diff) |
First round of fixes for heartrate example docs
Remove old and obsolte code description. Later this will be readded
based on the Bluetooth-le-overview documentation which describes the
same thing.
Improve screenshot section of the example.
Change-Id: I499809fa0afdb27f09844678a52d0ce5a492b3c0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
-rw-r--r-- | examples/bluetooth/heartlistener/doc/images/hearrateresults.png | bin | 38983 -> 0 bytes | |||
-rw-r--r-- | examples/bluetooth/heartlistener/doc/images/hearrateresults1.png | bin | 42472 -> 0 bytes | |||
-rw-r--r-- | examples/bluetooth/heartlistener/doc/images/heartratefound.png | bin | 0 -> 31606 bytes | |||
-rw-r--r-- | examples/bluetooth/heartlistener/doc/images/heartrateintro.png | bin | 21538 -> 0 bytes | |||
-rw-r--r-- | examples/bluetooth/heartlistener/doc/images/heartratemonitor.png (renamed from examples/bluetooth/heartlistener/doc/images/hearratemonitor.png) | bin | 46437 -> 46437 bytes | |||
-rw-r--r-- | examples/bluetooth/heartlistener/doc/images/heartrateresults.png | bin | 0 -> 49402 bytes | |||
-rw-r--r-- | examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc | 77 |
7 files changed, 39 insertions, 38 deletions
diff --git a/examples/bluetooth/heartlistener/doc/images/hearrateresults.png b/examples/bluetooth/heartlistener/doc/images/hearrateresults.png Binary files differdeleted file mode 100644 index 2c961517..00000000 --- a/examples/bluetooth/heartlistener/doc/images/hearrateresults.png +++ /dev/null diff --git a/examples/bluetooth/heartlistener/doc/images/hearrateresults1.png b/examples/bluetooth/heartlistener/doc/images/hearrateresults1.png Binary files differdeleted file mode 100644 index 7af63b57..00000000 --- a/examples/bluetooth/heartlistener/doc/images/hearrateresults1.png +++ /dev/null diff --git a/examples/bluetooth/heartlistener/doc/images/heartratefound.png b/examples/bluetooth/heartlistener/doc/images/heartratefound.png Binary files differnew file mode 100644 index 00000000..68ff993d --- /dev/null +++ b/examples/bluetooth/heartlistener/doc/images/heartratefound.png diff --git a/examples/bluetooth/heartlistener/doc/images/heartrateintro.png b/examples/bluetooth/heartlistener/doc/images/heartrateintro.png Binary files differdeleted file mode 100644 index fb0a7b34..00000000 --- a/examples/bluetooth/heartlistener/doc/images/heartrateintro.png +++ /dev/null diff --git a/examples/bluetooth/heartlistener/doc/images/hearratemonitor.png b/examples/bluetooth/heartlistener/doc/images/heartratemonitor.png Binary files differindex ed51ba86..ed51ba86 100644 --- a/examples/bluetooth/heartlistener/doc/images/hearratemonitor.png +++ b/examples/bluetooth/heartlistener/doc/images/heartratemonitor.png diff --git a/examples/bluetooth/heartlistener/doc/images/heartrateresults.png b/examples/bluetooth/heartlistener/doc/images/heartrateresults.png Binary files differnew file mode 100644 index 00000000..6e2dfbca --- /dev/null +++ b/examples/bluetooth/heartlistener/doc/images/heartrateresults.png diff --git a/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc b/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc index fa63714a..c73c13f7 100644 --- a/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc +++ b/examples/bluetooth/heartlistener/doc/src/heartlistener.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. @@ -27,56 +27,57 @@ /*! \example heartlistener - \title Bluetooth Low Energy Heart Listener example + \title Bluetooth Low Energy Heart Listener Example + \brief An example demonstrating the interaction with a Bluetooth Low Energy Heart Rate + device/service. The example demonstrates the use of all Qt Bluetooth + Low Energy classes. - The Bluetooth Low Energy (BLE) Heart Listener Example shows how to develop a Bluetooth - Low Energy applications using the Qt Bluetooth API. The application covers - the scanning for BLE devices, connecting to the BLE Heart Rate service and - receiving updates from the BLE heart belt. The BLE heart belt is required - for this application to work. + The Bluetooth Low Energy Heart Listener Example shows how to develop a Bluetooth + Low Energy application using the Qt Bluetooth API. The application covers + the scanning for Bluetooth Low Energy devices, connecting to a Heart Rate service + on the device, writing characteristics and descriptors and receiving updates from device + once the heart rate has changed. - \image heartrateintro.png + \image heartratemonitor.png - The best and the safest approach is to do a service discovery for BLE device first and - then pick the heart rate service. Before that it is necessary to connect signals from - the QLowEnergyController class, which is responsible for the communication with the - BLE device. + The example introduces the following Qt classes: - \snippet heartlistener/heartrate.cpp Connect signals + \list + \li \l QLowEnergyController + \li \l QLowEnergyService + \li \l QLowEnergyCharacteristic + \li \l QLowEnergyDescriptor + \endlist - After service scan is done and heart rate service found, the heart rate measurement - characteristic needs to be found and enabled for the notifications (advertisements). + A Bluetooth Low Energy device with a Heart Rate + service is required for this application to work. An alternative might be a programmable + Bluetooth Low Energy device which might simulate the service. If no such device can be + found, the example uses a demo mode which creates and displays random values. - \snippet heartlistener/heartrate.cpp Connecting to service + The \l {lowenergyscanner}{Bluetooth Low Energy Scanner} example might be more suitable + if a heart rate device is not available. The scanner example works with any type of Bluetooth + Low Energy peripheral device. - The enableNotifications(m_heartRateCharacteristic) method is the one that - will enable advertisement from the BLE device. Every time, when new update gets from - the BLE device (in our case heart rate belt) QLowEnergyController will emit - valueChanged(QLowEnergyCharacteristicInfo) method, which will invoke - receiveMeasurement(const QLowEnergyCharacteristicInfo &) slot. + \include examples-run.qdocinc - \snippet heartlistener/heartrate.cpp Reading value + \section1 Visual Tour - Every BLE device has its own structure of data that is advertising. In the code above, - the approach for checking the value structure is presented. The heart rate service contains - that information in the first 8 bits of the advertised value. For instance, first bit tells - the format of the value (is it 8 or 16 bit value), fourth tells does the heart belt provide - energy spenditure information, etc. + The application searches for all Bluetooth Low Energy peripheral devices in the vicinity. + It is assumed that the remote devices advertise their presence. The found devices are + presented in a list. Note that it shows all Bluetooth Low Energy devices even those which + do not offer a Heart Rate service. - \snippet heartlistener/heartrate.cpp Error handling + \image heartratefound.png - In case an error occurs, QLowEnergyController will emit error, which can be read with - errorString() method. An error for BLE service can occur in the process of connecting to - the service. For BLE characteristics, an error can occur when trying to subscribe for the - notifications. + After the user has selected a target device, the example connects to its Heart Rate service + if one is available. It automatically enables notification updates for the Heart Rate value + and presents the current value on the screen. - In the end, it is required to disconnect from the service. + \image heartratemonitor.png - \snippet heartlistener/heartrate.cpp Disconnecting from service - - \image hearratemonitor.png - \image hearrateresults.png - \image hearrateresults1.png + Once the monitoring process is canceled, a small graph presents a summary of the received + values. + \image heartrateresults.png */ |