diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-23 10:21:06 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-11-02 16:12:26 +0100 |
commit | be188c31f2528cdabfffd07ef1ec87ff6c23330a (patch) | |
tree | 9a9dded7fd8348ff2abb71ed046963a1f9a811b7 | |
parent | cabdc828ee3eb35d780f2145fdb37081a5f6d71d (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>
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c | 6 | ||||
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c | 14 | ||||
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.h | 2 | ||||
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c | 20 | ||||
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h | 2 | ||||
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c | 47 | ||||
-rw-r--r-- | 4a-hal/4a-hal-manager/4a-hal-manager-cb.c | 12 | ||||
-rw-r--r-- | 4a-hal/4a-hal-manager/4a-hal-manager.c | 21 | ||||
-rw-r--r-- | 4a-hal/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c | 2 | ||||
-rw-r--r-- | 4a-hal/4a-hal-utilities/4a-hal-utilities-verbs-loader.c | 15 | ||||
-rw-r--r-- | conf.d/cmake/config.cmake | 2 | ||||
-rw-r--r-- | plugins/lib/bluetooth/hal-bt-cb.c | 14 | ||||
-rw-r--r-- | plugins/lib/bluetooth/hal-bt.c | 77 |
13 files changed, 121 insertions, 113 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; diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index 52ab7bb..e49774a 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -133,7 +133,7 @@ add_definitions(-DCTL_PLUGIN_MAGIC=7053042648) add_definitions(-DCONTROL_CONFIG_PATH="${CMAKE_SOURCE_DIR}/conf.d/project/etc:${CMAKE_BINARY_DIR}/package/etc:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/etc") add_definitions(-DCONTROL_PLUGIN_PATH="${CMAKE_BINARY_DIR}/package/lib/plugins:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/lib/plugins") add_definitions(-DCONTROL_LUA_PATH="${CMAKE_SOURCE_DIR}/conf.d/project/lua.d:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/var") -add_definitions(-DAFB_BINDING_VERSION=3 -DAFB_BINDING_WANT_DYNAPI=1) +add_definitions(-DAFB_BINDING_VERSION=3) # (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable] # --------------------------------------------------------------------- diff --git a/plugins/lib/bluetooth/hal-bt-cb.c b/plugins/lib/bluetooth/hal-bt-cb.c index 6ac9193..0638d50 100644 --- a/plugins/lib/bluetooth/hal-bt-cb.c +++ b/plugins/lib/bluetooth/hal-bt-cb.c @@ -36,7 +36,7 @@ void HalBtGetStreamingStatus(AFB_ReqT request) { struct HalBtPluginData *localHalBtPluginData; - if(! (localHalBtPluginData = (struct HalBtPluginData *) afb_request_get_vcbdata(request))) { + if(! (localHalBtPluginData = (struct HalBtPluginData *) AFB_ReqVCBData(request))) { AFB_ReqFail(request, "bt_plugin_data", "Can't get bluetooth plugin data"); return; } @@ -54,7 +54,7 @@ void HalBtSetStreamingStatus(AFB_ReqT request) AFB_ApiT apiHandle; - if(! (localHalBtPluginData = (struct HalBtPluginData *) afb_request_get_vcbdata(request))) { + if(! (localHalBtPluginData = (struct HalBtPluginData *) AFB_ReqVCBData(request))) { AFB_ReqFail(request, "bt_plugin_data", "Can't get bluetooth plugin data"); return; } @@ -64,7 +64,7 @@ void HalBtSetStreamingStatus(AFB_ReqT request) return; } - if(! (apiHandle = (AFB_ApiT ) afb_request_get_dynapi(request))) { + if(! (apiHandle = (AFB_ApiT ) AFB_ReqGetApi(request))) { AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle"); return; } @@ -99,7 +99,7 @@ void HalBtGetA2DPBluetoothDevices(AFB_ReqT request) json_object *requestAnswer, *currentBtDeviceObjectJ; - if(! (localHalBtPluginData = (struct HalBtPluginData *) afb_request_get_vcbdata(request))) { + if(! (localHalBtPluginData = (struct HalBtPluginData *) AFB_ReqVCBData(request))) { AFB_ReqFail(request, "bt_plugin_data", "Can't get bluetooth plugin data"); return; } @@ -135,7 +135,7 @@ void HalBtGetSelectedA2DPBluetoothDevice(AFB_ReqT request) json_object *selectedBtDeviceObject; - if(! (localHalBtPluginData = (struct HalBtPluginData *) afb_request_get_vcbdata(request))) { + if(! (localHalBtPluginData = (struct HalBtPluginData *) AFB_ReqVCBData(request))) { AFB_ReqFail(request, "bt_plugin_data", "Can't get bluetooth plugin data"); return; } @@ -165,7 +165,7 @@ void HalBtSetSelectedA2DPBluetoothDevice(AFB_ReqT request) AFB_ApiT apiHandle; - if(! (localHalBtPluginData = (struct HalBtPluginData *) afb_request_get_vcbdata(request))) { + if(! (localHalBtPluginData = (struct HalBtPluginData *) AFB_ReqVCBData(request))) { AFB_ReqFail(request, "bt_plugin_data", "Can't get bluetooth plugin data"); return; } @@ -175,7 +175,7 @@ void HalBtSetSelectedA2DPBluetoothDevice(AFB_ReqT request) return; } - if(! (apiHandle = (AFB_ApiT ) afb_request_get_dynapi(request))) { + if(! (apiHandle = (AFB_ApiT ) AFB_ReqGetApi(request))) { AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle"); return; } diff --git a/plugins/lib/bluetooth/hal-bt.c b/plugins/lib/bluetooth/hal-bt.c index a4791e1..3f38012 100644 --- a/plugins/lib/bluetooth/hal-bt.c +++ b/plugins/lib/bluetooth/hal-bt.c @@ -64,7 +64,7 @@ CTLP_INIT(plugin, callbacks) return 0; } - if(! (ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(plugin->api))) { + if(! (ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(plugin->api))) { AFB_ApiError(plugin->api, "Can't get current hal controller config"); return -1; } @@ -232,57 +232,62 @@ CTLP_CAPI(init, source, argsJ, queryJ) AFB_ApiInfo(source->api, "Controller onload initialization of %s plugin", HAL_BT_PLUGIN_NAME); // Loading hal BT plugin specific verbs - if(afb_dynapi_add_verb(source->api, - HAL_BT_GET_STREAMING_STATUS_VERB, - "Get Bluetooth streaming status", - HalBtGetStreamingStatus, - (void *) &localHalBtPluginData, - NULL, - 0)) { + if(AFB_ApiAddVerb(source->api, + HAL_BT_GET_STREAMING_STATUS_VERB, + "Get Bluetooth streaming status", + HalBtGetStreamingStatus, + (void *) &localHalBtPluginData, + NULL, + 0, + 0)) { AFB_ApiError(source->api, "Error while creating verb for bluetooth plugin : '%s'", HAL_BT_GET_STREAMING_STATUS_VERB); return -1; } - if(afb_dynapi_add_verb(source->api, - HAL_BT_SET_STREAMING_STATUS_VERB, - "Set Bluetooth streaming status", - HalBtSetStreamingStatus, - (void *) &localHalBtPluginData, - NULL, - 0)) { + if(AFB_ApiAddVerb(source->api, + HAL_BT_SET_STREAMING_STATUS_VERB, + "Set Bluetooth streaming status", + HalBtSetStreamingStatus, + (void *) &localHalBtPluginData, + NULL, + 0, + 0)) { AFB_ApiError(source->api, "Error while creating verb for bluetooth plugin : '%s'", HAL_BT_SET_STREAMING_STATUS_VERB); return -2; } - if(afb_dynapi_add_verb(source->api, - HAL_BT_GET_CONNECTED_A2DP_DEVICES_VERB, - "Get connected Bluetooth A2DP devices list", - HalBtGetA2DPBluetoothDevices, - (void *) &localHalBtPluginData, - NULL, - 0)) { + if(AFB_ApiAddVerb(source->api, + HAL_BT_GET_CONNECTED_A2DP_DEVICES_VERB, + "Get connected Bluetooth A2DP devices list", + HalBtGetA2DPBluetoothDevices, + (void *) &localHalBtPluginData, + NULL, + 0, + 0)) { AFB_ApiError(source->api, "Error while creating verb for bluetooth plugin : '%s'", HAL_BT_GET_CONNECTED_A2DP_DEVICES_VERB); return -3; } - if(afb_dynapi_add_verb(source->api, - HAL_BT_GET_SELECTED_A2DP_DEVICE_VERB, - "Get selected Bluetooth A2DP device", - HalBtGetSelectedA2DPBluetoothDevice, - (void *) &localHalBtPluginData, - NULL, - 0)) { + if(AFB_ApiAddVerb(source->api, + HAL_BT_GET_SELECTED_A2DP_DEVICE_VERB, + "Get selected Bluetooth A2DP device", + HalBtGetSelectedA2DPBluetoothDevice, + (void *) &localHalBtPluginData, + NULL, + 0, + 0)) { AFB_ApiError(source->api, "Error while creating verb for bluetooth plugin : '%s'", HAL_BT_GET_SELECTED_A2DP_DEVICE_VERB); return -4; } - if(afb_dynapi_add_verb(source->api, - HAL_BT_SET_SELECTED_A2DP_DEVICE_VERB, - "Set selected Bluetooth A2DP device", - HalBtSetSelectedA2DPBluetoothDevice, - (void *) &localHalBtPluginData, - NULL, - 0)) { + if(AFB_ApiAddVerb(source->api, + HAL_BT_SET_SELECTED_A2DP_DEVICE_VERB, + "Set selected Bluetooth A2DP device", + HalBtSetSelectedA2DPBluetoothDevice, + (void *) &localHalBtPluginData, + NULL, + 0, + 0)) { AFB_ApiError(source->api, "Error while creating verb for bluetooth plugin : '%s'", HAL_BT_SET_SELECTED_A2DP_DEVICE_VERB); return -5; } |