diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-31 17:08:41 +0100 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-12-06 17:54:32 +0100 |
commit | eac596021a782efaa7e223e197bf4e4974a206ea (patch) | |
tree | e5a0376a80fd28d7e0ca488b2878a2a5e7f6a211 /4a-hal | |
parent | 57ff15a9754a98ed0ee262da6201b9aa9ca11a76 (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.c | 8 |
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 d2ae7d4..312959e 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 |