From 58149e03533adad2c35bb5914efab086c3bc3d78 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 25 Sep 2017 18:34:38 +0200 Subject: Add a default behavior to subscribe to API signals By default, if no getSignals action has been configured then a call to api/subscribe will occurs Change-Id: Ic54d7eb7c3117ccc0bf3c9819d14475d9145d61d Signed-off-by: Romain Forlot --- signal-composer-binding/signal-composer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp index 71cac7b..f0a625b 100644 --- a/signal-composer-binding/signal-composer.cpp +++ b/signal-composer-binding/signal-composer.cpp @@ -160,7 +160,12 @@ int Composer::loadOneSourceAPI(json_object* sourceJ) } if(initJ) {initCtl = convert2Action("init", initJ);} - if(getSignalsJ) {getSignalsCtl = convert2Action("getSignals", getSignalsJ);} + if(!getSignalsJ) + { + std::string function = "api://" + std::string(api) + "/subscribe"; + wrap_json_pack(&getSignalsJ, "{ss}", "function", function.c_str()); + } + getSignalsCtl = convert2Action("getSignals", getSignalsJ); sourcesListV_.push_back(SourceAPI(api, info, initCtl, getSignalsCtl)); -- cgit 1.2.3-korg