aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c11
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.c31
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.h27
3 files changed, 61 insertions, 8 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 a20297b..bf7ccbe 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
@@ -86,7 +86,7 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
return -3;
// Fill SpecificHalDatadata structure
- currentCtlHalData->internal = true;
+ currentCtlHalData->internal = (unsigned int) true;
currentCtlHalData->status = HAL_STATUS_UNAVAILABLE;
currentCtlHalData->apiName = (char *) ctrlConfig->api;
@@ -97,8 +97,8 @@ static int HalCtlsInitOneApi(afb_dynapi *apiHandle)
currentCtlHalData->version = (char *) ctrlConfig->version;
currentCtlHalData->date = (char *) ctrlConfig->date;
- currentCtlHalData->apiHandle = apiHandle;
- currentCtlHalData->ctrlConfig = ctrlConfig;
+ currentCtlHalData->ctlHalSpecificData->apiHandle = apiHandle;
+ currentCtlHalData->ctlHalSpecificData->ctrlConfig = ctrlConfig;
// TODO JAI: Search for hw sndCard
// TODO JAI: Update alsa command of HalCtl to use alsa-softmixer/alsa-core data
@@ -160,12 +160,17 @@ int HalCtlsCreateApi(afb_dynapi *apiHandle, char *path, struct HalMgrData *HalMg
return -3;
}
+ // Allocation of current hal controller data
currentCtlHalData = HalUtlAddHalApiToHalList(HalMgrGlobalData);
if(! currentCtlHalData)
return -4;
+ // Stores current hal controller data in controller config
ctrlConfig->external = (void *) currentCtlHalData;
+ // Allocation of the structure that will be used to store specific hal controller data
+ currentCtlHalData->ctlHalSpecificData = calloc(1, sizeof(struct CtlHalSpecificData));
+
// Create one API (Pre-V3 return code ToBeChanged)
return afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, HalCtlsLoadOneApi, ctrlConfig);
}
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 811d11d..6db24b9 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
@@ -26,6 +26,30 @@
#include "4a-hal-utilities-data.h"
/*******************************************************************************
+ * Specfic Hal controller streams data handling functions *
+ ******************************************************************************/
+
+uint8_t HalUtlRemoveAllCtlHalStreamsData(struct CtlHalStreamsDataT *ctlHalStreamsData)
+{
+ unsigned int cpt;
+
+ if(! ctlHalStreamsData)
+ return -1;
+
+ if(! ctlHalStreamsData->count)
+ return -2;
+
+ for(cpt = 0; cpt < ctlHalStreamsData->count; cpt++) {
+ free(ctlHalStreamsData->data[cpt].name);
+ free(ctlHalStreamsData->data[cpt].cardId);
+ }
+
+ free(ctlHalStreamsData->data);
+
+ return 0;
+}
+
+/*******************************************************************************
* Specfic Hal data handling functions *
******************************************************************************/
@@ -94,7 +118,12 @@ uint8_t HalUtlRemoveSelectedHalFromList(struct HalMgrData *HalMgrGlobalData, str
free(matchingApi->author);
free(matchingApi->version);
free(matchingApi->date);
- };
+ }
+ else {
+ HalUtlRemoveAllCtlHalStreamsData(&matchingApi->ctlHalSpecificData->ctlHalStreamsData);
+
+ free(matchingApi->ctlHalSpecificData);
+ }
free(matchingApi);
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 ab4c8b3..9514571 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
@@ -31,22 +31,41 @@ enum HalStatus {
HAL_STATUS_AVAILABLE=1,
};
+struct CtlHalStreamData {
+ char *name;
+ char *cardId;
+};
+
+struct CtlHalStreamsDataT {
+ struct CtlHalStreamData *data;
+ unsigned int count;
+};
+
+struct CtlHalSpecificData {
+ char *mixerApiName;
+ json_object *halMixerJ;
+
+ struct CtlHalStreamsDataT ctlHalStreamsData;
+ // TODO JAI : add structure to hold halmap section data
+
+ afb_dynapi *apiHandle;
+ CtlConfigT *ctrlConfig;
+};
+
// Structure to store specific hal (controller or external) data
struct SpecificHalData {
char *apiName;
enum HalStatus status;
char *sndCard;
char *info;
- uint8_t internal;
+ unsigned int internal;
char *author;
char *version;
char *date;
-
// Can be beefed up if needed
- afb_dynapi *apiHandle; // Can be NULL if external api
- CtlConfigT *ctrlConfig; // Can be NULL if external api
+ struct CtlHalSpecificData *ctlHalSpecificData; // Can be NULL if external api
struct SpecificHalData *next;
};