From 9ba38deb72eff0479c0f99c92d121df9861ebbca Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Mon, 11 Jun 2018 02:08:37 +0200 Subject: Use structure defined in controller to load verbs Use structure defined in controller to load verbs into an api using 'HalUtlLoadVerbs' function. Change-Id: I57aabf9ce2c580fc98b7ea8438cd01083e032ac2 Signed-off-by: Jonathan Aillet --- 4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c | 4 +++- 4a-hal/4a-hal-manager/4a-hal-manager.c | 4 +++- 4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c | 4 +++- 4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.h | 11 +---------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c index e7a4825..9eb8ef6 100644 --- a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c +++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c @@ -24,6 +24,8 @@ #include #include +#include + #include #include "../4a-hal-utilities/4a-hal-utilities-verbs-loader.h" @@ -57,7 +59,7 @@ static CtlSectionT ctrlSections[] = ******************************************************************************/ // Every HAL export the same API & Interface Mapping from SndCard to AudioLogic is done through alsaHalSndCardT -static struct HalUtlApiVerb CtlHalDynApiStaticVerbs[] = +static AFB_ApiVerbs CtlHalDynApiStaticVerbs[] = { /* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */ { .verb = "info", .callback = HalCtlsInfo, .info = "List available streams/playbacks/... for this api"}, diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c index f3ebe14..61e2474 100644 --- a/4a-hal/4a-hal-manager/4a-hal-manager.c +++ b/4a-hal/4a-hal-manager/4a-hal-manager.c @@ -21,6 +21,8 @@ #include #include +#include + #include "../4a-hal-utilities/4a-hal-utilities-data.h" #include "../4a-hal-utilities/4a-hal-utilities-verbs-loader.h" #include "../4a-hal-controllers/4a-hal-controllers-api-loader.h" @@ -39,7 +41,7 @@ static struct HalMgrData localHalMgrGlobalData; ******************************************************************************/ // Hal manager exported verbs -struct HalUtlApiVerb HalManagerApiStaticVerbs[] = +AFB_ApiVerbs HalManagerApiStaticVerbs[] = { /* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */ { .verb = "ping", .callback = HalMgrPing, .info = "Ping test for DynApi"}, diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c index 13929b0..0d6f06c 100644 --- a/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c +++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c @@ -21,6 +21,8 @@ #include #include +#include + #include "4a-hal-utilities-verbs-loader.h" /******************************************************************************* @@ -28,7 +30,7 @@ * TBD JAI : Use API-V3 instead of API-PRE-V3 * ******************************************************************************/ -int HalUtlLoadVerbs(AFB_ApiT apiHandle, struct HalUtlApiVerb *verbs) +int HalUtlLoadVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs) { int idx, errCount = 0; diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.h b/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.h index 113a0b0..2bfa1cd 100644 --- a/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.h +++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.h @@ -22,16 +22,7 @@ #include -// Structure to store data necessary to add a verb to a dynamic api -struct HalUtlApiVerb { - const char *verb; /* name of the verb, NULL only at end of the array */ - void (*callback)(AFB_ReqT req); /* callback function implementing the verb */ - const struct afb_auth *auth; /* required authorisation, can be NULL */ - const char *info; /* some info about the verb, can be NULL */ - uint32_t session; -}; - // Verb that allows to add verb to a dynamic api -int HalUtlLoadVerbs(AFB_ApiT apiHandle, struct HalUtlApiVerb *verbs); +int HalUtlLoadVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs); #endif /* _HAL_UTILITIES_VERBS_LOADER_INCLUDE_ */ \ No newline at end of file -- cgit 1.2.3-korg