diff options
Diffstat (limited to '4a-hal/4a-hal-manager/4a-hal-manager-cb.c')
-rw-r--r-- | 4a-hal/4a-hal-manager/4a-hal-manager-cb.c | 35 |
1 files changed, 19 insertions, 16 deletions
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 77ae52f..32fbb25 100644 --- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c +++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c @@ -62,8 +62,8 @@ void HalMgrLoaded(afb_req_t request) char cardIdString[32]; afb_api_t apiHandle; - struct HalMgrData *HalMgrGlobalData; - struct SpecificHalData *currentHalData; + struct HalMgrData *halMgrData; + struct HalData *currentHalData; json_object *requestJson, *requestAnswer, *apiObject; @@ -72,12 +72,13 @@ void HalMgrLoaded(afb_req_t request) return; } - if(! (HalMgrGlobalData = (struct HalMgrData *) afb_api_get_userdata(apiHandle))) { + halMgrData = (struct HalMgrData *) afb_api_get_userdata(apiHandle); + if(! halMgrData) { afb_req_fail(request, "hal_manager_data", "Can't get hal manager data"); return; } - currentHalData = HalMgrGlobalData->halDataList; + currentHalData = halMgrData->halDataList; if(! currentHalData) { afb_req_success(request, NULL, "No Hal Api loaded"); @@ -136,8 +137,8 @@ void HalMgrLoad(afb_req_t request) char *apiName, *sndCardPath, *info = NULL, *author = NULL, *version = NULL, *date = NULL; afb_api_t apiHandle; - struct HalMgrData *HalMgrGlobalData; - struct SpecificHalData *addedHal; + struct HalMgrData *halMgrData; + struct HalData *addedHal; json_object *requestJson, *apiReceivedMetadata; @@ -146,7 +147,8 @@ void HalMgrLoad(afb_req_t request) return; } - if(! (HalMgrGlobalData = (struct HalMgrData *) afb_api_get_userdata(apiHandle))) { + halMgrData = (struct HalMgrData *) afb_api_get_userdata(apiHandle); + if(! halMgrData) { afb_req_fail(request, "hal_manager_data", "Can't get hal manager data"); return; } @@ -174,7 +176,7 @@ void HalMgrLoad(afb_req_t request) return; } - addedHal = HalUtlAddHalApiToHalList(&HalMgrGlobalData->halDataList); + addedHal = HalUtlAddHalToHalList(&halMgrData->halDataList); addedHal->internal = 0; // TBD JAI : initialize external to unavailable once event from external hal will be handled @@ -207,8 +209,8 @@ void HalMgrUnload(afb_req_t request) char *apiName; afb_api_t apiHandle; - struct HalMgrData *HalMgrGlobalData; - struct SpecificHalData *HalToRemove; + struct HalMgrData *halMgrData; + struct HalData *halToRemove; json_object *requestJson; @@ -217,7 +219,8 @@ void HalMgrUnload(afb_req_t request) return; } - if(! (HalMgrGlobalData = (struct HalMgrData *) afb_api_get_userdata(apiHandle))) { + halMgrData = (struct HalMgrData *) afb_api_get_userdata(apiHandle); + if(! halMgrData) { afb_req_fail(request, "hal_manager_data", "Can't get hal manager data"); return; } @@ -232,18 +235,18 @@ void HalMgrUnload(afb_req_t request) return; } - HalToRemove = HalUtlSearchHalDataByApiName(&HalMgrGlobalData->halDataList, apiName); - if(! HalToRemove) { + halToRemove = HalUtlSearchHalDataByApiName(&halMgrData->halDataList, apiName); + if(! halToRemove) { afb_req_fail(request, "requested_api", "Can't find api to remove"); return; } - if(HalToRemove->internal) { - afb_req_fail(request, "requested_api", "Can't remove an internal controller api"); + if(halToRemove->internal) { + afb_req_fail(request, "requested_api", "Can't remove an internal hal"); return; } - if(HalUtlRemoveSelectedHalFromList(&HalMgrGlobalData->halDataList, HalToRemove)) { + if(HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, halToRemove)) { afb_req_fail(request, "unregister_error", "Didn't succeed to remove specified api"); return; } |