diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-11-02 15:58:45 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | 6ee4db6878464642ddf9f0909748841a45b58a88 (patch) | |
tree | 4c3588d216e903174f1281b757e98816d7323afa /plugins/builtin.cpp | |
parent | ed2c3d0267e3c5e1392635dacad2752de935d6b4 (diff) |
Migrate to ctl-utilities library
New version of controller as a library. Loading additionnals
files from each sections.
Change-Id: I4f5e78d0baf9650cb8d1cc1da26f8e1fd73b792c
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'plugins/builtin.cpp')
-rw-r--r-- | plugins/builtin.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/builtin.cpp b/plugins/builtin.cpp index e93d929..df6ba88 100644 --- a/plugins/builtin.cpp +++ b/plugins/builtin.cpp @@ -29,9 +29,7 @@ extern "C" { - -CTLP_LUALOAD -CTLP_REGISTER("builtin"); +CTLP_LUA_REGISTER("builtin"); static struct signalCBT* pluginCtx = NULL; @@ -40,18 +38,17 @@ CTLP_ONLOAD(plugin, handle) { pluginCtx = (struct signalCBT*)calloc (1, sizeof(struct signalCBT)); pluginCtx = (struct signalCBT*)handle; - AFB_NOTICE ("Low-can plugin: label='%s' version='%s' info='%s'", - plugin->label, - plugin->version, + AFB_NOTICE ("Low-can plugin: label='%s' info='%s'", + plugin->uid, plugin->info); return (void*)pluginCtx; } -CTLP_CAPI (defaultOnReceived, source, argsJ, eventJ, context) +CTLP_CAPI (defaultOnReceived, source, argsJ, eventJ) { struct signalCBT* ctx = (struct signalCBT*)source->context; - AFB_NOTICE("source: %s argj: %s, eventJ %s", source->label, + AFB_NOTICE("source: %s argj: %s, eventJ %s", source->uid, json_object_to_json_string(argsJ), json_object_to_json_string(eventJ)); void* sig = ctx->aSignal; @@ -70,7 +67,7 @@ CTLP_CAPI (defaultOnReceived, source, argsJ, eventJ, context) return 0; } -CTLP_LUA2C (setSignalValueWrap, label, argsJ) +CTLP_LUA2C (setSignalValueWrap, source, argsJ, responseJ) { const char* name = nullptr; double resultNum; @@ -80,7 +77,7 @@ CTLP_LUA2C (setSignalValueWrap, label, argsJ) "value", &resultNum, "timestamp", ×tamp)) { - AFB_ERROR("Fail to set value for label: %s, argsJ: %s", label, json_object_to_json_string(argsJ)); + AFB_ERROR("Fail to set value for uid: %s, argsJ: %s", source->uid, json_object_to_json_string(argsJ)); return -1; } struct signalValue result = resultNum; |