diff options
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c')
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c index 54d06e3..22783d5 100644 --- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c +++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c @@ -116,21 +116,23 @@ void HalCtlsDispatchApiEvent(afb_dynapi *apiHandle, const char *evtLabel, json_o int HalCtlsHalMixerConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *MixerJ) { + int err = 0; + CtlConfigT *ctrlConfig; struct SpecificHalData *currentHalData; if(! apiHandle || ! section) return -1; - if(MixerJ) { - ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle); - if(! ctrlConfig) - return -2; + ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(apiHandle); + if(! ctrlConfig) + return -2; - currentHalData = (struct SpecificHalData *) ctrlConfig->external; - if(! currentHalData) - return -3; + currentHalData = (struct SpecificHalData *) ctrlConfig->external; + if(! currentHalData) + return -3; + if(MixerJ) { if(json_object_is_type(MixerJ, json_type_object)) currentHalData->ctlHalSpecificData->halMixerJ = MixerJ; else @@ -141,6 +143,11 @@ int HalCtlsHalMixerConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object wrap_json_unpack(MixerJ, "{s?:s}", "prefix", ¤tHalData->ctlHalSpecificData->prefix); } + else if(currentHalData->status == HAL_STATUS_AVAILABLE && + (err = HalCtlsAttachToMixer(apiHandle))) { + AFB_ApiError(apiHandle, "%s: Error %i while attaching to mixer", __func__, err); + return -6; + } return 0; } |