summaryrefslogtreecommitdiffstats
path: root/src/mapis.c
diff options
context:
space:
mode:
authorClément Bénier <clement.benier@iot.bzh>2018-10-05 11:24:12 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-10 10:53:48 +0200
commit9754027e66b3ec8bd399589fc446c28da549f8c8 (patch)
tree56dbd0414f5ccf16017ff28ed1b2c60175b5e19e /src/mapis.c
parent5e3651343318d721b1e3346cb98154ad34e73fb0 (diff)
get rid of afb-definitions
directly use app framework binder api v3 Change-Id: Ifb12568026772b32dad94decd2c32eeab904968d Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Diffstat (limited to 'src/mapis.c')
-rw-r--r--src/mapis.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mapis.c b/src/mapis.c
index e40f3aa..fbe3e68 100644
--- a/src/mapis.c
+++ b/src/mapis.c
@@ -21,26 +21,26 @@
#include <ctl-config.h>
struct mapisHandleT {
- AFB_ApiT mainApiHandle;
+ afb_api_t mainApiHandle;
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_api_t apiHandle) {
int idx = 0;
struct mapisHandleT *mapisHandle = (struct mapisHandleT*)data;
- CtlConfigT *ctrlConfig = AFB_ApiGetUserData(mapisHandle->mainApiHandle);
+ CtlConfigT *ctrlConfig = afb_api_get_userdata(mapisHandle->mainApiHandle);
if(PluginConfig(apiHandle, mapisHandle->section, mapisHandle->mapiJ)) {
- AFB_ApiError(apiHandle, "Problem loading the plugin as an API for %s, see log message above", json_object_get_string(mapisHandle->mapiJ));
+ AFB_API_ERROR(apiHandle, "Problem loading the plugin as an API for %s, see log message above", json_object_get_string(mapisHandle->mapiJ));
return -1;
}
// declare the verbs for this API
if(! ActionConfig(apiHandle, mapisHandle->verbsJ, 1)) {
- AFB_ApiError(apiHandle, "Problems at verbs creations for %s", json_object_get_string(mapisHandle->mapiJ));
+ AFB_API_ERROR(apiHandle, "Problems at verbs creations for %s", json_object_get_string(mapisHandle->mapiJ));
return -1;
}
@@ -52,13 +52,13 @@ static int LoadOneMapi(void *data, AFB_ApiT apiHandle) {
}
if( AddActionsToSection(apiHandle, &ctrlConfig->sections[idx], mapisHandle->eventsJ, 0) ) {
- AFB_ApiError(apiHandle, "Wasn't able to add new events to %s", ctrlConfig->sections[idx].uid);
+ AFB_API_ERROR(apiHandle, "Wasn't able to add new events to %s", ctrlConfig->sections[idx].uid);
return -1;
}
}
// declare an event event manager for this API;
- AFB_ApiOnEvent(apiHandle, CtrlDispatchApiEvent);
+ afb_api_on_event(apiHandle, CtrlDispatchApiEvent);
return 0;
}
@@ -77,7 +77,7 @@ static void OneMapiConfig(void *data, json_object *mapiJ) {
"lua", NULL,
"verbs", &mapisHandle->verbsJ,
"events", &mapisHandle->eventsJ)) {
- AFB_ApiError(mapisHandle->mainApiHandle, "Wrong mapis specification, missing uid|[info]|[spath]|libs|[lua]|verbs|[events] for %s", json_object_get_string(mapiJ));
+ AFB_API_ERROR(mapisHandle->mainApiHandle, "Wrong mapis specification, missing uid|[info]|[spath]|libs|[lua]|verbs|[events] for %s", json_object_get_string(mapiJ));
return;
}
@@ -87,12 +87,12 @@ static void OneMapiConfig(void *data, json_object *mapiJ) {
json_object_object_del(mapiJ, "events");
mapisHandle->mapiJ = mapiJ;
- if (!AFB_NewApi(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle))
- AFB_ApiError(mapisHandle->mainApiHandle, "Error creating new api: %s", uid);
+ if (!afb_api_new_api(mapisHandle->mainApiHandle, uid, info, 1, LoadOneMapi, (void*)mapisHandle))
+ AFB_API_ERROR(mapisHandle->mainApiHandle, "Error creating new api: %s", uid);
}
}
-int MapiConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *mapisJ) {
+int MapiConfig(afb_api_t apiHandle, CtlSectionT *section, json_object *mapisJ) {
struct mapisHandleT mapisHandle = {
.mainApiHandle = apiHandle,
.section = section,