aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-29 14:00:43 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:51:00 +0200
commitfe2759e55720c0927726cb4235e3e203b245998f (patch)
treee0a2760b7033e0fe9c280ba13a9b54317ee87da3 /4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
parentc82bd2a432a8c56015e0ab377a467ff5c4c85b66 (diff)
Use a structure to store ctl hal specific data
To avoid multiple variables at NULL in specific hal data, use a structure to store all controller hal specific data. These data won't be use if the hal is external (registered). Example of controller hal specific data : - Mixer api name - Mixer initialization json - Mixer streams names and card id ... Change-Id: Ifc4823d5ea21ed408b4ecc25b870cad74d3b2173 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-utilities/4a-hal-utilities-data.c')
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.c31
1 files changed, 30 insertions, 1 deletions
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);