From 06bea3bafe20b65f13f32a44bea3dae7dc8bf3ba Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Sun, 4 Nov 2018 15:50:17 -0800 Subject: 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 --- bluetooth/bluetooth.cpp | 13 ++++++++++--- 1 file 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); } -- cgit 1.2.3-korg