summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-16 07:09:13 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-16 07:09:13 +0200
commitc6ca6517ffaaf10d2e461c76dfaae5a9665f7d56 (patch)
treefc53cc564e345f570b2d1bb789e936140dfe9176 /src
parent6d9a7006e81fc9ef6140bfc62696d1b270aaae08 (diff)
parent344583c3994048fbc7757c4e2abb647329eadbf3 (diff)
Merge remote-tracking branch 'origin/5.7.0' into 5.7
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/doc/qtbluetooth.qdocconf1
-rw-r--r--src/bluetooth/doc/src/bluetooth-index.qdoc7
-rw-r--r--src/bluetooth/doc/src/bluetooth-le-overview.qdoc56
-rw-r--r--src/bluetooth/qbluetooth.cpp1
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp23
-rw-r--r--src/bluetooth/qlowenergyservice.cpp1
6 files changed, 73 insertions, 16 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.
*/
diff --git a/src/bluetooth/qbluetooth.cpp b/src/bluetooth/qbluetooth.cpp
index 5e8b812a..483fe65a 100644
--- a/src/bluetooth/qbluetooth.cpp
+++ b/src/bluetooth/qbluetooth.cpp
@@ -76,6 +76,7 @@ namespace QBluetooth {
/*!
\enum QBluetooth::AttAccessConstraint
+ \since 5.7
This enum describes the possible requirements for reading or writing an ATT attribute.
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
index 7f3995ed..c152ded2 100644
--- a/src/bluetooth/qlowenergycontroller.cpp
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -154,6 +154,7 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT)
remote device.
\value ClosingState The controller is about to be disconnected from the remote device.
\value AdvertisingState The controller is currently advertising data.
+ This value was introduced by Qt 5.7.
*/
/*!
@@ -255,6 +256,7 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT)
the other side of the connection requested new parameters. The new values can be retrieved
from \a newParameters.
+ \since 5.7
\sa requestConnectionUpdate()
*/
@@ -550,9 +552,11 @@ QLowEnergyController::QLowEnergyController(
Returns a new object of this class that is in the \l CentralRole and has the
parent object \a parent.
The \a remoteDevice refers to the device that a connection will be established to later.
- *
+
The controller uses the local default Bluetooth adapter for the connection management.
+
\sa QLowEnergyController::CentralRole
+ \since 5.7
*/
QLowEnergyController *QLowEnergyController::createCentral(const QBluetoothDeviceInfo &remoteDevice,
QObject *parent)
@@ -567,7 +571,9 @@ QLowEnergyController *QLowEnergyController::createCentral(const QBluetoothDevice
Typically, the next step is to call \l startAdvertising() on the returned object.
The controller uses the local default Bluetooth adapter for the connection management.
+
\sa QLowEnergyController::PeripheralRole
+ \since 5.7
*/
QLowEnergyController *QLowEnergyController::createPeripheral(QObject *parent)
{
@@ -811,6 +817,9 @@ QLowEnergyService *QLowEnergyController::createServiceObject(
If this object is currently not in the \l UnconnectedState, nothing happens.
\note Advertising will stop automatically once a client connects to the local device.
+
+ \since 5.7
+ \sa stopAdvertising()
*/
void QLowEnergyController::startAdvertising(const QLowEnergyAdvertisingParameters &parameters,
const QLowEnergyAdvertisingData &advertisingData,
@@ -830,6 +839,9 @@ void QLowEnergyController::startAdvertising(const QLowEnergyAdvertisingParameter
/*!
Stops advertising, if this object is currently in the advertising state.
+
+ \since 5.7
+ \sa startAdvertising()
*/
void QLowEnergyController::stopAdvertising()
{
@@ -845,6 +857,8 @@ void QLowEnergyController::stopAdvertising()
Constructs and returns a \l QLowEnergyService object with \a parent from \a service.
The controller must be in the \l PeripheralRole and in the \l UnconnectedState. The \a service
object must be valid.
+
+ \since 5.7
\sa QLowEnergyServiceData::addIncludedService
*/
QLowEnergyService *QLowEnergyController::addService(const QLowEnergyServiceData &service,
@@ -916,6 +930,8 @@ QLowEnergyService *QLowEnergyController::addService(const QLowEnergyServiceData
with the actual new parameters.
See the \l QLowEnergyConnectionParameters class for more information on connection parameters.
\note Currently, this functionality is only implemented on Linux.
+
+ \since 5.7
*/
void QLowEnergyController::requestConnectionUpdate(const QLowEnergyConnectionParameters &parameters)
{
@@ -945,6 +961,11 @@ QString QLowEnergyController::errorString() const
/*!
Returns the role that this controller object is in.
+
+ The role is determined when constructing a QLowEnergyController instance
+ using \l createCentral() or \l createPeripheral().
+
+ \since 5.7
*/
QLowEnergyController::Role QLowEnergyController::role() const
{
diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp
index 1e5c363d..e9722f81 100644
--- a/src/bluetooth/qlowenergyservice.cpp
+++ b/src/bluetooth/qlowenergyservice.cpp
@@ -229,6 +229,7 @@ QT_BEGIN_NAMESPACE
\value LocalService The service is associated with a controller object in the
\l{QLowEnergyController::PeripheralRole}{peripheral role}. Such
service objects do not change their state.
+ This value was introduced by Qt 5.7.
*/
/*!