summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
diff options
context:
space:
mode:
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.c23
1 files changed, 23 insertions, 0 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 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)) {