summaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-31 17:08:41 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-11-02 16:12:26 +0100
commit32b4b5c0c5e4193dc215898814b6d9ff0c1059b7 (patch)
tree97377bb1c1e1b84d5dcd43b1eaca287afeef7425 /4a-hal
parentbe188c31f2528cdabfffd07ef1ec87ff6c23330a (diff)
Force each hal to have its own ctl section data
Force each hal api to have its own controller section data, it is very usefull if different hals don't have the same onload/events/... actions. Change-Id: Iaf3c2059a774ef8ec4f7262064d1cfa8d8159d91 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c8
1 files changed, 6 insertions, 2 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 7baa22c..292bcd8 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
@@ -42,7 +42,7 @@ AFB_ApiT AFB_default;
******************************************************************************/
// Config Section definition
-static CtlSectionT ctrlSections[] =
+static CtlSectionT ctrlSectionsDefault[] =
{
{ .key = "resources", .loadCB = PluginConfig },
{ .key = "halmixer", .loadCB = HalCtlsHalMixerConfig },
@@ -121,6 +121,7 @@ static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle)
{
int err;
CtlConfigT *ctrlConfig;
+ CtlSectionT *ctrlCurrentSections;
if(! cbdata || ! apiHandle)
return -1;
@@ -136,8 +137,11 @@ static int HalCtlsLoadOneApi(void *cbdata, AFB_ApiT apiHandle)
return 1;
}
+ ctrlCurrentSections = malloc(sizeof(ctrlSectionsDefault));
+ memcpy(ctrlCurrentSections, ctrlSectionsDefault, sizeof(ctrlSectionsDefault));
+
// Load section for corresponding Api
- if((err = CtlLoadSections(apiHandle, ctrlConfig, ctrlSections)))
+ if((err = CtlLoadSections(apiHandle, ctrlConfig, ctrlCurrentSections)))
return err;
// Declare an event manager for this Api