summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer-binding.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-10 19:46:02 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commit75cfbf3d0206f12422091e6479c508c69445bf4a (patch)
tree200085512507e7ee5adc43b377d34ff5953db8de /signal-composer-binding/signal-composer-binding.cpp
parentbdf2d19cf8a3d6005456508ca52dba74cd9c103f (diff)
Controller src integration
Change-Id: I0b18cd55057a784d183a5ba02c332810a34d1fca 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.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp
index 24b81f6..2ca1dec 100644
--- a/signal-composer-binding/signal-composer-binding.cpp
+++ b/signal-composer-binding/signal-composer-binding.cpp
@@ -15,12 +15,15 @@
* limitations under the License.
*/
+#include <ctl-config.h>
+
#include "signal-composer-binding.hpp"
#include "signal-composer-apidef.h"
#include "wrap-json.h"
#include "signal-composer.hpp"
SignalComposer SigComp;
+static CtlConfigT *ctlConfig=NULL;
/// @brief callback for receiving message from low binding. Treatment itself is made in SigComp class.
void onEvent(const char *event, json_object *object)
@@ -46,7 +49,7 @@ void unsubscribe(afb_req request)
}
/// @brief verb that loads JSON configuration (old SigComp.json file now)
-void load(afb_req request)
+void loadConf(afb_req request)
{
json_object* args = afb_req_json(request);
const char* confd;
@@ -79,12 +82,23 @@ int ticked(sd_event_source *source, uint64_t t, void* data)
return 0;
}
-/// @brief Initialize the binding.
-///
-/// @return Exit code, zero if success.
-int init_service()
+int loadConf()
{
- AFB_DEBUG("SigComp level binding is initializing");
- AFB_NOTICE("SigComp level binding is initialized and running");
- return 0;
+ int errcount=0;
+
+ ctlConfig = CtlConfigLoad();
+
+ #ifdef CONTROL_SUPPORT_LUA
+ errcount += LuaLibInit();
+ #endif
+
+ return errcount;
+}
+
+int execConf()
+{
+ int err = CtlConfigExec();
+
+ AFB_DEBUG ("Signal Composer Control configuration Done errcount=%d", errcount);
+ return errcount;
}