diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-15 16:29:17 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | 677cde6288a4574b8251a4a532b1d9e1594b09b2 (patch) | |
tree | c510a0cdd76e2b8de1cdaf254fd270c8bfebae42 /signal-composer-binding/signal-composer-binding.cpp | |
parent | eabae24ea592420de46e36f0b1af5d39eee5b8a4 (diff) |
Subscription by plugin to signals
Change-Id: Icb923f87df2be8eb664106bc9077b3a8221dd3ce
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/signal-composer-binding.cpp')
-rw-r--r-- | signal-composer-binding/signal-composer-binding.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp index 860de07..5ff24b0 100644 --- a/signal-composer-binding/signal-composer-binding.cpp +++ b/signal-composer-binding/signal-composer-binding.cpp @@ -85,41 +85,44 @@ void get(afb_req request) int loadConf() { - int ret = 0; + int err = 0; const char* rootdir = strncat(GetBindingDirPath(), "/etc", sizeof(GetBindingDirPath()) - strlen(GetBindingDirPath()) -1); bindingApp& bApp = bindingApp::instance(); - ret = bApp.loadConfig(rootdir); + err = bApp.loadConfig(rootdir); #ifdef CONTROL_SUPPORT_LUA - ret += LuaConfigLoad(); + err += LuaConfigLoad(); #endif - return ret; + return err; } int execConf() { bindingApp& bApp = bindingApp::instance(); - int ret = CtlConfigExec(bApp.ctlConfig()); + int err = 0; + CtlConfigExec(bApp.ctlConfig()); std::vector<std::shared_ptr<Signal>> allSignals = bApp.getAllSignals(); ssize_t sigCount = allSignals.size(); for( std::shared_ptr<Signal>& sig: allSignals) { - sig->attachToSources(bApp); + sig->attachToSourceSignals(bApp); } for(auto& sig: allSignals) { - if( (ret = sig->recursionCheck()) ) + if( (err += sig->recursionCheck()) ) { AFB_ERROR("There is an infinite recursion loop in your signals definition. Root coming from signal: %s", sig->id().c_str()); - return ret; + return err; } } + bApp.execSubscription(); + AFB_DEBUG("Signal Composer Control configuration Done.\n signals=%d", (int)sigCount); - return ret; + return err; } |