diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-16 07:09:13 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-16 07:09:13 +0200 |
commit | c6ca6517ffaaf10d2e461c76dfaae5a9665f7d56 (patch) | |
tree | fc53cc564e345f570b2d1bb789e936140dfe9176 /src/bluetooth/doc | |
parent | 6d9a7006e81fc9ef6140bfc62696d1b270aaae08 (diff) | |
parent | 344583c3994048fbc7757c4e2abb647329eadbf3 (diff) |
Merge remote-tracking branch 'origin/5.7.0' into 5.7
Change-Id: I7cd3889f3c2c82a51496b74813cfdee6495517fa
Diffstat (limited to 'src/bluetooth/doc')
-rw-r--r-- | src/bluetooth/doc/qtbluetooth.qdocconf | 1 | ||||
-rw-r--r-- | src/bluetooth/doc/src/bluetooth-index.qdoc | 7 | ||||
-rw-r--r-- | src/bluetooth/doc/src/bluetooth-le-overview.qdoc | 56 |
3 files changed, 49 insertions, 15 deletions
diff --git a/src/bluetooth/doc/qtbluetooth.qdocconf b/src/bluetooth/doc/qtbluetooth.qdocconf index 52061d7e..aa485cdb 100644 --- a/src/bluetooth/doc/qtbluetooth.qdocconf +++ b/src/bluetooth/doc/qtbluetooth.qdocconf @@ -47,6 +47,7 @@ exampledirs += ../../../examples/bluetooth \ snippets/ \ ../ +manifestmeta.thumbnail.names = "QtBluetooth/Bluetooth Low Energy Heart Rate Server Example" imagedirs += images diff --git a/src/bluetooth/doc/src/bluetooth-index.qdoc b/src/bluetooth/doc/src/bluetooth-index.qdoc index 51c79ca4..f110179f 100644 --- a/src/bluetooth/doc/src/bluetooth-index.qdoc +++ b/src/bluetooth/doc/src/bluetooth-index.qdoc @@ -45,10 +45,13 @@ for transferring data between devices. Bluetooth connectivity is based on basic device management, such as scanning for devices, gathering information about them, and exchanging data between them. -Qt 5.5 contains the first full release of the new Qt Bluetooth -Low Energy API. Further details can be found in the +Qt Bluetooth supports Bluetooth Low Energy development for client/central role use cases. +Further details can be found in the \l {Bluetooth Low Energy Overview}{Bluetooth Low Energy Overview} section. +A new addition in this Qt Bluetooth 5.7 release covers support for Bluetooth Low Energy +applications performing the peripheral/server role. This new API is a Technology Preview. + \section1 Getting Started To use the C++ library in your application, add the following configuration diff --git a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc index a6b8defa..8e78c487 100644 --- a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc +++ b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc @@ -168,19 +168,6 @@ Low Energy devices. The example code below is taken from the \l {heartlistener}{Heart Listener} and \l {heartrate-server}{Heart Rate Server} examples. - \section2 Advertising Services - - If we are implementing a GATT server application on a peripheral device, we need to define the - services we want to offer to central devices and advertise them: - - \snippet heartrate-server/main.cpp Advertising Data - \snippet heartrate-server/main.cpp Start Advertising - \snippet heartrate-server/main.cpp Advertising Data - - Now potential clients can connect to our device, discover the provided service and - register themselves to get notified of changes to the characteristic value. - This part of the API is covered in the following sections. - \section2 Establishing a Connection To be able to read and write the characteristics of the Bluetooth Low Energy peripheral device, @@ -257,4 +244,47 @@ Low Energy devices. \l {https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx}{Bluetooth SIG} whereas others may follow a custom protocol. The above code snippet demonstrates how to the read the standardized HeartRate value. + + \section2 Advertising Services + + If we are implementing a GATT server application on a peripheral device, we need to define the + services we want to offer to central devices and advertise them: + + \snippet heartrate-server/main.cpp Advertising Data + \snippet heartrate-server/main.cpp Start Advertising + + Now potential clients can connect to our device, discover the provided service and + register themselves to get notified of changes to the characteristic value. + This part of the API was already covered by the above sections. + + \section2 Implementing a Service on the Peripheral Device + + The first step is to define the service, its characteristics and descriptors. This is achieved + using the \l QLowEnergyServiceData, \l QLowEnergyCharacteristicData and + \l QLowEnergyDescriptorData classes. These classes act as containers or building blocks for the + essential information that comprises the to-be-defined Bluetooth Low Energy service. + The code snippet below defines a simple HeartRate service which publishes + the measured beats per minute. An example where such a service could be used is a wrist watch. + + \snippet heartrate-server/main.cpp Service Data + + The resulting \c serviceData object can be published as described in the + \l {Advertising Services} section above. Despite the partial information overlap between the + information wrapped by \l QLowEnergyServiceData and \l QLowEnergyAdvertisingData the two classes + serve two very different tasks. The advertising data is published to nearby devices and often + limited in scope due to its size restriction of 29 bytes. Therefore they are not always 100% + complete. By comparison the service data contained inside of \l QLowEnergyServiceData provides + the complete set of service data and only becomes visible to the connecting client when a + connection with an active service discovery has been performed. + + The next section demonstrates how the service can update the heart rate value. Depending on the + nature of the service it may have to comply with the official service definition + as defined on \l {https://www.bluetooth.org}. Other services may be completely custom. The + heart rate service was adopted and its specification can be found under + \l {https://www.bluetooth.com/specifications/adopted-specifications}. + + \snippet heartrate-server/main.cpp Provide Heartbeat + + In general characteristic and descriptor value updates on the peripheral device use the same + methods as connecting Bluetooth Low Energy devices. */ |