summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-25 18:34:38 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commit58149e03533adad2c35bb5914efab086c3bc3d78 (patch)
tree9f2dc1255a02966accb4a781cc162e93d77d2e0e /signal-composer-binding/signal-composer.cpp
parentb7dd0a6e19d5387bc8d499bd1b3a99d457fa58d9 (diff)
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 <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/signal-composer.cpp')
-rw-r--r--signal-composer-binding/signal-composer.cpp7
1 files changed, 6 insertions, 1 deletions
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));