summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-manager/4a-hal-manager.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.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.c')
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index 017199f..4d2fbf1 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -25,7 +25,7 @@
#include "4a-hal-utilities-data.h"
#include "4a-hal-utilities-verbs-loader.h"
-#include "../4a-hal-controllers/4a-hal-controllers-api-loader.h"
+#include "../4a-internals-hal/4a-internals-hal-api-loader.h"
#include "4a-hal-manager.h"
#include "4a-hal-manager-cb.h"
@@ -54,11 +54,11 @@ afb_verb_t HalManagerApiStaticVerbs[] =
};
/*******************************************************************************
- * HAL Manager get 'SpecificHalData' linked list *
+ * HAL Manager get 'HalData' linked list *
from HAL list function *
******************************************************************************/
-struct SpecificHalData **HalMngGetHalDataList(void)
+struct HalData **HalMngGetHalDataList(void)
{
return &localHalMgrGlobalData.halDataList;
}
@@ -69,8 +69,8 @@ struct SpecificHalData **HalMngGetHalDataList(void)
static int HalMgrInitApi(afb_api_t apiHandle)
{
- struct SpecificHalData *currentCtlHalData;
- struct HalMgrData *HalMgrGlobalData;
+ struct HalData *currentHalData;
+ struct HalMgrData *halMgrData;
if(! apiHandle)
return -1;
@@ -79,21 +79,22 @@ static int HalMgrInitApi(afb_api_t apiHandle)
AFB_default = apiHandle;
// Retrieve section config from api handle
- if(! (HalMgrGlobalData = (struct HalMgrData *) afb_api_get_userdata(apiHandle)))
+ halMgrData = (struct HalMgrData *) afb_api_get_userdata(apiHandle);
+ if(! halMgrData)
return -2;
- if(HalUtlInitializeHalMgrData(apiHandle, HalMgrGlobalData, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO))
+ if(HalUtlInitializeHalMgrData(apiHandle, halMgrData, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO))
return -3;
- currentCtlHalData = HalMgrGlobalData->halDataList;
+ currentHalData = halMgrData->halDataList;
- while(currentCtlHalData) {
- if(! currentCtlHalData->apiName)
+ while(currentHalData) {
+ if(! currentHalData->apiName)
return -4;
- else if(afb_api_require_api(apiHandle, currentCtlHalData->apiName, 1))
+ else if(afb_api_require_api(apiHandle, currentHalData->apiName, 1))
return -5;
- currentCtlHalData = currentCtlHalData->next;
+ currentHalData = currentHalData->next;
}
return 0;
@@ -101,15 +102,15 @@ static int HalMgrInitApi(afb_api_t apiHandle)
static int HalMgrLoadApi(void *cbdata, afb_api_t apiHandle)
{
- struct HalMgrData *HalMgrGlobalData;
+ struct HalMgrData *halMgrData;
if(! cbdata || ! apiHandle)
return -1;
- HalMgrGlobalData = (struct HalMgrData *) cbdata;
+ halMgrData = (struct HalMgrData *) cbdata;
// Save closure as api's data context
- afb_api_set_userdata(apiHandle, HalMgrGlobalData);
+ afb_api_set_userdata(apiHandle, halMgrData);
// Add static controls verbs
if(HalUtlLoadVerbs(apiHandle, HalManagerApiStaticVerbs)) {
@@ -128,13 +129,13 @@ static int HalMgrLoadApi(void *cbdata, afb_api_t apiHandle)
return 0;
}
-int HalMgrCreateApi(afb_api_t apiHandle, struct HalMgrData *HalMgrGlobalData)
+int HalMgrCreateApi(afb_api_t apiHandle, struct HalMgrData *halMgrData)
{
- if(! apiHandle || ! HalMgrGlobalData)
+ if(! apiHandle || ! halMgrData)
return -1;
// Create one API
- return afb_api_new_api(apiHandle, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO, 1, HalMgrLoadApi, HalMgrGlobalData) ? 0 : -1;
+ return afb_api_new_api(apiHandle, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO, 1, HalMgrLoadApi, halMgrData) ? 0 : -1;
}
/*******************************************************************************
@@ -158,8 +159,8 @@ int afbBindingEntry(afb_api_t apiHandle)
if(rc < 0)
status--;
- // Load Hal-Ctls using Api v3
- rc = HalCtlsCreateAllApi(apiHandle, &localHalMgrGlobalData);
+ // Load internals Hal using Api v3
+ rc = InternalHalCreateAllApi(apiHandle, &localHalMgrGlobalData);
if(rc < 0)
status -= rc;