summaryrefslogtreecommitdiffstats
path: root/ctl-lib
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-11-02 14:56:22 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:54 +0100
commit0870de1cb87fe998724d64713de939783f2bfbcc (patch)
treed4b86042fe017ba0c7ae3758aeb2e31c8ed2a844 /ctl-lib
parent1447db9245003dea891f1d66c21d583f8554cfd2 (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')
-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;