summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller.cpp
diff options
context:
space:
mode:
authorNedim Hadzic <nhadzic@blackberry.com>2013-10-23 17:33:36 +0200
committerNedim Hadzic <nhadzic@blackberry.com>2013-11-11 17:33:15 +0100
commit658183e0b1b27b3c935a9a19f21de0e3e677a70b (patch)
treec927824d5c4768a0ebcf1172fa06aaef09286444 /src/bluetooth/qlowenergycontroller.cpp
parentec61d7b9e82e6d653c02df14f34acdba8fc060db (diff)
Additional constructors to QLowEnergyDescriptorInfo class and method modification in QLowEnergyCharacteristicInfo class.
Characteristic notification change and solving the warnings were implemented. Change-Id: I8abec8b580e477578b4bc1dfd1e92e838ef7a372 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller.cpp')
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
index abba8edc..00a33325 100644
--- a/src/bluetooth/qlowenergycontroller.cpp
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -246,20 +246,21 @@ void QLowEnergyController::disconnectFromService(const QLowEnergyServiceInfo &le
/*!
Enables receiving notifications from the given \a characteristic. If the service characteristic
- does not belong to one of the services, nothing wil lbe done.
-
- \sa addLeService
+ does not belong to one of the services or characteristic permissions do not allow notifications,
+ the function will return false.
*/
-void QLowEnergyController::enableNotifications(const QLowEnergyCharacteristicInfo &characteristic)
+bool QLowEnergyController::enableNotifications(const QLowEnergyCharacteristicInfo &characteristic)
{
+ bool enable = false;
for (int i = 0; i < d_ptr->m_leServices.size(); i++) {
for (int j = 0; j < d_ptr->m_leServices.at(i).getCharacteristics().size(); j++) {
if (d_ptr->m_leServices.at(i).getCharacteristics().at(j).uuid() == characteristic.uuid()) {
connect(d_ptr->m_leServices.at(i).getCharacteristics().at(j).d_ptr.data(), SIGNAL(notifyValue(QBluetoothUuid)), this, SLOT(_q_valueReceived(QBluetoothUuid)));
- d_ptr->m_leServices.at(i).getCharacteristics().at(j).d_ptr->enableNotification();
+ enable = d_ptr->m_leServices.at(i).getCharacteristics().at(j).d_ptr->enableNotification();
}
}
}
+ return enable;
}
/*!