aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-12-29 16:33:34 -0500
committerScott Murray <scott.murray@konsulko.com>2019-12-29 21:30:09 +0000
commit38b7fc21611c206e4adde8b5e64fb19244fe9d3e (patch)
tree1780bd6ea892333c0cf90867928b9285973942d9
parent717601ead4c45b05407ff394e1f82622495d269f (diff)
Add session uuid to subscribe replies
Add the session uuid to event subscribe replies to match the documented behavior and enable clients like libappcontroller based bindings and applications to be able to use it in their event handling. Bug-AGL: SPEC-3074 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I185165e600410190b30b1d8bd5a6ad8675b2b714
-rw-r--r--signal-composer-binding/clientApp.hpp1
-rw-r--r--signal-composer-binding/signal-composer-binding.cpp10
2 files changed, 10 insertions, 1 deletions
diff --git a/signal-composer-binding/clientApp.hpp b/signal-composer-binding/clientApp.hpp
index a9c9636..9459b46 100644
--- a/signal-composer-binding/clientApp.hpp
+++ b/signal-composer-binding/clientApp.hpp
@@ -32,4 +32,5 @@ public:
void subtractSignals(std::vector<std::shared_ptr<Signal>>& sigV);
int makeSubscription(afb_req_t request);
int makeUnsubscription(afb_req_t request);
+ std::string getUUID() { return std::string(uuid_); }
};
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp
index fb97c71..b28d8ec 100644
--- a/signal-composer-binding/signal-composer-binding.cpp
+++ b/signal-composer-binding/signal-composer-binding.cpp
@@ -102,9 +102,17 @@ static void do_subscribe_unsubscribe(afb_req_t request, bool subscribe, clientAp
}
if(rc >= 0)
- afb_req_success(request, NULL, NULL);
+ {
+ json_object *reply = json_object_new_object();
+ json_object_object_add(reply,
+ "uuid",
+ json_object_new_string(cContext->getUUID().c_str()));
+ afb_req_reply(request, reply, NULL, NULL);
+ }
else
+ {
afb_req_fail(request, "error", NULL);
+ }
}
/// @brief entry point for client un-subscription request.