aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c4
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c23
2 files changed, 27 insertions, 0 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 0f63be7..0691cb5 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
@@ -106,6 +106,10 @@ static int HalCtlsInitOneApi(AFB_ApiT apiHandle)
currentCtlHalData->sndCardId = HalCtlsGetCardIdByCardPath(apiHandle, currentCtlHalData->sndCardPath);
+ currentCtlHalData->ctlHalSpecificData->streamUpdates = AFB_EventMake(apiHandle, HAL_STREAM_UPDATES_EVENT_NAME);
+ if(! AFB_EventIsValid(currentCtlHalData->ctlHalSpecificData->streamUpdates))
+ return -4;
+
if(currentCtlHalData->sndCardId < 0)
currentCtlHalData->status = HAL_STATUS_UNAVAILABLE;
else
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 ec00056..f44ea6f 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -630,6 +630,7 @@ void HalCtlsSubscribeUnsubscribe(AFB_ReqT request, enum SubscribeUnsubscribeType
requestJson = AFB_ReqJson(request);
if(! requestJson) {
AFB_ReqFail(request, "request_json", "Can't get request json");
+ return;
}
if(wrap_json_unpack(requestJson, "{s:o}", "events", &requestedSubscriptionsJ)) {
@@ -665,6 +666,28 @@ void HalCtlsSubscribeUnsubscribe(AFB_ReqT request, enum SubscribeUnsubscribeType
subscriptionFound = 0;
currentSubscriptionString = (char *) json_object_get_string(requestedSubscriptionJ);
+ if(! strcasecmp(currentSubscriptionString, HAL_STREAM_UPDATES_EVENT_NAME)) {
+ if(currentCtlHalData->ctlHalSpecificData->streamUpdates &&
+ subscribeUnsubscribeType == SUBSCRIPTION &&
+ afb_req_subscribe(request, currentCtlHalData->ctlHalSpecificData->streamUpdates)) {
+ AFB_ReqFailF(request,
+ "request_stream_list_updates_event",
+ "Error while trying to subscribe to stream list updates event");
+ return;
+ }
+ else if(currentCtlHalData->ctlHalSpecificData->streamUpdates &&
+ subscribeUnsubscribeType == UNSUBSCRIPTION &&
+ afb_req_unsubscribe(request, currentCtlHalData->ctlHalSpecificData->streamUpdates)) {
+ AFB_ReqFailF(request,
+ "request_stream_list_updates_event",
+ "Error while trying to unsubscribe to stream list updates event");
+ return;
+ }
+
+ subscriptionFound = 1;
+ subscriptionDoneNb++;
+ }
+
currentStreamData = currentCtlHalData->ctlHalSpecificData->ctlHalStreamsData;
while(currentStreamData &&
(! subscriptionFound)) {