summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf.d/project/etc/aft-mapis.json9
-rw-r--r--conf.d/project/lua.d/mapi_low-can.lua (renamed from conf.d/project/lua.d/fapi_low-can.lua)0
-rw-r--r--conf.d/project/lua.d/mapi_tests.lua (renamed from conf.d/project/lua.d/fapi_tests.lua)0
-rw-r--r--src/mapis.c16
-rw-r--r--src/mapis.h2
-rw-r--r--src/test-binding.c2
6 files changed, 20 insertions, 9 deletions
diff --git a/conf.d/project/etc/aft-mapis.json b/conf.d/project/etc/aft-mapis.json
index edcfc87..f68e05f 100644
--- a/conf.d/project/etc/aft-mapis.json
+++ b/conf.d/project/etc/aft-mapis.json
@@ -54,6 +54,13 @@
"info": "Write a CAN messages to the CAN bus.",
"action": "lua://low-can#_write"
}
- ]
+ ],
+ "events": [{
+ "uid": "low-can/diagnostic_messages",
+ "action": "lua://AFT#_evt_catcher_"
+ },{
+ "uid": "low-can/messages_engine_speed",
+ "action": "lua://AFT#_evt_catcher_"
+ }]
}]
}
diff --git a/conf.d/project/lua.d/fapi_low-can.lua b/conf.d/project/lua.d/mapi_low-can.lua
index f7cd99a..f7cd99a 100644
--- a/conf.d/project/lua.d/fapi_low-can.lua
+++ b/conf.d/project/lua.d/mapi_low-can.lua
diff --git a/conf.d/project/lua.d/fapi_tests.lua b/conf.d/project/lua.d/mapi_tests.lua
index 1111a2d..1111a2d 100644
--- a/conf.d/project/lua.d/fapi_tests.lua
+++ b/conf.d/project/lua.d/mapi_tests.lua
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}
};