summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-manager/4a-hal-manager.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-23 10:21:06 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-11-02 16:12:26 +0100
commitbe188c31f2528cdabfffd07ef1ec87ff6c23330a (patch)
tree9a9dded7fd8348ff2abb71ed046963a1f9a811b7 /4a-hal/4a-hal-manager/4a-hal-manager.c
parentcabdc828ee3eb35d780f2145fdb37081a5f6d71d (diff)
Use ctl defines to call afb functions
Use controller 'afb-defintions.h' defines to call application framework functions. Change-Id: If9599b0397a593440ce2e08f039dc279c63f7428 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-manager/4a-hal-manager.c')
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index 9f124e7..41729fc 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -43,7 +43,7 @@ static struct HalMgrData localHalMgrGlobalData;
AFB_ApiVerbs HalManagerApiStaticVerbs[] =
{
/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
- { .verb = "ping", .callback = HalMgrPing, .info = "Ping test for DynApi"},
+ { .verb = "ping", .callback = HalMgrPing, .info = "Ping test"},
{ .verb = "loaded", .callback = HalMgrLoaded, .info = "Show loaded HAL"},
{ .verb = "load", .callback = HalMgrLoad, .info = "Load an external HAL to HAL Manager"},
{ .verb = "unload", .callback = HalMgrUnload, .info = "Unload an external HAL to HAL Manager"},
@@ -79,7 +79,7 @@ static int HalMgrInitApi(AFB_ApiT apiHandle)
AFB_default = apiHandle;
// Retrieve section config from api handle
- HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle);
+ HalMgrGlobalData = (struct HalMgrData *) AFB_ApiGetUserData(apiHandle);
if(! HalMgrGlobalData)
return -2;
@@ -110,7 +110,7 @@ static int HalMgrLoadApi(void *cbdata, AFB_ApiT apiHandle)
HalMgrGlobalData = (struct HalMgrData *) cbdata;
// Save closure as api's data context
- afb_dynapi_set_userdata(apiHandle, HalMgrGlobalData);
+ AFB_ApiSetUserData(apiHandle, HalMgrGlobalData);
// Add static controls verbs
if(HalUtlLoadVerbs(apiHandle, HalManagerApiStaticVerbs)) {
@@ -119,12 +119,12 @@ static int HalMgrLoadApi(void *cbdata, AFB_ApiT apiHandle)
}
// Declare an event manager for Hal Manager
- afb_dynapi_on_event(apiHandle, HalMgrDispatchApiEvent);
+ AFB_ApiOnEvent(apiHandle, HalMgrDispatchApiEvent);
// Init Api function (does not receive user closure ???)
- afb_dynapi_on_init(apiHandle, HalMgrInitApi);
+ AFB_ApiOnInit(apiHandle, HalMgrInitApi);
- afb_dynapi_seal(apiHandle);
+ AFB_ApiSeal(apiHandle);
return 0;
}
@@ -134,13 +134,12 @@ int HalMgrCreateApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData)
if(! apiHandle || ! HalMgrGlobalData)
return -1;
- // Create one API (Pre-V3 return code ToBeChanged)
- return afb_dynapi_new_api(apiHandle, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO, 1, HalMgrLoadApi, HalMgrGlobalData);
+ // Create one API
+ return AFB_NewApi(apiHandle, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO, 1, HalMgrLoadApi, HalMgrGlobalData) ? 0 : -1;
}
/*******************************************************************************
* Startup function *
- * TBD JAI : Use API-V3 instead of API-PRE-V3 *
******************************************************************************/
int afbBindingEntry(AFB_ApiT apiHandle)
@@ -155,12 +154,12 @@ int afbBindingEntry(AFB_ApiT apiHandle)
AFB_ApiNotice(apiHandle, "Binding start");
- // Load Hal-Manager using DynApi
+ // Load Hal-Manager using Api v3
rc = HalMgrCreateApi(apiHandle, &localHalMgrGlobalData);
if(rc < 0)
status--;
- // Load Hal-Ctls using DynApi
+ // Load Hal-Ctls using Api v3
rc = HalCtlsCreateAllApi(apiHandle, &localHalMgrGlobalData);
if(rc < 0)
status -= rc;