aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mapis.c16
-rw-r--r--src/mapis.h2
-rw-r--r--src/test-binding.c2
3 files changed, 12 insertions, 8 deletions
diff --git a/src/mapis.c b/src/mapis.c
index d196ed0..b6976e3 100644
--- a/src/mapis.c
+++ b/src/mapis.c
@@ -24,9 +24,10 @@ struct mapisHandleT {
CtlSectionT *section;
json_object *mapiJ;
json_object *verbsJ;
+ json_object *eventsJ;
};
-static int LoadOnemapi(void *data, AFB_ApiT apiHandle)
+static int LoadOneMapi(void *data, AFB_ApiT apiHandle)
{
struct mapisHandleT *mapisHandle = (struct mapisHandleT*)data;
@@ -46,7 +47,7 @@ static int LoadOnemapi(void *data, AFB_ApiT apiHandle)
return 0;
}
-static void OnemapiConfig(void *data, json_object *mapiJ) {
+static void OneMapiConfig(void *data, json_object *mapiJ) {
const char *uid = NULL, *info = NULL;
struct mapisHandleT *mapisHandle = (struct mapisHandleT*)data;
@@ -58,30 +59,33 @@ static void OnemapiConfig(void *data, json_object *mapiJ) {
"spath", NULL,
"libs", NULL,
"lua", NULL,
- "verbs", &mapisHandle->verbsJ)) {
+ "verbs", &mapisHandle->verbsJ,
+ "eventsJ", &mapisHandle->eventsJ)) {
AFB_ApiError(mapisHandle->mainApiHandle, "Wrong mapis specification, missing uid|[info]|[spath]|libs|[lua]|verbs");
return;
}
json_object_get(mapisHandle->verbsJ);
+ json_object_get(mapisHandle->eventsJ);
json_object_object_del(mapiJ, "verbs");
+ json_object_object_del(mapiJ, "events");
mapisHandle->mapiJ = mapiJ;
- if (afb_dynapi_new_api(mapisHandle->mainApiHandle, uid, info, 1, LoadOnemapi, (void*)mapisHandle)) {
+ if (afb_dynapi_new_api(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle)) {
AFB_ApiError(mapisHandle->mainApiHandle, "Error creating new api: %s", uid);
return;
}
}
}
-int mapisConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *mapisJ) {
+int MapiConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *mapisJ) {
struct mapisHandleT mapisHandle = {
.mainApiHandle = apiHandle,
.section = section,
.mapiJ = NULL,
.verbsJ = NULL
};
- wrap_json_optarray_for_all(mapisJ, OnemapiConfig, (void*)&mapisHandle);
+ wrap_json_optarray_for_all(mapisJ, OneMapiConfig, (void*)&mapisHandle);
return 0;
}
diff --git a/src/mapis.h b/src/mapis.h
index 9ea03b1..8e28902 100644
--- a/src/mapis.h
+++ b/src/mapis.h
@@ -20,4 +20,4 @@
#include <wrap-json.h>
#include <filescan-utils.h>
-int mapisConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *mapisJ);
+int MapiConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *mapisJ);
diff --git a/src/test-binding.c b/src/test-binding.c
index d465994..39e90c4 100644
--- a/src/test-binding.c
+++ b/src/test-binding.c
@@ -31,7 +31,7 @@ static CtlSectionT ctrlSections[] = {
{.key = "resources", .loadCB = PluginConfig},
{.key = "testVerb", .loadCB = ControlConfig},
{.key = "events", .loadCB = EventConfig},
- {.key = "mapis", .loadCB = mapisConfig},
+ {.key = "mapis", .loadCB = MapiConfig},
{.key = NULL}
};