aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-17 14:59:11 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-18 12:38:47 +0200
commit8d5398494b7ad3e6f20144513a82ba3afcae26ed (patch)
tree9ce519f1e4a9e961bf8f9a980cedd9723eb94fed /ctl-lib
parent35398f25acd2f1b9c6cd7d16daa048b3edbf1def (diff)
Add a 'params' fields for controller plugins
Add a 'params' fields for controller plugins. Can be used to send specific parameters to plugins functions (onload, init, ...). Change-Id: Ifb16f06a20453ef2bd1bc8a72bc2841dc12e323c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'ctl-lib')
-rw-r--r--ctl-lib/ctl-plugin.c7
-rw-r--r--ctl-lib/ctl-plugin.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 3dfecd9..2347518 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -303,15 +303,16 @@ static int PluginLoad (AFB_ApiT apiHandle, CtlPluginT *ctlPlugin, json_object *p
// plugin initialises at 1st load further init actions should be place into onload section
if (!pluginJ) return 0;
- err = wrap_json_unpack(pluginJ, "{ss,s?s,s?s,s?o,s?o !}",
+ err = wrap_json_unpack(pluginJ, "{ss,s?s,s?s,s?o,s?o,s?o !}",
"uid", &ctlPlugin->uid,
"info", &ctlPlugin->info,
"spath", &sPath,
"libs", &fileJ,
- "lua", &luaJ
+ "lua", &luaJ,
+ "params", &ctlPlugin->paramsJ
);
if (err) {
- AFB_ApiError(apiHandle, "CTL-PLUGIN-LOADONE Plugin missing uid|[info]|libs|[spath]|[lua] in:\n-- %s", json_object_get_string(pluginJ));
+ AFB_ApiError(apiHandle, "CTL-PLUGIN-LOADONE Plugin missing uid|[info]|libs|[spath]|[lua]|[params] in:\n-- %s", json_object_get_string(pluginJ));
return 1;
}
diff --git a/ctl-lib/ctl-plugin.h b/ctl-lib/ctl-plugin.h
index 8d9b083..d931906 100644
--- a/ctl-lib/ctl-plugin.h
+++ b/ctl-lib/ctl-plugin.h
@@ -62,6 +62,7 @@ typedef struct {
AFB_ApiT api;
void *dlHandle;
void *context;
+ json_object *paramsJ;
#ifdef CONTROL_SUPPORT_LUA
CtlLua2cFuncT *ctlL2cFunc;
#endif