summaryrefslogtreecommitdiffstats
path: root/bluetooth/bluetooth.cpp
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-11-04 15:50:17 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-11-05 23:07:50 -0800
commit0e1dae0af026f6a30e82f7129596da83bc4d8426 (patch)
tree3206edc82fdf63f8dccc06d61007bda52321ad65 /bluetooth/bluetooth.cpp
parent61ef43a4520faa2c2c3118013b7bf26cac2e76bb (diff)
libqtappfw: bluetooth: send out power event
Send power event when device_changes powered parameter is detected Bug-AGL: SPEC-1630 Change-Id: I0170eafa03ce28ab9f907a37bcf7fefa9e205e33 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'bluetooth/bluetooth.cpp')
-rw-r--r--bluetooth/bluetooth.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/bluetooth/bluetooth.cpp b/bluetooth/bluetooth.cpp
index 091cb26..f7ef970 100644
--- a/bluetooth/bluetooth.cpp
+++ b/bluetooth/bluetooth.cpp
@@ -197,9 +197,16 @@ void Bluetooth::processDeviceChangesEvent(QJsonObject data)
if (action == "added")
emit deviceAddedEvent(data);
- else if (action == "changed")
- emit deviceUpdatedEvent(data);
- else if (action == "removed")
+ else if (action == "changed") {
+ auto powered = data.find("powered").value();
+
+ if (powered.isBool()) {
+ m_power = powered.toBool();
+ emit powerChanged(m_power);
+ } else {
+ emit deviceUpdatedEvent(data);
+ }
+ } else if (action == "removed")
emit deviceRemovedEvent(data);
}