aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-11-02 14:56:22 +0100
committerRonan Le Martret <ronan.lemartret@iot.bzh>2017-11-24 10:38:06 +0100
commit18575b582d77d1d9ba6755e53b212082992e06c1 (patch)
treed4b86042fe017ba0c7ae3758aeb2e31c8ed2a844 /ctl-lib/ctl-plugin.c
parentb4bef2f4b1728a2b4de0e3765aaf172e937a1ff9 (diff)
Load afb_binding macros and stuff to plugins
Change-Id: I18a70e929530bb1cd5f7f68962edf975521b1c71 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-plugin.c')
-rw-r--r--ctl-lib/ctl-plugin.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 1304984..0df21ae 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -209,16 +209,31 @@ OnErrorExit:
PUBLIC int PluginConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pluginsJ) {
int err=0;
- if (json_object_get_type(pluginsJ) == json_type_array) {
- int length = json_object_array_length(pluginsJ);
- ctlPlugins = calloc (length+1, sizeof(CtlPluginT));
- for (int idx=0; idx < length; idx++) {
- json_object *pluginJ = json_object_array_get_idx(pluginsJ, idx);
- err += PluginLoadOne(apiHandle, &ctlPlugins[idx], pluginJ, section->handle);
+ if (ctlPlugins)
+ {
+ int idx = 0;
+ while(ctlPlugins[idx].uid != NULL)
+ {
+ // Jose hack to make verbosity visible from sharedlib and
+ // be able to call verb from others api inside the binder
+ struct afb_binding_data_v2 *afbHidenData = dlsym(ctlPlugins[idx++].dlHandle, "afbBindingV2data");
+ if (afbHidenData) *afbHidenData = afbBindingV2data;
+ }
+ return 0;
+ }
+ else
+ {
+ if (json_object_get_type(pluginsJ) == json_type_array) {
+ int length = json_object_array_length(pluginsJ);
+ ctlPlugins = calloc (length+1, sizeof(CtlPluginT));
+ for (int idx=0; idx < length; idx++) {
+ json_object *pluginJ = json_object_array_get_idx(pluginsJ, idx);
+ err += PluginLoadOne(apiHandle, &ctlPlugins[idx], pluginJ, section->handle);
+ }
+ } else {
+ ctlPlugins = calloc (2, sizeof(CtlPluginT));
+ err += PluginLoadOne(apiHandle, &ctlPlugins[0], pluginsJ, section->handle);
}
- } else {
- ctlPlugins = calloc (2, sizeof(CtlPluginT));
- err += PluginLoadOne(apiHandle, &ctlPlugins[0], pluginsJ, section->handle);
}
return err;