aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers
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-controllers
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-controllers')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c6
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c14
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h2
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c20
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h2
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c47
6 files changed, 47 insertions, 44 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 e08958c..9205aaa 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
@@ -427,13 +427,13 @@ void HalCtlsActionOnAlsaCtl(AFB_ReqT request)
json_object *requestJson, *valueJ, *convertedJ;
- apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) AFB_ReqGetApi(request);
if(! apiHandle) {
AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle");
return;
}
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig) {
AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
return;
@@ -450,7 +450,7 @@ void HalCtlsActionOnAlsaCtl(AFB_ReqT request)
return;
}
- currentAlsaCtl = (struct CtlHalAlsaMap *) afb_request_get_vcbdata(request);
+ currentAlsaCtl = (struct CtlHalAlsaMap *) AFB_ReqVCBData(request);
if(! currentAlsaCtl) {
AFB_ReqFail(request, "alsa_control_data", "Can't get current alsa control data");
return;
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 d2ae7d4..7baa22c 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
@@ -58,7 +58,7 @@ static CtlSectionT ctrlSections[] =
******************************************************************************/
// Every HAL export the same API & Interface Mapping from SndCard to AudioLogic is done through alsaHalSndCardT
-static AFB_ApiVerbs CtlHalDynApiStaticVerbs[] =
+static AFB_ApiVerbs CtlHalApiStaticVerbs[] =
{
/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
{ .verb = "info", .callback = HalCtlsInfo, .info = "List available streams/playbacks/captures... for this api" },
@@ -82,7 +82,7 @@ static int HalCtlsInitOneApi(AFB_ApiT apiHandle)
AFB_default = apiHandle;
// Retrieve section config from api handle
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig)
return -2;
@@ -128,10 +128,10 @@ static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle)
ctrlConfig = (CtlConfigT*) cbdata;
// Save closure as api's data context
- afb_dynapi_set_userdata(apiHandle, ctrlConfig);
+ AFB_ApiSetUserData(apiHandle, ctrlConfig);
// Add static controls verbs
- if(HalUtlLoadVerbs(apiHandle, CtlHalDynApiStaticVerbs)) {
+ if(HalUtlLoadVerbs(apiHandle, CtlHalApiStaticVerbs)) {
AFB_ApiError(apiHandle, "Load Section : fail to register static V2 verbs");
return 1;
}
@@ -141,10 +141,10 @@ static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle)
return err;
// Declare an event manager for this Api
- afb_dynapi_on_event(apiHandle, HalCtlsDispatchApiEvent);
+ AFB_ApiOnEvent(apiHandle, HalCtlsDispatchApiEvent);
// Init Api function (does not receive user closure ???)
- afb_dynapi_on_init(apiHandle, HalCtlsInitOneApi);
+ AFB_ApiOnInit(apiHandle, HalCtlsInitOneApi);
return 0;
}
@@ -183,7 +183,7 @@ int HalCtlsCreateApi(AFB_ApiT apiHandle, char *path, struct HalMgrData *HalMgrGl
currentCtlHalData->ctlHalSpecificData = calloc(1, sizeof(struct CtlHalSpecificData));
// Create one API (Pre-V3 return code ToBeChanged)
- if(afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, HalCtlsLoadOneApi, ctrlConfig))
+ if(! AFB_NewApi(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, HalCtlsLoadOneApi, ctrlConfig))
return -5;
return 0;
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 99b304e..70e61cd 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
@@ -28,4 +28,4 @@
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
+#endif /* _HAL_CTLS_API_LOADER_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 22783d5..9f074df 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 controller event handler function *
******************************************************************************/
-void HalCtlsDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_object *eventJ)
+void HalCtlsDispatchApiEvent(AFB_ApiT apiHandle, const char *evtLabel, json_object *eventJ)
{
int numid, idx = 0, cardidx;
@@ -48,7 +48,7 @@ void HalCtlsDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_o
AFB_ApiDebug(apiHandle, "Evtname=%s [msg=%s]", evtLabel, json_object_get_string(eventJ));
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig) {
AFB_ApiError(apiHandle, "Can't get current hal controller config");
return;
@@ -124,7 +124,7 @@ int HalCtlsHalMixerConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object
if(! apiHandle || ! section)
return -1;
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig)
return -2;
@@ -275,7 +275,7 @@ int HalCtlsHandleOneHalMapObject(AFB_ApiT apiHandle, char *cardId, struct CtlHal
}
}
- if(afb_dynapi_add_verb(apiHandle, alsaMap->uid, alsaMap->info, HalCtlsActionOnAlsaCtl, (void *) alsaMap, NULL, 0)) {
+ if(AFB_ApiAddVerb(apiHandle, alsaMap->uid, alsaMap->info, HalCtlsActionOnAlsaCtl, (void *) alsaMap, NULL, 0, 0)) {
AFB_ApiError(apiHandle,
"Didn't to create verb for current alsa control to load action using alsa object:\n-- %s",
json_object_get_string(alsaMap->actionJ));
@@ -341,7 +341,7 @@ int HalCtlsHalMapConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *A
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentHalData;
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig)
return -1;
@@ -397,19 +397,19 @@ void HalCtlsActionOnCall(AFB_ReqT request)
json_object *requestJson, *returnJ = NULL, *toReturnJ;
- apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) AFB_ReqGetApi(request);
if(! apiHandle) {
AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle");
return;
}
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig) {
AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
return;
}
- currentMixerData = (struct CtlHalMixerData *) afb_request_get_vcbdata(request);
+ currentMixerData = (struct CtlHalMixerData *) AFB_ReqVCBData(request);
if(! currentMixerData) {
AFB_ReqFail(request, "hal_call_data", "Can't get current call data");
return;
@@ -519,13 +519,13 @@ void HalCtlsInfo(AFB_ReqT request)
json_object *requestJson, *toReturnJ = NULL, *requestAnswer, *streamsArray, *playbacksArray, *capturesArray;
- apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
+ apiHandle = (AFB_ApiT) AFB_ReqGetApi(request);
if(! apiHandle) {
AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle");
return;
}
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig) {
AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
return;
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 cfb72b4..488b6f1 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
@@ -25,7 +25,7 @@
#include <ctl-config.h>
// HAL controller event handler function
-void HalCtlsDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_object *eventJ);
+void HalCtlsDispatchApiEvent(AFB_ApiT apiHandle, const char *evtLabel, json_object *eventJ);
// HAL controllers sections parsing functions
int HalCtlsHalMixerConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *MixerJ);
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
index 254c57b..2ffee91 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
@@ -94,13 +94,14 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentM
currentMixerDataT->data[idx].verb = strdup(&currentDataVerbName[verbStart]);
- if(afb_dynapi_add_verb(apiHandle,
- currentMixerDataT->data[idx].verb,
- "Stream action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) &currentMixerDataT->data[idx],
- NULL,
- 0)) {
+ if(AFB_ApiAddVerb(apiHandle,
+ currentMixerDataT->data[idx].verb,
+ "Stream action transferred to mixer",
+ HalCtlsActionOnCall,
+ (void *) &currentMixerDataT->data[idx],
+ NULL,
+ 0,
+ 0)) {
AFB_ApiError(apiHandle,
"Error while creating verbs for stream : '%s'",
currentMixerDataT->data[idx].verb);
@@ -117,26 +118,28 @@ int HalCtlsHandleMixerData(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentM
}
if(dataType == MIXER_DATA_PLAYBACKS) {
- if(afb_dynapi_add_verb(apiHandle,
- HAL_PLAYBACK_VERB,
- "Playback action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) currentMixerDataT->data,
- NULL,
- 0)) {
+ if(AFB_ApiAddVerb(apiHandle,
+ HAL_PLAYBACK_VERB,
+ "Playback action transferred to mixer",
+ HalCtlsActionOnCall,
+ (void *) currentMixerDataT->data,
+ NULL,
+ 0,
+ 0)) {
AFB_ApiError(apiHandle, "Error while creating verb for playbacks : '%s'", HAL_PLAYBACK_VERB);
err += (int) MIXER_ERROR_PLAYBACK_VERB_NOT_CREATED;
}
}
if(dataType == MIXER_DATA_CAPTURES) {
- if(afb_dynapi_add_verb(apiHandle,
- HAL_CAPTURE_VERB,
- "Capture action transferred to mixer",
- HalCtlsActionOnCall,
- (void *) currentMixerDataT->data,
- NULL,
- 0)) {
+ if(AFB_ApiAddVerb(apiHandle,
+ HAL_CAPTURE_VERB,
+ "Capture action transferred to mixer",
+ HalCtlsActionOnCall,
+ (void *) currentMixerDataT->data,
+ NULL,
+ 0,
+ 0)) {
AFB_ApiError(apiHandle, "Error while creating verb for captures : '%s'", HAL_CAPTURE_VERB);
err += (int) MIXER_ERROR_CAPTURE_VERB_NOT_CREATED;
}
@@ -193,7 +196,7 @@ int HalCtlsAttachToMixer(AFB_ApiT apiHandle)
return -1;
}
- ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle);
+ ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
if(! ctrlConfig) {
AFB_ApiError(apiHandle, "Can't get current hal controller config");
return -2;