summaryrefslogtreecommitdiffstats
path: root/bluetooth.cpp
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2018-05-01 23:15:58 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2018-05-13 17:43:33 -0700
commitbb1aee701bc3516c2072a79d3129ee83918df7fd (patch)
tree150edc50142429ee566edf629a8d3f5dfb3a8557 /bluetooth.cpp
parent6465961f28f40ff5a2da31876f1c23ea3c7f7cec (diff)
message: add response message support
Add support for callid sequencing, and request data being included with the response message. Bug-AGL: SPEC-1404 Change-Id: I259ae3da68e55de17eafe9db534258db5fbc3ef8 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'bluetooth.cpp')
-rw-r--r--bluetooth.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/bluetooth.cpp b/bluetooth.cpp
index 6e21ad1..cc5f496 100644
--- a/bluetooth.cpp
+++ b/bluetooth.cpp
@@ -18,6 +18,7 @@
#include "messageengine.h"
#include "bluetooth.h"
#include "bluetoothmessage.h"
+#include "responsemessage.h"
Bluetooth::Bluetooth (QUrl &url, QObject * parent) :
QObject(parent),
@@ -214,11 +215,13 @@ void Bluetooth::onMessageReceived(MessageType type, Message *msg)
} else if (tmsg->isDeviceUpdatedEvent()) {
emit deviceUpdatedEvent(tmsg->eventData());
}
- } else if (msg->isReply() && type == GenericMessage) {
- if (this->isDiscoveryListResponse(msg)) {
- emit deviceListEvent(msg->replyData());
- } else if (this->isPowerResponse(msg)) {
- m_power = msg->replyData().value("power").toString() == "on";
+ } else if (msg->isReply() && type == ResponseRequestMessage) {
+ ResponseMessage *tmsg = qobject_cast<ResponseMessage*>(msg);
+
+ if (tmsg->requestVerb() == "discovery_result") {
+ emit deviceListEvent(tmsg->replyData());
+ } else if (tmsg->requestVerb() == "power") {
+ m_power = tmsg->replyData().value("power").toString() == "on";
emit powerChanged(m_power);
}
}