diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-16 17:56:23 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-08-20 16:06:43 +0200 |
commit | 4386ec54f811f19a14d0f60688321d4a1a69b78a (patch) | |
tree | 7ac0dec659f66b13e292811138b99c65e489a4b7 /ctl-lib/ctl-action.c | |
parent | 789a8ae5080bc91ab9ec3bd7760f88b5d214001c (diff) |
Migration to v3
This makes controller fully compatible with binding v3 and
also keeps the compatibility with the Pre-V3 + DYNAPI bindings.
Change-Id: Iaa47e51b9cb964bbe2f050784fca355c780673f8
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-action.c')
-rw-r--r-- | ctl-lib/ctl-action.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c index 55e810e..bb9ac66 100644 --- a/ctl-lib/ctl-action.c +++ b/ctl-lib/ctl-action.c @@ -124,13 +124,13 @@ int ActionExecOne(CtlSourceT *source, CtlActionT* action, json_object *queryJ) { // Direct Request Call in APIV3 -#ifdef AFB_BINDING_PREV3 +#if (defined(AFB_BINDING_PREV3) || (AFB_BINDING_VERSION == 3)) static void ActionDynRequest(AFB_ReqT request) { // retrieve action handle from request and execute the request - json_object *queryJ = afb_request_json(request); - CtlActionT* action = (CtlActionT*) afb_request_get_vcbdata(request); + json_object *queryJ = AFB_ReqJson(request); + CtlActionT* action = (CtlActionT*) AFB_ReqVCBData(request); CtlSourceT source; source.uid = action->uid; @@ -312,12 +312,12 @@ int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *actionJ, "args", &action->argsJ); if (!err) { // in API V3 each control is optionally map to a verb -#ifdef AFB_BINDING_PREV3 +#if (defined(AFB_BINDING_PREV3) || (AFB_BINDING_VERSION == 3)) if(!apiHandle) return -1; action->api = apiHandle; if (exportApi) { - err = afb_dynapi_add_verb(apiHandle, action->uid, action->info, ActionDynRequest, action, NULL, 0); + err = AFB_ApiAddVerb(apiHandle, action->uid, action->info, ActionDynRequest, action, NULL, 0, 0); if (err) { AFB_ApiError(apiHandle, "ACTION-LOAD-ONE fail to register API verb=%s", action->uid); return -1; |