diff options
Diffstat (limited to '4a-hal')
10 files changed, 72 insertions, 69 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(¤tDataVerbName[verbStart]); - if(afb_dynapi_add_verb(apiHandle, - currentMixerDataT->data[idx].verb, - "Stream action transferred to mixer", - HalCtlsActionOnCall, - (void *) ¤tMixerDataT->data[idx], - NULL, - 0)) { + if(AFB_ApiAddVerb(apiHandle, + currentMixerDataT->data[idx].verb, + "Stream action transferred to mixer", + HalCtlsActionOnCall, + (void *) ¤tMixerDataT->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; 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 1b08b82..ae86474 100644 --- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c +++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c @@ -66,13 +66,13 @@ void HalMgrLoaded(AFB_ReqT request) json_object *requestJson, *requestAnswer, *apiObject; - apiHandle = (AFB_ApiT ) afb_request_get_dynapi(request); + apiHandle = (AFB_ApiT ) AFB_ReqGetApi(request); if(! apiHandle) { AFB_ReqFail(request, "api_handle", "Can't get hal manager api handle"); return; } - HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle); + HalMgrGlobalData = (struct HalMgrData *) AFB_ApiGetUserData(apiHandle); if(! HalMgrGlobalData) { AFB_ReqFail(request, "hal_manager_data", "Can't get hal manager data"); return; @@ -143,13 +143,13 @@ void HalMgrLoad(AFB_ReqT request) json_object *requestJson, *apiReceviedMetadata; - apiHandle = (AFB_ApiT) afb_request_get_dynapi(request); + apiHandle = (AFB_ApiT) AFB_ReqGetApi(request); if(! apiHandle) { AFB_ReqFail(request, "api_handle", "Can't get hal manager api handle"); return; } - HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle); + HalMgrGlobalData = (struct HalMgrData *) AFB_ApiGetUserData(apiHandle); if(! HalMgrGlobalData) { AFB_ReqFail(request, "hal_manager_data", "Can't get hal manager data"); return; @@ -217,13 +217,13 @@ void HalMgrUnload(AFB_ReqT request) json_object *requestJson; - apiHandle = (AFB_ApiT) afb_request_get_dynapi(request); + apiHandle = (AFB_ApiT) AFB_ReqGetApi(request); if(! apiHandle) { AFB_ReqFail(request, "api_handle", "Can't get hal manager api handle"); return; } - HalMgrGlobalData = (struct HalMgrData *) afb_dynapi_get_userdata(apiHandle); + HalMgrGlobalData = (struct HalMgrData *) AFB_ApiGetUserData(apiHandle); if(! HalMgrGlobalData) { AFB_ReqFail(request, "hal_manager_data", "Can't get hal manager data"); return; 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; 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 aa3d95f..84ac1f9 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 @@ -98,7 +98,7 @@ void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char return; } - apiHandle = (AFB_ApiT) afb_request_get_dynapi(request); + apiHandle = (AFB_ApiT) AFB_ReqGetApi(request); if(! apiHandle) { AFB_ReqFailF(request, "api_handle", "Can't get hal manager api handle"); return; 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 538f389..4d9abd9 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 @@ -37,13 +37,14 @@ int HalUtlLoadVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs) return -1; for (idx = 0; verbs[idx].verb; idx++) { - errCount+= afb_dynapi_add_verb(apiHandle, - verbs[idx].verb, - NULL, - verbs[idx].callback, - (void *) &verbs[idx], - verbs[idx].auth, - 0); + errCount+= AFB_ApiAddVerb(apiHandle, + verbs[idx].verb, + NULL, + verbs[idx].callback, + (void *) &verbs[idx], + verbs[idx].auth, + 0, + 0); } return errCount; |