summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2020-07-13 21:58:07 +0200
committerRaquel Medina <raquel.medina@konsulko.com>2020-07-21 15:31:41 +0200
commit2c9af605274c5d348d71a856fef04a47dd4e0874 (patch)
treece7552d2503a45d10e0a145c73c1e9c5844f3f81
parent14c3bea3a90d54577ae1f6a124f61e90fb05c731 (diff)
update bt power state if no adapterjellyfish_9.99.2jellyfish/9.99.29.99.2
In case of no adapter, update 'powered' property to update status fed back to clients (i.e., if there's no adapter and the user enables bluetooth via settings slider, this patch provides the action to take the slider back to OFF position, without this fix it'd stay ON which can mislead the user's expectations). As SPEC-3301 has introduced changes to support the no adapter scenario, this patch is also delivered under this jira issue. Bug-AGL: SPEC-3301 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I4fcc98b2a7cbf4093d39dc54ac83d5217de7e5ff
-rw-r--r--bluetooth/bluetooth.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/bluetooth/bluetooth.cpp b/bluetooth/bluetooth.cpp
index fe1212f..82ef2f1 100644
--- a/bluetooth/bluetooth.cpp
+++ b/bluetooth/bluetooth.cpp
@@ -289,13 +289,21 @@ void Bluetooth::onMessageReceived(std::shared_ptr<Message> msg)
} else if (ename == "agent") {
emit requestConfirmationEvent(data);
}
-
} else if (msg->isReply()) {
std::shared_ptr<ResponseMessage> rmsg = std::static_pointer_cast<ResponseMessage>(msg);
- //get api name
QString verb = rmsg->requestVerb();
QJsonObject data = rmsg->replyData();
- if (verb == "managed_objects") {
+ if (rmsg->requestApi() != "Bluetooth-Manager")
+ return;
+
+ if (rmsg->replyStatus() == "failed") {
+ qDebug() << "failed bt verb:" << verb;
+ if (rmsg->replyInfo().contains("No adapter")) {
+ m_power = false;
+ emit powerChanged(m_power);
+ }
+ }
+ else if (verb == "managed_objects") {
populateDeviceList(data);
} else if (verb == "adapter_state") {
bool powered = data.value("powered").toBool();