From ff20c394e456075d5936440b35be2f6a137dab82 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Mon, 17 Sep 2018 14:59:11 +0200 Subject: 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 --- ctl-lib/ctl-plugin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ctl-lib/ctl-plugin.c') 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; } -- cgit 1.2.3-korg