summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-06-01 21:56:45 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:52:51 +0200
commitb62ab4c3fa9595715538dda7dfa330dcb77b0778 (patch)
tree4b0ae68e77eb7e192fd0900ff2ca03e8db00663c
parentd7496f864274e75f0635a0c20b93175d00a26114 (diff)
Include afb-definitions when using application framework
Include <afb-definitions.h> from 'app-controller' instead of <afb/afb-binding.h> and use its definitions. It allows to migrate from an application framework version to another with less impact on the code. Change-Id: I22359cd3fe22145b3d6c551f227be2ba7e1b65d5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c10
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.h2
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c22
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h7
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c102
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h13
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c14
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.h2
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-cb.c88
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-cb.h17
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-events.h3
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c14
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c50
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h7
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.c2
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.h9
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c2
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.h7
18 files changed, 183 insertions, 188 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
index 37d6447..366de0f 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
@@ -30,7 +30,7 @@
* HAL controllers alsacore calls funtions *
******************************************************************************/
-bool HalCtlsGetCardIdByCardPath(afb_dynapi *apiHandle, struct SpecificHalData *currentCtlHalData)
+bool HalCtlsGetCardIdByCardPath(AFB_ApiT apiHandle, struct SpecificHalData *currentCtlHalData)
{
int *cardId;
@@ -46,12 +46,12 @@ bool HalCtlsGetCardIdByCardPath(afb_dynapi *apiHandle, struct SpecificHalData *c
wrap_json_pack(&toSendJ, "{s:s}", "devpath", currentCtlHalData->sndCard);
- if(afb_dynapi_call_sync(apiHandle, ALSACORE_API, ALSACORE_GETINFO_VERB, toSendJ, &returnJ)) {
+ if(AFB_ServiceSync(apiHandle, ALSACORE_API, ALSACORE_GETINFO_VERB, toSendJ, &returnJ)) {
returnedStatus = alloca(sizeof(char *));
returnedInfo = alloca(sizeof(char *));
returnedError = HalUtlHandleAppFwCallError(apiHandle, ALSACORE_API, ALSACORE_GETINFO_VERB, returnJ, returnedStatus, returnedInfo);
- AFB_DYNAPI_WARNING(apiHandle,
+ AFB_ApiWarning(apiHandle,
"Error %i during call to verb %s of %s api",
(int) returnedError,
ALSACORE_GETINFO_VERB,
@@ -61,10 +61,10 @@ bool HalCtlsGetCardIdByCardPath(afb_dynapi *apiHandle, struct SpecificHalData *c
if(json_object_object_get_ex(responsJ, "devid", &devidJ) && json_object_is_type(devidJ, json_type_string)) {
cardIdString = (char *) json_object_get_string(devidJ);
if(sscanf(cardIdString, "hw:%i", cardId) <= 0)
- AFB_DYNAPI_WARNING(apiHandle, "Couldn't get valid devid from string: '%s'", cardIdString);
+ AFB_ApiWarning(apiHandle, "Couldn't get valid devid from string: '%s'", cardIdString);
}
else {
- AFB_DYNAPI_WARNING(apiHandle, "Response devid is not present/valid");
+ AFB_ApiWarning(apiHandle, "Response devid is not present/valid");
}
currentCtlHalData->sndCardId = *cardId;
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.h b/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.h
index 19ff9e5..0c24e4f 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.h
@@ -25,6 +25,6 @@
#define ALSACORE_GETINFO_VERB "infoget"
// HAL controllers alsacore calls funtions
-bool HalCtlsGetCardIdByCardPath(afb_dynapi *apiHandle, struct SpecificHalData *currentCtlHalData);
+bool HalCtlsGetCardIdByCardPath(AFB_ApiT apiHandle, struct SpecificHalData *currentCtlHalData);
#endif /* HAL_CTLS_ALSACORE_LINK_INCLUDE_ */ \ No newline at end of file
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 8c4a85f..15077d8 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
@@ -33,7 +33,7 @@
#include "4a-hal-controllers-cb.h"
// Default api to print log when apihandle not available
-afb_dynapi *AFB_default;
+AFB_ApiT AFB_default;
/*******************************************************************************
* Json parsing functions using app controller *
@@ -69,7 +69,7 @@ static struct HalUtlApiVerb CtlHalDynApiStaticVerbs[] =
* TODO JAI : Use API-V3 instead of API-PRE-V3 *
******************************************************************************/
-static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
+static int HalCtlsInitOneApi(AFB_ApiT apiHandle)
{
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
@@ -115,7 +115,7 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
return CtlConfigExec(apiHandle, ctrlConfig);
}
-static int HalCtlsLoadOneApi(void *cbdata, afb_dynapi *apiHandle)
+static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle)
{
int err;
CtlConfigT *ctrlConfig;
@@ -130,7 +130,7 @@ static int HalCtlsLoadOneApi(void *cbdata, afb_dynapi *apiHandle)
// Add static controls verbs
if(HalUtlLoadVerbs(apiHandle, CtlHalDynApiStaticVerbs)) {
- AFB_DYNAPI_ERROR(apiHandle, "%s : load Section : fail to register static V2 verbs", __func__);
+ AFB_ApiError(apiHandle, "%s : load Section : fail to register static V2 verbs", __func__);
return 1;
}
@@ -146,7 +146,7 @@ static int HalCtlsLoadOneApi(void *cbdata, afb_dynapi *apiHandle)
return err;
}
-int HalCtlsCreateApi(afb_dynapi *apiHandle, char *path, struct HalMgrData *HalMgrGlobalData)
+int HalCtlsCreateApi(AFB_ApiT apiHandle, char *path, struct HalMgrData *HalMgrGlobalData)
{
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
@@ -157,12 +157,12 @@ int HalCtlsCreateApi(afb_dynapi *apiHandle, char *path, struct HalMgrData *HalMg
// Create one Api per file
ctrlConfig = CtlLoadMetaData(apiHandle, path);
if(! ctrlConfig) {
- AFB_DYNAPI_ERROR(apiHandle, "%s: No valid control config file in:\n-- %s", __func__, path);
+ AFB_ApiError(apiHandle, "%s: No valid control config file in:\n-- %s", __func__, path);
return -2;
}
if(! ctrlConfig->api) {
- AFB_DYNAPI_ERROR(apiHandle, "%s: API Missing from metadata in:\n-- %s", __func__, path);
+ AFB_ApiError(apiHandle, "%s: API Missing from metadata in:\n-- %s", __func__, path);
return -3;
}
@@ -181,7 +181,7 @@ int HalCtlsCreateApi(afb_dynapi *apiHandle, char *path, struct HalMgrData *HalMg
return afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, HalCtlsLoadOneApi, ctrlConfig);
}
-int HalCtlsCreateAllApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData)
+int HalCtlsCreateAllApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData)
{
int index, err, status = 0;
char *dirList, *fileName, *fullPath;
@@ -197,7 +197,7 @@ int HalCtlsCreateAllApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalDa
// Hugely hack to make all V2 AFB_DEBUG to work in fileutils
AFB_default = apiHandle;
- AFB_DYNAPI_NOTICE(apiHandle, "In %s", __func__);
+ AFB_ApiNotice(apiHandle, "In %s", __func__);
dirList = getenv("CONTROL_CONFIG_PATH");
if(! dirList)
@@ -205,7 +205,7 @@ int HalCtlsCreateAllApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalDa
configJ = CtlConfigScan(dirList, "hal");
if(! configJ) {
- AFB_DYNAPI_ERROR(apiHandle, "%s: No hal-(binder-middle-name)*.json config file(s) found in %s ", __func__, dirList);
+ AFB_ApiError(apiHandle, "%s: No hal-(binder-middle-name)*.json config file(s) found in %s ", __func__, dirList);
return -2;
}
@@ -215,7 +215,7 @@ int HalCtlsCreateAllApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalDa
err = wrap_json_unpack(entryJ, "{s:s, s:s !}", "fullpath", &fullPath, "filename", &fileName);
if(err) {
- AFB_DYNAPI_ERROR(apiHandle, "%s: HOOPs invalid JSON entry = %s", __func__, json_object_get_string(entryJ));
+ AFB_ApiError(apiHandle, "%s: HOOPs invalid JSON entry = %s", __func__, json_object_get_string(entryJ));
return -1;
}
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h
index 85d42bd..99b304e 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h
@@ -20,13 +20,12 @@
#include <stdio.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
#include "../4a-hal-utilities/4a-hal-utilities-data.h"
// Verbs that can be use to create api
-int HalCtlsCreateApi(afb_dynapi *apiHandle, char *path, struct HalMgrData *HalMgrGlobalData);
-int HalCtlsCreateAllApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData);
+int HalCtlsCreateApi(AFB_ApiT apiHandle, char *path, struct HalMgrData *HalMgrGlobalData);
+int HalCtlsCreateAllApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData);
#endif /* _HALMGR_HALCTL_DYNAPI_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
index 3586eca..0da335a 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -34,7 +34,7 @@
* HAL controllers sections parsing functions *
******************************************************************************/
-int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object *MixerJ)
+int HalCtlsHalMixerConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *MixerJ)
{
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentHalData;
@@ -67,9 +67,9 @@ int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_obje
}
// TODO JAI : to implement
-int HalCtlsHalMapConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object *StreamControlsJ)
+int HalCtlsHalMapConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *StreamControlsJ)
{
- AFB_DYNAPI_WARNING(apiHandle, "JAI :%s not implemented yet", __func__);
+ AFB_ApiWarning(apiHandle, "JAI :%s not implemented yet", __func__);
return 0;
}
@@ -78,57 +78,57 @@ int HalCtlsHalMapConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object
* HAL controllers verbs functions *
******************************************************************************/
-void HalCtlsActionOnStream(afb_request *request)
+void HalCtlsActionOnStream(AFB_ReqT request)
{
int verbToCallSize;
char *apiToCall, *mixerVerbName, *verbToCall;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
json_object *requestJson, *returnJ, *toReturnJ;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "api_handle", "Can't get current hal controller api handle");
+ AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle");
return;
}
ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
if(! ctrlConfig) {
- afb_request_fail(request, "hal_controller_config", "Can't get current hal controller config");
+ AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
return;
}
currentCtlHalData = (struct SpecificHalData *) ctrlConfig->external;
if(! currentCtlHalData) {
- afb_request_fail(request, "hal_controller_data", "Can't get current hal controller data");
+ AFB_ReqFail(request, "hal_controller_data", "Can't get current hal controller data");
return;
}
- requestJson = afb_request_json(request);
+ requestJson = AFB_ReqJson(request);
if(! requestJson) {
- afb_request_fail(request, "request_json", "Can't get request json");
+ AFB_ReqFail(request, "request_json", "Can't get request json");
return;
}
apiToCall = currentCtlHalData->ctlHalSpecificData->mixerApiName;
if(! apiToCall) {
- afb_request_fail(request, "mixer_api", "Can't get mixer api");
+ AFB_ReqFail(request, "mixer_api", "Can't get mixer api");
return;
}
mixerVerbName = currentCtlHalData->ctlHalSpecificData->mixerVerbName;
if(! mixerVerbName) {
- afb_request_fail(request, "hal_softmixer_verb", "Can't get hal mixer verb prefix");
+ AFB_ReqFail(request, "hal_softmixer_verb", "Can't get hal mixer verb prefix");
return;
}
if(currentCtlHalData->status != HAL_STATUS_AVAILABLE) {
- afb_request_fail(request, "hal_unavailable", "Seems that hal is not available");
+ AFB_ReqFail(request, "hal_unavailable", "Seems that hal is not available");
return;
}
@@ -142,64 +142,66 @@ void HalCtlsActionOnStream(afb_request *request)
strcat(verbToCall, "/");
strcat(verbToCall, request->verb);
- if(afb_dynapi_call_sync(apiHandle, apiToCall, verbToCall, json_object_get(requestJson), &returnJ)) {
+ if(AFB_ServiceSync(apiHandle, apiToCall, verbToCall, json_object_get(requestJson), &returnJ)) {
HalUtlHandleAppFwCallErrorInRequest(request, apiToCall, verbToCall, returnJ, "stream_action");
}
else if(json_object_object_get_ex(returnJ, "response", &toReturnJ)){
- afb_request_success_f(request, toReturnJ, "Action %s correctly transfered to %s without any error raised",
- verbToCall,
- apiToCall);
+ AFB_ReqSucessF(request,
+ toReturnJ,
+ "Action %s correctly transfered to %s without any error raised",
+ verbToCall,
+ apiToCall);
}
else {
- afb_request_fail_f(request, "invalid_response", "Action %s correctly transfered to %s, but response is not valid",
+ AFB_ReqFailF(request, "invalid_response", "Action %s correctly transfered to %s, but response is not valid",
verbToCall,
apiToCall);
}
}
-void HalCtlsListVerbs(afb_request *request)
+void HalCtlsListVerbs(AFB_ReqT request)
{
unsigned int idx;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
json_object *requestJson, *requestAnswer, *streamsArray, *currentStream;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "api_handle", "Can't get current hal controller api handle");
+ AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle");
return;
}
ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
if(! ctrlConfig) {
- afb_request_fail(request, "hal_controller_config", "Can't get current hal controller config");
+ AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
return;
}
currentCtlHalData = (struct SpecificHalData *) ctrlConfig->external;
if(! currentCtlHalData) {
- afb_request_fail(request, "hal_controller_data", "Can't get current hal controller data");
+ AFB_ReqFail(request, "hal_controller_data", "Can't get current hal controller data");
return;
}
if(! currentCtlHalData->ctlHalSpecificData->ctlHalStreamsData.count) {
- afb_request_success(request, NULL, "No data to answer, no streams found");
+ AFB_ReqSucess(request, NULL, "No data to answer, no streams found");
return;
}
- requestJson = afb_request_json(request);
+ requestJson = AFB_ReqJson(request);
if(! requestJson) {
- afb_request_fail(request, "request_json", "Can't get request json");
+ AFB_ReqFail(request, "request_json", "Can't get request json");
return;
}
streamsArray = json_object_new_array();
if(! streamsArray) {
- afb_request_fail(request, "json_answer", "Can't generate par of json answer");
+ AFB_ReqFail(request, "json_answer", "Can't generate par of json answer");
return;
}
@@ -215,82 +217,82 @@ void HalCtlsListVerbs(afb_request *request)
wrap_json_pack(&requestAnswer, "{s:o}", "streams", streamsArray);
- afb_request_success(request, requestAnswer, "Requested data");
+ AFB_ReqSucess(request, requestAnswer, "Requested data");
}
-void HalCtlsInitMixer(afb_request *request)
+void HalCtlsInitMixer(AFB_ReqT request)
{
unsigned int err;
char *apiToCall;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
json_object *returnJ, *toReturnJ;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT ) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "api_handle", "Can't get hal manager api handle");
+ AFB_ReqFail(request, "api_handle", "Can't get current hal api handle");
return;
}
ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
if(! ctrlConfig) {
- afb_request_fail(request, "hal_controller_config", "Can't get current hal controller config");
+ AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
return;
}
currentCtlHalData = (struct SpecificHalData *) ctrlConfig->external;
if(! currentCtlHalData) {
- afb_request_fail(request, "hal_controller_data", "Can't get current hal controller data");
+ AFB_ReqFail(request, "hal_controller_data", "Can't get current hal controller data");
return;
}
apiToCall = currentCtlHalData->ctlHalSpecificData->mixerApiName;
if(! apiToCall) {
- afb_request_fail(request, "mixer_api", "Can't get mixer api");
+ AFB_ReqFail(request, "mixer_api", "Can't get mixer api");
return;
}
switch(currentCtlHalData->status) {
case HAL_STATUS_UNAVAILABLE:
- afb_request_fail(request, "hal_unavailable", "Seems that the hal corresponding card was not found by alsacore at startup");
+ AFB_ReqFail(request, "hal_unavailable", "Seems that the hal corresponding card was not found by alsacore at startup");
return;
case HAL_STATUS_READY:
- afb_request_success(request, NULL, "Seems that the hal mixer is already initialized");
+ AFB_ReqSucess(request, NULL, "Seems that the hal mixer is already initialized");
return;
case HAL_STATUS_AVAILABLE:
break;
}
- if(afb_dynapi_call_sync(apiHandle, apiToCall, "create", json_object_get(currentCtlHalData->ctlHalSpecificData->halMixerJ), &returnJ)) {
+ if(AFB_ServiceSync(apiHandle, apiToCall, "create", json_object_get(currentCtlHalData->ctlHalSpecificData->halMixerJ), &returnJ)) {
HalUtlHandleAppFwCallErrorInRequest(request, apiToCall, "create", returnJ, "mixer_create");
}
else if(json_object_object_get_ex(returnJ, "response", &toReturnJ)) {
err = HalCtlsHandleMixerAttachResponse(request, &currentCtlHalData->ctlHalSpecificData->ctlHalStreamsData, toReturnJ);
if(err != (int) MIXER_NO_ERROR) {
- afb_request_success_f(request,
- toReturnJ,
- "Seems that create call to api %s succeed but this warning was risen by response decoder : %i",
- apiToCall,
- err);
+ AFB_ReqFailF(request,
+ "handler_mixer_response",
+ "Seems that create call to api %s succeed but this warning was risen by response decoder : %i",
+ apiToCall,
+ err);
return;
}
- afb_request_success_f(request,
- toReturnJ,
- "Seems that create call to api %s succeed with no warning raised",
- apiToCall);
+ AFB_ReqSucessF(request,
+ toReturnJ,
+ "Seems that create call to api %s succeed with no warning raised",
+ apiToCall);
currentCtlHalData->status = HAL_STATUS_READY;
}
else {
- afb_request_fail_f(request,
+ AFB_ReqFailF(request,
"invalid_response",
"Seems that mix_new call to api %s succeed, but response is not valid",
apiToCall);
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
index 304546c..ba17997 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
@@ -20,18 +20,17 @@
#include <stdio.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
#include <ctl-config.h>
// HAL controllers sections parsing functions
-int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object *MixerJ);
-int HalCtlsHalMapConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object *StreamControlsJ);
+int HalCtlsHalMixerConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *MixerJ);
+int HalCtlsHalMapConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *StreamControlsJ);
// HAL controllers verbs functions
-void HalCtlsActionOnStream(afb_request *request);
-void HalCtlsListVerbs(afb_request *request);
-void HalCtlsInitMixer(afb_request *request);
+void HalCtlsActionOnStream(AFB_ReqT request);
+void HalCtlsListVerbs(AFB_ReqT request);
+void HalCtlsInitMixer(AFB_ReqT request);
#endif /* _HALMGR_CB_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c
index 789913d..56a50a8 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c
@@ -37,15 +37,15 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT
char *currentStreamName, *currentStreamCardId;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
struct HalUtlApiVerb *CtlHalDynApiStreamVerbs;
json_object *currentStreamJ;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
- AFB_REQUEST_WARNING(request, "%s: Can't get current hal api handle", __func__);
+ AFB_ReqWarning(request, "%s: Can't get current hal api handle", __func__);
return (int) MIXER_ERROR_API_UNAVAILABLE;
}
@@ -58,7 +58,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT
break;
default:
currentHalStreamsData->count = 0;
- AFB_REQUEST_WARNING(request, "%s: no streams returned", __func__);
+ AFB_ReqWarning(request, "%s: no streams returned", __func__);
return (int) MIXER_ERROR_NO_STREAMS;
}
@@ -75,11 +75,11 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT
currentStreamJ = mixerResponseJ;
if(wrap_json_unpack(currentStreamJ, "{s:s}", "uid", &currentStreamName)) {
- AFB_REQUEST_WARNING(request, "%s: can't find name in current stream object", __func__);
+ AFB_ReqWarning(request, "%s: can't find name in current stream object", __func__);
err += (int) MIXER_ERROR_STREAM_NAME_UNAVAILABLE;
}
else if(wrap_json_unpack(currentStreamJ, "{s:s}", "alsa", &currentStreamCardId)) {
- AFB_REQUEST_WARNING(request, "%s: can't find card id in current stream object", __func__);
+ AFB_ReqWarning(request, "%s: can't find card id in current stream object", __func__);
err += (int) MIXER_ERROR_STREAM_CARDID_UNAVAILABLE;
}
else {
@@ -93,7 +93,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT
}
if(HalUtlLoadVerbs(apiHandle, CtlHalDynApiStreamVerbs)) {
- AFB_REQUEST_WARNING(request, "%s: error while creating verbs for streams", __func__);
+ AFB_ReqWarning(request, "%s: error while creating verbs for streams", __func__);
err += (int) MIXER_ERROR_COULDNT_ADD_STREAMS_AS_VERB;
}
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.h b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.h
index b9c0ecd..09e0dc7 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.h
@@ -35,6 +35,6 @@ enum MixerStatus {
};
// HAL controllers handle mixer response function
-int HalCtlsHandleMixerAttachResponse(afb_request *request, struct CtlHalStreamsDataT *currentHalStreamsData, json_object *MixerResponseJ);
+int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT *currentHalStreamsData, json_object *MixerResponseJ);
#endif /* _HAL_CTLS_SOFTMIXER_LINK_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
index 75198a9..41517f6 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
@@ -33,9 +33,9 @@
******************************************************************************/
// TODO JAI : to implement
-void HalMgrDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_object *eventJ)
+void HalMgrDispatchApiEvent(AFB_ApiT apiHandle, const char *evtLabel, json_object *eventJ)
{
- AFB_DYNAPI_WARNING(apiHandle, "JAI :%s not implemented yet", __func__);
+ AFB_ApiWarning(apiHandle, "JAI :%s not implemented yet", __func__);
// Use "4a-hal-manager-events.h" to handle events
}
@@ -43,18 +43,18 @@ void HalMgrDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_ob
* TODO JAI : Present for test, delete this function when validated *
******************************************************************************/
-void HalMgrPing(afb_request *request)
+void HalMgrPing(AFB_ReqT request)
{
static int count = 0;
count++;
if(request->dynapi)
- AFB_REQUEST_NOTICE(request, "JAI :%s (%s): ping count = %d", request->api, request->dynapi->apiname, count);
+ AFB_ReqNotice(request, "JAI :%s (%s): ping count = %d", request->api, request->dynapi->apiname, count);
else
- AFB_REQUEST_NOTICE(request, "JAI: %s: ping count = %d", request->api, count);
+ AFB_ReqNotice(request, "JAI: %s: ping count = %d", request->api, count);
- afb_request_success(request, json_object_new_int(count), NULL);
+ AFB_ReqSucess(request, json_object_new_int(count), NULL);
return;
}
@@ -63,44 +63,44 @@ void HalMgrPing(afb_request *request)
* HAL Manager verbs functions *
******************************************************************************/
-void HalMgrLoaded(afb_request *request)
+void HalMgrLoaded(AFB_ReqT request)
{
int requestJsonErr, requestOptionValue;
uint64_t cpt, numberOfLoadedApi;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
struct HalMgrData *HalMgrGlobalData;
struct SpecificHalData *currentHalData;
json_object *requestJson, *requestAnswer, *apiObject;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT ) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "api_handle", "Can't get hal manager api handle");
+ AFB_ReqFail(request, "api_handle", "Can't get hal manager api handle");
return;
}
HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle);
if(! HalMgrGlobalData) {
- afb_request_fail(request, "hal_manager_data", "Can't get hal manager data");
+ AFB_ReqFail(request, "hal_manager_data", "Can't get hal manager data");
return;
}
- requestJson = afb_request_json(request);
+ requestJson = AFB_ReqJson(request);
if(! requestJson) {
- afb_request_fail(request, "request_json", "Can't get request json");
+ AFB_ReqFail(request, "request_json", "Can't get request json");
return;
}
numberOfLoadedApi = HalUtlGetNumberOfHalInList(HalMgrGlobalData);
if(! numberOfLoadedApi) {
- afb_request_success(request, NULL, "No Hal Api loaded");
+ AFB_ReqSucess(request, NULL, "No Hal Api loaded");
return;
}
requestAnswer = json_object_new_array();
if(! requestAnswer) {
- afb_request_fail(request, "json_answer", "Can't generate json answer");
+ AFB_ReqFail(request, "json_answer", "Can't generate json answer");
return;
}
@@ -136,39 +136,39 @@ void HalMgrLoaded(afb_request *request)
}
}
- afb_request_success(request, requestAnswer, "Requested data");
+ AFB_ReqSucess(request, requestAnswer, "Requested data");
}
-void HalMgrLoad(afb_request *request)
+void HalMgrLoad(AFB_ReqT request)
{
char *apiName, *sndCard, *info = NULL, *author = NULL, *version = NULL, *date = NULL;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
struct HalMgrData *HalMgrGlobalData;
struct SpecificHalData *addedHal;
struct json_object *requestJson, *apiReceviedMetadata;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "api_handle", "Can't get hal manager api handle");
+ AFB_ReqFail(request, "api_handle", "Can't get hal manager api handle");
return;
}
HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle);
if(! HalMgrGlobalData) {
- afb_request_fail(request, "hal_manager_data", "Can't get hal manager data");
+ AFB_ReqFail(request, "hal_manager_data", "Can't get hal manager data");
return;
}
- requestJson = afb_request_json(request);
+ requestJson = AFB_ReqJson(request);
if(! requestJson) {
- afb_request_fail(request, "request_json", "Can't get request json");
+ AFB_ReqFail(request, "request_json", "Can't get request json");
return;
}
if(! json_object_object_get_ex(requestJson, "metadata", &apiReceviedMetadata)) {
- afb_request_fail(request, "api_metadata", "Can't get api to register metadata");
+ AFB_ReqFail(request, "api_metadata", "Can't get api to register metadata");
return;
}
@@ -180,7 +180,7 @@ void HalMgrLoad(afb_request *request)
"author", &author,
"version", &version,
"date", &date)) {
- afb_request_fail(request, "api_metadata", "Can't metadata of api to register");
+ AFB_ReqFail(request, "api_metadata", "Can't metadata of api to register");
return;
}
@@ -208,75 +208,75 @@ void HalMgrLoad(afb_request *request)
// TODO JAI: add subscription to this api status events
- afb_request_success(request, NULL, "Api successfully registered");
+ AFB_ReqSucess(request, NULL, "Api successfully registered");
}
-void HalMgrUnload(afb_request *request)
+void HalMgrUnload(AFB_ReqT request)
{
char *apiName;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
struct HalMgrData *HalMgrGlobalData;
struct SpecificHalData *HalToRemove;
struct json_object *requestJson;
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail(request, "api_handle", "Can't get hal manager api handle");
+ AFB_ReqFail(request, "api_handle", "Can't get hal manager api handle");
return;
}
HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle);
if(! HalMgrGlobalData) {
- afb_request_fail(request, "hal_manager_data", "Can't get hal manager data");
+ AFB_ReqFail(request, "hal_manager_data", "Can't get hal manager data");
return;
}
- requestJson = afb_request_json(request);
+ requestJson = AFB_ReqJson(request);
if(! requestJson) {
- afb_request_fail(request, "request_json", "Can't get request json");
+ AFB_ReqFail(request, "request_json", "Can't get request json");
return;
}
if(wrap_json_unpack(requestJson, "{s:s}", "api", &apiName)) {
- afb_request_fail(request, "requested_api", "Can't get api to remove");
+ AFB_ReqFail(request, "requested_api", "Can't get api to remove");
return;
}
HalToRemove = HalUtlSearchHalDataByApiName(HalMgrGlobalData, apiName);
if(! HalToRemove) {
- afb_request_fail(request, "requested_api", "Can't find api to remove");
+ AFB_ReqFail(request, "requested_api", "Can't find api to remove");
return;
}
if(HalToRemove->internal) {
- afb_request_fail(request, "requested_api", "Can't remove an internal controller api");
+ AFB_ReqFail(request, "requested_api", "Can't remove an internal controller api");
return;
}
if(HalUtlRemoveSelectedHalFromList(HalMgrGlobalData, HalToRemove)) {
- afb_request_fail(request, "unregister_error", "Didn't succeed to remove specified api");
+ AFB_ReqFail(request, "unregister_error", "Didn't succeed to remove specified api");
return;
}
// TODO JAI: remove subscription to this api status events
- afb_request_success(request, NULL, "Api successfully unregistered");
+ AFB_ReqSucess(request, NULL, "Api successfully unregistered");
}
// TODO JAI : to implement
-void HalMgrSubscribeEvent(afb_request *request)
+void HalMgrSubscribeEvent(AFB_ReqT request)
{
- AFB_REQUEST_WARNING(request, "JAI :%s not implemented yet", __func__);
+ AFB_ReqWarning(request, "JAI :%s not implemented yet", __func__);
- afb_request_success(request, json_object_new_boolean(false), NULL);
+ AFB_ReqSucess(request, json_object_new_boolean(false), NULL);
}
// TODO JAI : to implement
-void HalMgrUnsubscribeEvent(afb_request *request)
+void HalMgrUnsubscribeEvent(AFB_ReqT request)
{
- AFB_REQUEST_WARNING(request, "JAI :%s not implemented yet", __func__);
+ AFB_ReqWarning(request, "JAI :%s not implemented yet", __func__);
- afb_request_success(request, json_object_new_boolean(false), NULL);
+ AFB_ReqSucess(request, json_object_new_boolean(false), NULL);
} \ No newline at end of file
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.h b/4a-hal/4a-hal-manager/4a-hal-manager-cb.h
index 728191d..4213196 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.h
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.h
@@ -20,19 +20,18 @@
#include <stdio.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
// Event handler
-void HalMgrDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_object *eventJ);
+void HalMgrDispatchApiEvent(AFB_ApiT apiHandle, const char *evtLabel, json_object *eventJ);
// Exported verbs callbacks
-void HalMgrPing(afb_request *request);
+void HalMgrPing(AFB_ReqT request);
-void HalMgrLoaded(afb_request *request);
-void HalMgrLoad(afb_request *request);
-void HalMgrUnload(afb_request *request);
-void HalMgrSubscribeEvent(afb_request *request);
-void HalMgrUnsubscribeEvent(afb_request *request);
+void HalMgrLoaded(AFB_ReqT request);
+void HalMgrLoad(AFB_ReqT request);
+void HalMgrUnload(AFB_ReqT request);
+void HalMgrSubscribeEvent(AFB_ReqT request);
+void HalMgrUnsubscribeEvent(AFB_ReqT request);
#endif /* _HALMGR_CB_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-events.h b/4a-hal/4a-hal-manager/4a-hal-manager-events.h
index f7ad61e..e1c84c6 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-events.h
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-events.h
@@ -20,8 +20,7 @@
#include <stdio.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
// TODO JAI: declare events handlers functions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index df2ead5..8df5365 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -29,7 +29,7 @@
#include "4a-hal-manager-cb.h"
// Default api to print log when apihandle not available
-afb_dynapi *AFB_default;
+AFB_ApiT AFB_default;
/*******************************************************************************
* HAL Manager verbs table *
@@ -53,7 +53,7 @@ struct HalUtlApiVerb HalManagerApiStaticVerbs[] =
* TODO JAI : Use API-V3 instead of API-PRE-V3 *
******************************************************************************/
-static int HalMgrInitApi(afb_dynapi *apiHandle)
+static int HalMgrInitApi(AFB_ApiT apiHandle)
{
struct HalMgrData *HalMgrGlobalData;
@@ -74,7 +74,7 @@ static int HalMgrInitApi(afb_dynapi *apiHandle)
return 0;
}
-static int HalMgrLoadApi(void *cbdata, afb_dynapi *apiHandle)
+static int HalMgrLoadApi(void *cbdata, AFB_ApiT apiHandle)
{
struct HalMgrData *HalMgrGlobalData;
@@ -88,7 +88,7 @@ static int HalMgrLoadApi(void *cbdata, afb_dynapi *apiHandle)
// Add static controls verbs
if(HalUtlLoadVerbs(apiHandle, HalManagerApiStaticVerbs)) {
- AFB_DYNAPI_ERROR(apiHandle, "%s : load section : fail to register static V2 verbs", __func__);
+ AFB_ApiError(apiHandle, "%s : load section : fail to register static V2 verbs", __func__);
return 1;
}
@@ -103,7 +103,7 @@ static int HalMgrLoadApi(void *cbdata, afb_dynapi *apiHandle)
return 0;
}
-int HalMgrCreateApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData)
+int HalMgrCreateApi(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData)
{
if(! apiHandle || ! HalMgrGlobalData)
return -1;
@@ -117,7 +117,7 @@ int HalMgrCreateApi(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData)
* TODO JAI : Use API-V3 instead of API-PRE-V3 *
******************************************************************************/
-int afbBindingVdyn(afb_dynapi *apiHandle)
+int afbBindingVdyn(AFB_ApiT apiHandle)
{
int status = 0, rc;
struct HalMgrData *HalMgrGlobalData;
@@ -132,7 +132,7 @@ int afbBindingVdyn(afb_dynapi *apiHandle)
// Hugely hack to make all V2 AFB_DEBUG to work in fileutils
AFB_default = apiHandle;
- AFB_DYNAPI_NOTICE(apiHandle, "In %s", __func__);
+ AFB_ApiNotice(apiHandle, "In %s", __func__);
// Load Hal-Manager using DynApi
rc = HalMgrCreateApi(apiHandle, HalMgrGlobalData);
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c
index 12ee3e1..bb12119 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c
@@ -27,7 +27,7 @@
* Handle application framework response function *
******************************************************************************/
-enum CallError HalUtlHandleAppFwCallError(afb_dynapi *apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo)
+enum CallError HalUtlHandleAppFwCallError(AFB_ApiT apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo)
{
json_object *returnedRequestJ, *returnedStatusJ, *returnedInfoJ;
@@ -35,50 +35,50 @@ enum CallError HalUtlHandleAppFwCallError(afb_dynapi *apiHandle, char *apiCalled
return CALL_ERROR_INVALID_ARGS;
if(! json_object_object_get_ex(callReturnJ, "request", &returnedRequestJ)) {
- AFB_DYNAPI_WARNING(apiHandle, "Couldn't get response request object");
+ AFB_ApiWarning(apiHandle, "Couldn't get response request object");
return CALL_ERROR_REQUEST_UNAVAILABLE;
}
if(! json_object_is_type(returnedRequestJ, json_type_object)) {
- AFB_DYNAPI_WARNING(apiHandle, "Response request object is not valid");
+ AFB_ApiWarning(apiHandle, "Response request object is not valid");
return CALL_ERROR_REQUEST_NOT_VALID;
}
if(! json_object_object_get_ex(returnedRequestJ, "status", &returnedStatusJ)) {
- AFB_DYNAPI_WARNING(apiHandle, "Couldn't get response status object");
+ AFB_ApiWarning(apiHandle, "Couldn't get response status object");
return CALL_ERROR_REQUEST_STATUS_UNAVAILABLE;
}
if(! json_object_is_type(returnedStatusJ, json_type_string)) {
- AFB_DYNAPI_WARNING(apiHandle, "Response status object is not valid");
+ AFB_ApiWarning(apiHandle, "Response status object is not valid");
return CALL_ERROR_REQUEST_STATUS_NOT_VALID;
}
*returnedStatus = (char *) json_object_get_string(returnedStatusJ);
if(! strcmp(*returnedStatus, "unknown-api")) {
- AFB_DYNAPI_WARNING(apiHandle, "Api %s not found", apiCalled);
+ AFB_ApiWarning(apiHandle, "Api %s not found", apiCalled);
return CALL_ERROR_API_UNAVAILABLE;
}
if(! strcmp(*returnedStatus, "unknown-verb")) {
- AFB_DYNAPI_WARNING(apiHandle, "Verb %s of api %s not found", verbCalled, apiCalled);
+ AFB_ApiWarning(apiHandle, "Verb %s of api %s not found", verbCalled, apiCalled);
return CALL_ERROR_VERB_UNAVAILABLE;
}
if(! json_object_object_get_ex(returnedRequestJ, "info", &returnedInfoJ)) {
- AFB_DYNAPI_WARNING(apiHandle, "Couldn't get response info object");
+ AFB_ApiWarning(apiHandle, "Couldn't get response info object");
return CALL_ERROR_REQUEST_INFO_UNAVAILABLE;
}
if(! json_object_is_type(returnedInfoJ, json_type_string)) {
- AFB_DYNAPI_WARNING(apiHandle, "Response info object is not valid");
+ AFB_ApiWarning(apiHandle, "Response info object is not valid");
return CALL_ERROR_REQUEST_INFO_NOT_VALID;
}
*returnedInfo = (char *) json_object_get_string(returnedInfoJ);
- AFB_DYNAPI_WARNING(apiHandle,
+ AFB_ApiWarning(apiHandle,
"Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
apiCalled,
verbCalled,
@@ -88,20 +88,20 @@ enum CallError HalUtlHandleAppFwCallError(afb_dynapi *apiHandle, char *apiCalled
return CALL_ERROR_RETURNED;
}
-void HalUtlHandleAppFwCallErrorInRequest(afb_request *request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend)
+void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend)
{
char **returnedStatus, **returnedInfo;
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
if(! request || ! apiCalled || ! verbCalled || ! callReturnJ) {
- afb_request_fail_f(request, "invalid_args", "%s: invalid arguments", __func__);
+ AFB_ReqFailF(request, "invalid_args", "%s: invalid arguments", __func__);
return;
}
- apiHandle = (afb_dynapi *) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
- afb_request_fail_f(request, "api_handle", "%s: Can't get hal manager api handle", __func__);
+ AFB_ReqFailF(request, "api_handle", "%s: Can't get hal manager api handle", __func__);
return;
}
@@ -115,25 +115,25 @@ void HalUtlHandleAppFwCallErrorInRequest(afb_request *request, char *apiCalled,
case CALL_ERROR_REQUEST_STATUS_NOT_VALID:
case CALL_ERROR_REQUEST_INFO_UNAVAILABLE:
case CALL_ERROR_REQUEST_INFO_NOT_VALID:
- afb_request_fail(request, errorStatusToSend, "Error with response object");
+ AFB_ReqFail(request, errorStatusToSend, "Error with response object");
return;
case CALL_ERROR_API_UNAVAILABLE:
- afb_request_fail_f(request, errorStatusToSend, "Api %s not found", apiCalled);
+ AFB_ReqFailF(request, errorStatusToSend, "Api %s not found", apiCalled);
return;
case CALL_ERROR_VERB_UNAVAILABLE:
- afb_request_fail_f(request, errorStatusToSend, "Verb %s of api %s not found", verbCalled, apiCalled);
+ AFB_ReqFailF(request, errorStatusToSend, "Verb %s of api %s not found", verbCalled, apiCalled);
return;
case CALL_ERROR_RETURNED:
- afb_request_fail_f(request,
- errorStatusToSend,
- "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
- apiCalled,
- verbCalled,
- *returnedStatus,
- *returnedInfo);
+ AFB_ReqFailF(request,
+ errorStatusToSend,
+ "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
+ apiCalled,
+ verbCalled,
+ *returnedStatus,
+ *returnedInfo);
return;
case CALL_ERROR_INVALID_ARGS:
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h b/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h
index 54cdcc2..3279e40 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h
@@ -22,8 +22,7 @@
#include <wrap-json.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
// Enum for the type of error detected
enum CallError {
@@ -40,7 +39,7 @@ enum CallError {
};
// Handle application framework response function
-enum CallError HalUtlHandleAppFwCallError(afb_dynapi *apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo);
-void HalUtlHandleAppFwCallErrorInRequest(afb_request *request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend);
+enum CallError HalUtlHandleAppFwCallError(AFB_ApiT apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo);
+void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend);
#endif /* _HAL_UTILITIES_APPFW_RESP_HANDLER_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
index 62bdb8f..48e6f9e 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
@@ -187,7 +187,7 @@ struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGl
* Hal Manager data handling functions *
******************************************************************************/
-uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info)
+uint8_t HalUtlInitializeHalMgrData(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info)
{
if(! apiHandle || ! HalMgrGlobalData || ! apiName || ! info)
return -1;
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
index 34ca3e8..053be6f 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
@@ -22,8 +22,7 @@
#include <wrap-json.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
#include <ctl-config.h>
@@ -54,7 +53,7 @@ struct CtlHalSpecificData {
struct CtlHalStreamsDataT ctlHalStreamsData;
// TODO JAI : add structure to hold halmap section data
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
CtlConfigT *ctrlConfig;
};
@@ -84,7 +83,7 @@ struct HalMgrData {
struct SpecificHalData usedCardId[ALSA_MAX_CARD];
- afb_dynapi *apiHandle;
+ AFB_ApiT apiHandle;
struct SpecificHalData *first;
};
@@ -97,7 +96,7 @@ uint64_t HalUtlGetNumberOfHalInList(struct HalMgrData *HalMgrGlobalData);
struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *apiName);
// Exported verbs for 'struct HalMgrData' handling
-uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info);
+uint8_t HalUtlInitializeHalMgrData(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info);
void HalUtlRemoveHalMgrData(struct HalMgrData *HalMgrGlobalData);
#endif /* _HAL_UTILITIES_DATA_INCLUDE_ */ \ No newline at end of file
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 5d10f4f..6212c05 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
@@ -28,7 +28,7 @@
* TODO JAI : Use API-V3 instead of API-PRE-V3 *
******************************************************************************/
-int HalUtlLoadVerbs(afb_dynapi *apiHandle, struct HalUtlApiVerb *verbs)
+int HalUtlLoadVerbs(AFB_ApiT apiHandle, struct HalUtlApiVerb *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 3bad080..113a0b0 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
@@ -20,19 +20,18 @@
#include <stdio.h>
-#define AFB_BINDING_VERSION dyn
-#include <afb/afb-binding.h>
+#include <afb-definitions.h>
// 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_request *req); /* callback function implementing the verb */
+ 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_dynapi *apiHandle, struct HalUtlApiVerb *verbs);
+int HalUtlLoadVerbs(AFB_ApiT apiHandle, struct HalUtlApiVerb *verbs);
#endif /* _HAL_UTILITIES_VERBS_LOADER_INCLUDE_ */ \ No newline at end of file