summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-04-18 12:40:25 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-05-24 12:05:52 +0200
commit68138a3ec7a78ad7304d291ff92d8e5292847c4e (patch)
tree9157134d50a749c838afdf93a49c4ce17a018347 /4a-hal/4a-hal-manager/4a-hal-manager-cb.c
parent196e723e79a1f5eae41cf4a8b1450df0679a4af8 (diff)
Clarify internals hal functions and files names
The purpose of this commit is to have of a more standard way to name files and functions used to generate/handle hal api (generated from hal json configuration file). It occurred to me that 'hal-controller' was not a good name because it is harder for people who don't know about the app-controller to understanded what is the purpose of these files/functions. It was renamed to 'internal-hal' because it's about hal that are all handle/load by hal-manager in opposition of external-hal that are independant binding/binder that can register themselves to hal-manager. BUG-AGL: SPEC-2329 Change-Id: I11b7efe64ec474b004a2a15ed8969b9db95d428f Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
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.c35
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;
}