diff options
author | Raquel Medina <raquel.medina@konsulko.com> | 2020-07-27 10:32:13 +0200 |
---|---|---|
committer | Raquel Medina <raquel.medina@konsulko.com> | 2020-08-14 12:23:40 +0200 |
commit | e366c2c347ec08e98831923f65b569c7c20fd449 (patch) | |
tree | a078bb5d438f5d3a2fbc1eb15a32524345c26c87 /telephony | |
parent | 2c9af605274c5d348d71a856fef04a47dd4e0874 (diff) |
test reply status for telephony command
This patch doesnt fix SPEC-3208 or SPEC-3515, but
provides status checks on replies to sent commands,
which helps diagnose telephony commands related
issues.
* query adapter status;
* check for failures due to lack of bt adapter, in
this case updates the connectivity state;
* check for dial failures, in which case it triggers
disconnect (hung-up) to the clients (phone app).
Bug-AGL: SPEC-3208, SPEC-3515
Signed-off-by: Raquel Medina <raquel.medina@konsulko.com>
Change-Id: I1d2d3eefdc20273bad05127bca9cefa9623842dd
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/telephony.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/telephony/telephony.cpp b/telephony/telephony.cpp index b31462c..850f2d6 100644 --- a/telephony/telephony.cpp +++ b/telephony/telephony.cpp @@ -18,6 +18,7 @@ #include "callmessage.h" #include "eventmessage.h" +#include "responsemessage.h" #include "messagefactory.h" #include "messageengine.h" #include "messageenginefactory.h" @@ -97,6 +98,15 @@ void Telephony::onConnected() m_mloop->sendMessage(std::move(msg)); } + std::unique_ptr<Message> msg = MessageFactory::getInstance().createOutboundMessage(MessageId::Call); + if (!msg) + return; + + CallMessage *tmsg = static_cast<CallMessage*>(msg.get()); + tmsg->createRequest("Bluetooth-Manager", "adapter_state", QJsonObject()); + m_mloop->sendMessage(std::move(msg)); + //make ui available, while waiting for connection status, + //most likely profile is already connected setConnected(true); } @@ -130,6 +140,24 @@ void Telephony::onMessageReceived(std::shared_ptr<Message> msg) m_clip = ""; } else if (ename == "online") { setOnlineState(data.find("connected").value().toBool()); + } + } + else if (msg->isReply()) { + std::shared_ptr<ResponseMessage> rmsg = std::static_pointer_cast<ResponseMessage>(msg); + QString verb = rmsg->requestVerb(); + QJsonObject data = rmsg->replyData(); + if (rmsg->replyStatus() == "failed") { + qDebug() << "phone failed bt verb:" << verb; + if ((verb == "adapter_state") && + (rmsg->replyInfo().contains("No adapter"))) + setConnected(false); + else if (verb == "dial") { + setCallState("disconnected"); + m_colp = ""; + m_clip = ""; } } + } else + qWarning() << "Received invalid inbound message"; + } |