summaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c2
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-cb.c6
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.c38
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.h10
4 files changed, 26 insertions, 30 deletions
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 18cf781..eb023a1 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
@@ -90,7 +90,7 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
currentCtlHalData->internal = true;
currentCtlHalData->status = HAL_STATUS_UNAVAILABLE;
- currentCtlHalData->name = (char *) ctrlConfig->api;
+ currentCtlHalData->apiName = (char *) ctrlConfig->api;
currentCtlHalData->sndCard = (char *) ctrlConfig->uid;
currentCtlHalData->info = (char *) ctrlConfig->info;
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 a2d946b..2f9fc9f 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
@@ -118,7 +118,7 @@ void HalMgrLoaded(afb_request *request)
for(cpt = 0; cpt < numberOfLoadedApi; cpt++) {
wrap_json_pack(&apiObject,
"{s:i}",
- currentHalData->name,
+ currentHalData->apiName,
(unsigned int) currentHalData->status);
json_object_array_add(requestAnswer, apiObject);
@@ -129,7 +129,7 @@ void HalMgrLoaded(afb_request *request)
for(cpt = 0; cpt < numberOfLoadedApi; cpt++) {
wrap_json_pack(&apiObject,
"{s:s s:i s:s s:i s:s s:s s:s}",
- "api", currentHalData->name,
+ "api", currentHalData->apiName,
"status", (int) currentHalData->status,
"sndcard", currentHalData->sndCard,
"internal", (int) currentHalData->internal,
@@ -143,7 +143,7 @@ void HalMgrLoaded(afb_request *request)
}
else { // Case if request option is empty or not valid
for(cpt = 0; cpt < numberOfLoadedApi; cpt++) {
- json_object_array_add(requestAnswer, json_object_new_string(currentHalData->name));
+ json_object_array_add(requestAnswer, json_object_new_string(currentHalData->apiName));
currentHalData = currentHalData->next;
}
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
index dafed90..11721f2 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
@@ -56,7 +56,7 @@ struct SpecificHalData *HalUtlAddHalApiToHalList(struct HalMgrData *HalMgrGlobal
currentApi = currentApi->next;
}
- currentApi->name = NULL;
+ currentApi->apiName = NULL;
currentApi->sndCard = NULL;
currentApi->author = NULL;
currentApi->version = NULL;
@@ -93,8 +93,8 @@ uint8_t HalUtlRemoveSelectedHalFromList(struct HalMgrData *HalMgrGlobalData, str
}
}
- if(matchingApi->name)
- free(matchingApi->name);
+ if(matchingApi->apiName)
+ free(matchingApi->apiName);
if(matchingApi->sndCard)
free(matchingApi->sndCard);
@@ -147,17 +147,17 @@ uint64_t HalUtlGetNumberOfHalInList(struct HalMgrData *HalMgrGlobalData)
return numberOfCtlHal;
}
-struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *name)
+struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *apiName)
{
struct SpecificHalData *currentApi;
- if(! HalMgrGlobalData || ! name)
+ if(! HalMgrGlobalData || ! apiName)
return NULL;
currentApi = HalMgrGlobalData->first;
while(currentApi) {
- if(! strcmp(name, currentApi->name))
+ if(! strcmp(apiName, currentApi->apiName))
return currentApi;
currentApi = currentApi->next;
@@ -170,24 +170,20 @@ struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGl
* Hal Manager data handling functions *
******************************************************************************/
-uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *name, char *description)
+uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info)
{
- if(! apiHandle || ! HalMgrGlobalData || ! name || ! description)
+ if(! apiHandle || ! HalMgrGlobalData || ! apiName || ! info)
return -1;
- // Allocate name and info strings
- HalMgrGlobalData->name = (char *) calloc(strlen(name), sizeof(char));
- if(! HalMgrGlobalData->name)
+ // Allocate and fill apiName and info strings
+ HalMgrGlobalData->apiName = strdup(apiName);
+ if(! HalMgrGlobalData->apiName)
return -2;
- HalMgrGlobalData->description = (char *) calloc(strlen(description), sizeof(char));
- if(! HalMgrGlobalData->name)
+ HalMgrGlobalData->info = strdup(info);
+ if(! HalMgrGlobalData->apiName)
return -3;
- // Fill HalMgrGlobalData structure
- strcpy(HalMgrGlobalData->name, name);
- strcpy(HalMgrGlobalData->description, description);
-
HalMgrGlobalData->apiHandle = apiHandle;
return 0;
@@ -201,11 +197,11 @@ void HalUtlRemoveHalMgrData(struct HalMgrData *HalMgrGlobalData)
if(HalMgrGlobalData->first)
HalUtlRemoveAllHalFromList(HalMgrGlobalData);
- if(HalMgrGlobalData->name)
- free(HalMgrGlobalData->name);
+ if(HalMgrGlobalData->apiName)
+ free(HalMgrGlobalData->apiName);
- if(HalMgrGlobalData->description)
- free(HalMgrGlobalData->description);
+ if(HalMgrGlobalData->info)
+ free(HalMgrGlobalData->info);
free(HalMgrGlobalData);
} \ No newline at end of file
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
index 3ae16db..ab4c8b3 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
@@ -33,7 +33,7 @@ enum HalStatus {
// Structure to store specific hal (controller or external) data
struct SpecificHalData {
- char *name;
+ char *apiName;
enum HalStatus status;
char *sndCard;
char *info;
@@ -53,8 +53,8 @@ struct SpecificHalData {
// Structure to store hal manager data
struct HalMgrData {
- char *name;
- char *description;
+ char *apiName;
+ char *info;
afb_dynapi *apiHandle;
@@ -66,10 +66,10 @@ struct SpecificHalData *HalUtlAddHalApiToHalList(struct HalMgrData *HalMgrGlobal
uint8_t HalUtlRemoveSelectedHalFromList(struct HalMgrData *HalMgrGlobalData, struct SpecificHalData *ApiToRemove);
uint64_t HalUtlRemoveAllHalFromList(struct HalMgrData *HalMgrGlobalData);
uint64_t HalUtlGetNumberOfHalInList(struct HalMgrData *HalMgrGlobalData);
-struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *name);
+struct SpecificHalData *HalUtlSearchHalDataByApiName(struct HalMgrData *HalMgrGlobalData, char *apiName);
// Exported verbs for 'struct HalMgrData' handling
-uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *name, char *description);
+uint8_t HalUtlInitializeHalMgrData(afb_dynapi *apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info);
void HalUtlRemoveHalMgrData(struct HalMgrData *HalMgrGlobalData);
#endif /* _HAL_UTILITIES_DATA_INCLUDE_ */ \ No newline at end of file