summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-03-30 13:35:36 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-04-10 07:46:39 +0000
commit78e7a1673e4558133ae1921ee24c296a62938eea (patch)
tree7d394dd529219e3faf070af9be5cc25038cb4d9f /src
parent9170697287050f1b8210cb2298389b4b78f9e962 (diff)
Prevent characteristic write if service is not discovered
Previously it was possible to issue the characteristic write request while the service was not discovered. Change-Id: Id370a2ae0f15860e28d1aee0624bdf13517e1e32 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qlowenergyservice.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp
index 470db8c6..194f589f 100644
--- a/src/bluetooth/qlowenergyservice.cpp
+++ b/src/bluetooth/qlowenergyservice.cpp
@@ -613,11 +613,10 @@ void QLowEnergyService::writeCharacteristic(
if (!contains(characteristic))
return;
- if (state() != ServiceDiscovered)
+ if (state() != ServiceDiscovered || !d->controller) {
d->setError(QLowEnergyService::OperationError);
-
- if (!d->controller)
return;
+ }
// don't write if properties don't permit it
if (mode == WriteWithResponse