summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-manager/4a-hal-manager.c
diff options
context:
space:
mode:
Diffstat (limited to '4a-hal/4a-hal-manager/4a-hal-manager.c')
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index c510d17..75177e7 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include "4a-hal-utilities-data.h"
#include "4a-hal-utilities-verbs-loader.h"
@@ -31,7 +31,7 @@
#include "4a-hal-manager-cb.h"
// Default api to print log when apihandle not available
-AFB_ApiT AFB_default;
+afb_api_t AFB_default;
// Local (static) Hal manager data structure
static struct HalMgrData localHalMgrGlobalData;
@@ -41,7 +41,7 @@ static struct HalMgrData localHalMgrGlobalData;
******************************************************************************/
// Hal manager exported verbs
-AFB_ApiVerbs HalManagerApiStaticVerbs[] =
+afb_verb_t HalManagerApiStaticVerbs[] =
{
/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
{ .verb = "ping", .callback = HalMgrPing, .info = "Ping test"},
@@ -67,7 +67,7 @@ struct SpecificHalData **HalMngGetFirstHalData(void)
* Dynamic API functions for hal manager *
******************************************************************************/
-static int HalMgrInitApi(AFB_ApiT apiHandle)
+static int HalMgrInitApi(afb_api_t apiHandle)
{
struct SpecificHalData *currentCtlHalData;
struct HalMgrData *HalMgrGlobalData;
@@ -79,8 +79,7 @@ static int HalMgrInitApi(AFB_ApiT apiHandle)
AFB_default = apiHandle;
// Retrieve section config from api handle
- HalMgrGlobalData = (struct HalMgrData *) AFB_ApiGetUserData(apiHandle);
- if(! HalMgrGlobalData)
+ if(! (HalMgrGlobalData = (struct HalMgrData *) afb_api_get_userdata(apiHandle)))
return -2;
if(HalUtlInitializeHalMgrData(apiHandle, HalMgrGlobalData, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO))
@@ -91,7 +90,7 @@ static int HalMgrInitApi(AFB_ApiT apiHandle)
while(currentCtlHalData) {
if(! currentCtlHalData->apiName)
return -4;
- else if(AFB_RequireApi(apiHandle, currentCtlHalData->apiName, 1))
+ else if(afb_api_require_api(apiHandle, currentCtlHalData->apiName, 1))
return -5;
currentCtlHalData = currentCtlHalData->next;
@@ -100,7 +99,7 @@ static int HalMgrInitApi(AFB_ApiT apiHandle)
return 0;
}
-static int HalMgrLoadApi(void *cbdata, AFB_ApiT apiHandle)
+static int HalMgrLoadApi(void *cbdata, afb_api_t apiHandle)
{
struct HalMgrData *HalMgrGlobalData;
@@ -110,39 +109,39 @@ static int HalMgrLoadApi(void *cbdata, AFB_ApiT apiHandle)
HalMgrGlobalData = (struct HalMgrData *) cbdata;
// Save closure as api's data context
- AFB_ApiSetUserData(apiHandle, HalMgrGlobalData);
+ afb_api_set_userdata(apiHandle, HalMgrGlobalData);
// Add static controls verbs
if(HalUtlLoadVerbs(apiHandle, HalManagerApiStaticVerbs)) {
- AFB_ApiError(apiHandle, "Load section : fail to register static verbs");
+ AFB_API_ERROR(apiHandle, "Load section : fail to register static verbs");
return 1;
}
// Declare an event manager for Hal Manager
- AFB_ApiOnEvent(apiHandle, HalMgrDispatchApiEvent);
+ afb_api_on_event(apiHandle, HalMgrDispatchApiEvent);
// Init Api function (does not receive user closure ???)
- AFB_ApiOnInit(apiHandle, HalMgrInitApi);
+ afb_api_on_init(apiHandle, HalMgrInitApi);
- AFB_ApiSeal(apiHandle);
+ afb_api_seal(apiHandle);
return 0;
}
-int HalMgrCreateApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData)
+int HalMgrCreateApi(afb_api_t apiHandle, struct HalMgrData *HalMgrGlobalData)
{
if(! apiHandle || ! HalMgrGlobalData)
return -1;
// Create one API
- return AFB_NewApi(apiHandle, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO, 1, HalMgrLoadApi, HalMgrGlobalData) ? 0 : -1;
+ return afb_api_new_api(apiHandle, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO, 1, HalMgrLoadApi, HalMgrGlobalData) ? 0 : -1;
}
/*******************************************************************************
* Startup function *
******************************************************************************/
-int afbBindingEntry(AFB_ApiT apiHandle)
+int afbBindingEntry(afb_api_t apiHandle)
{
int status = 0, rc;
@@ -152,7 +151,7 @@ int afbBindingEntry(AFB_ApiT apiHandle)
// Hugely hack to make all V2 AFB_DEBUG to work in fileutils
AFB_default = apiHandle;
- AFB_ApiNotice(apiHandle, "Binding start");
+ AFB_API_NOTICE(apiHandle, "Binding start");
// Load Hal-Manager using Api v3
rc = HalMgrCreateApi(apiHandle, &localHalMgrGlobalData);