diff options
author | fulup <fulup.arfoll@iot.bzh> | 2018-06-06 11:47:08 +0200 |
---|---|---|
committer | fulup <fulup.arfoll@iot.bzh> | 2018-06-06 11:47:08 +0200 |
commit | 4ca3244a440b798b91c252bf22e5299df98218e7 (patch) | |
tree | 9c0d386543face266dd08f7d3463f86ed179c0bf /mixer-binding/mixer-binding.c | |
parent | 7aaf36d8e729400f7efc75d7e03e162e1f262293 (diff) |
Move smixer API create+attach into controller onload section
Diffstat (limited to 'mixer-binding/mixer-binding.c')
-rw-r--r-- | mixer-binding/mixer-binding.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/mixer-binding/mixer-binding.c b/mixer-binding/mixer-binding.c index edfb408..e8beb8b 100644 --- a/mixer-binding/mixer-binding.c +++ b/mixer-binding/mixer-binding.c @@ -30,7 +30,7 @@ PUBLIC afb_dynapi *AFB_default; static CtlSectionT ctrlSections[]= { {.key="resources" , .loadCB= PluginConfig}, {.key="onload" , .loadCB= OnloadConfig}, - {.key="controls", .loadCB= ControlConfig}, + // {.key="controls", .loadCB= ControlConfig}, {.key=NULL} }; @@ -63,16 +63,15 @@ STATIC int CtrlLoadStaticVerbs (afb_dynapi *apiHandle, AFB_ApiVerbs *verbs) { }; -STATIC int CtrlInitOneApi (AFB_ApiT apiHandle) { - - AFB_default = apiHandle; // hugely hack to make all V2 AFB_DEBUG to work in fileutils - - // retrieve section config from api handle - CtlConfigT *ctrlConfig = (CtlConfigT*) afb_dynapi_get_userdata(apiHandle); - int err = CtlConfigExec (apiHandle, ctrlConfig); - - return err; -} +//STATIC int CtrlInitOneApi (AFB_ApiT apiHandle) { +// +// AFB_default = apiHandle; // hugely hack to make all V2 AFB_DEBUG to work in fileutils +// +// // retrieve section config from api handle +// CtlConfigT *ctrlConfig = (CtlConfigT*) afb_dynapi_get_userdata(apiHandle); +// +// return 0; +//} // next generation dynamic API-V3 mode #include <signal.h> @@ -85,24 +84,26 @@ STATIC int CtrlLoadOneApi (void *cbdata, AFB_ApiT apiHandle) { afb_dynapi_set_userdata(apiHandle, ctrlConfig); // add static controls verbs - int err = CtrlLoadStaticVerbs (apiHandle, CtrlApiVerbs); - if (err) { + int error = CtrlLoadStaticVerbs (apiHandle, CtrlApiVerbs); + if (error) { AFB_ApiError(apiHandle, "CtrlLoadSection fail to Registry static V2 verbs"); goto OnErrorExit; } // load section for corresponding API - err= CtlLoadSections(apiHandle, ctrlConfig, ctrlSections); + error= CtlLoadSections(apiHandle, ctrlConfig, ctrlSections); // declare an event event manager for this API; afb_dynapi_on_event(apiHandle, CtrlDispatchApiEvent); // init API function (does not receive user closure ??? - afb_dynapi_on_init(apiHandle, CtrlInitOneApi); + //afb_dynapi_on_init(apiHandle, CtrlInitOneApi); + + //error = CtlConfigExec (apiHandle, ctrlConfig); // should not seal API as each mixer+stream create a new verb // afb_dynapi_seal(apiHandle); - return err; + return error; OnErrorExit: return 1; @@ -140,6 +141,9 @@ PUBLIC int afbBindingVdyn(afb_dynapi *apiHandle) { // create one API per config file (Pre-V3 return code ToBeChanged) int status = afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, CtrlLoadOneApi, ctrlConfig); + if (!status) + status = CtlConfigExec (apiHandle, ctrlConfig); + return status; OnErrorExit: |