diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-11-04 15:50:17 -0800 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-11-21 13:36:55 -0800 |
commit | 06bea3bafe20b65f13f32a44bea3dae7dc8bf3ba (patch) | |
tree | bcd91a901e81509c8d7d3c769c928d55302a40a1 | |
parent | 4b397bae8a69c814c80c64b2d9c2d01e3877582e (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>
-rw-r--r-- | bluetooth/bluetooth.cpp | 13 |
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); } |