summaryrefslogtreecommitdiffstats
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 16:33:34 -0500
commit726407129b7679a16a97c2ca0ac7cb865980a4bc (patch)
treedc0f6e0213b1ab67fbaec9efeeffb69455585a4e
parent7cca8039aec47b1958dc329959fb3a9a0d4ed2ae (diff)
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.