diff options
Diffstat (limited to 'src/4a-hal-manager/4a-hal-manager-cb.c')
-rw-r--r-- | src/4a-hal-manager/4a-hal-manager-cb.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/4a-hal-manager/4a-hal-manager-cb.c b/src/4a-hal-manager/4a-hal-manager-cb.c index 843066b..a726d05 100644 --- a/src/4a-hal-manager/4a-hal-manager-cb.c +++ b/src/4a-hal-manager/4a-hal-manager-cb.c @@ -87,8 +87,7 @@ void HalMgrLoaded(afb_req_t request) return; } - currentHalData = halMgrData->halDataList; - if(! currentHalData) { + if(cds_list_empty(&halMgrData->halDataListHead)) { afb_req_success(request, NULL, "No Hal Api loaded"); return; } @@ -107,7 +106,7 @@ void HalMgrLoaded(afb_req_t request) else requestJsonErr = wrap_json_unpack(requestJson, "{s?:b s?:b}", "all", &allHal, "verbose", &verbose); - while(currentHalData) { + cds_list_for_each_entry(currentHalData, &halMgrData->halDataListHead, node) { if(allHal || currentHalData->status == HAL_STATUS_READY) { // Case if request key is 'verbose' and value is bigger than 0 if(! requestJsonErr && verbose) { @@ -151,8 +150,6 @@ void HalMgrLoaded(afb_req_t request) json_object_array_add(requestAnswer, apiRequestedInfoJ); } - - currentHalData = currentHalData->next; } afb_req_success(request, requestAnswer, "Requested data"); @@ -206,7 +203,7 @@ void HalMgrLoad(afb_req_t request) return; } - addedHal = HalUtlAddHalToHalList(&halMgrData->halDataList); + addedHal = HalUtlAddHalToHalList(&halMgrData->halDataListHead); addedHal->internal = 0; // TBD JAI : initialize external to unavailable once event from external hal will be handled @@ -217,7 +214,7 @@ void HalMgrLoad(afb_req_t request) afb_req_fail(request, "apiname_string_allocation", "Didn't succeed to store (allocate) 'apiName' string"); - HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, addedHal); + HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, addedHal); return; } @@ -226,7 +223,7 @@ void HalMgrLoad(afb_req_t request) afb_req_fail(request, "sndcardpath_string_allocation", "Didn't succeed to store (allocate) 'sndCardPath' string"); - HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, addedHal); + HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, addedHal); return; } @@ -236,7 +233,7 @@ void HalMgrLoad(afb_req_t request) afb_req_fail(request, "info_string_allocation", "Didn't succeed to store (allocate) 'info' string"); - HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, addedHal); + HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, addedHal); return; } } @@ -247,7 +244,7 @@ void HalMgrLoad(afb_req_t request) afb_req_fail(request, "author_string_allocation", "Didn't succeed to store (allocate) 'author' string"); - HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, addedHal); + HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, addedHal); return; } } @@ -258,7 +255,7 @@ void HalMgrLoad(afb_req_t request) afb_req_fail(request, "version_string_allocation", "Didn't succeed to store (allocate) 'version' string"); - HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, addedHal); + HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, addedHal); return; } } @@ -269,7 +266,7 @@ void HalMgrLoad(afb_req_t request) afb_req_fail(request, "date_string_allocation", "Didn't succeed to store (allocate) 'date' string"); - HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, addedHal); + HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, addedHal); return; } } @@ -314,7 +311,7 @@ void HalMgrUnload(afb_req_t request) return; } - halToRemove = HalUtlSearchHalDataByApiName(&halMgrData->halDataList, apiName); + halToRemove = HalUtlSearchHalDataByApiName(&halMgrData->halDataListHead, apiName); if(! halToRemove) { afb_req_fail(request, "requested_api", "Can't find api to remove"); return; @@ -325,7 +322,7 @@ void HalMgrUnload(afb_req_t request) return; } - if(HalUtlRemoveSelectedHalFromList(&halMgrData->halDataList, halToRemove)) { + if(HalUtlRemoveSelectedHalFromList(&halMgrData->halDataListHead, halToRemove)) { afb_req_fail(request, "unregister_error", "Didn't succeed to remove specified api"); return; } |