summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-08-05 16:55:13 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-08-12 12:23:11 +0200
commit59da9b4952b9c8852658aa27eb23992769d6b05c (patch)
tree6b2de6c401f59ede9c7c8bd212e83595b4443919
parent8c08ae193531b6f9c86f58764af598016b696260 (diff)
Create 'all_streams' verb at binding startup
Create 'all_streams' verb at binding startup, that way, it will always be created. Generate a request fail when a call is done when no streams are created. BUG-AGL: SPEC-2733 Change-Id: I1b7ec3b8ed0fcd617e4a016e455beb447d233c82 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c10
-rw-r--r--src/4a-internals-hal/4a-internals-hal-api-loader.c2
-rw-r--r--src/4a-internals-hal/4a-internals-hal-mixer-link.c15
3 files changed, 7 insertions, 20 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c b/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c
index 7b5707c..ee1432f 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c
+++ b/lib/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c
@@ -131,7 +131,7 @@ void HalUtlActionOnMixer(afb_req_t request, enum ActionOnMixerType actionType)
{
char *apiToCall;
- struct cds_list_head *streamsDataListHead = NULL;
+ struct cds_list_head *streamsDataListHead;
afb_api_t apiHandle;
CtlConfigT *ctrlConfig;
@@ -193,7 +193,7 @@ void HalUtlActionOnMixer(afb_req_t request, enum ActionOnMixerType actionType)
case ACTION_ON_MIXER_STREAM:
currentMixerData = (struct InternalHalMixerData *) afb_req_get_vcbdata(request);
if(! currentMixerData) {
- afb_req_fail(request, "hal_call_data", "Can't get stream to call data");
+ afb_req_fail(request, "stream_call_data", "Can't get stream to call data");
return;
}
@@ -222,9 +222,9 @@ void HalUtlActionOnMixer(afb_req_t request, enum ActionOnMixerType actionType)
break;
case ACTION_ON_MIXER_ALL_STREAM:
- streamsDataListHead = (struct cds_list_head *) afb_req_get_vcbdata(request);
- if(! streamsDataListHead) {
- afb_req_fail(request, "hal_call_data", "Can't get stream list data");
+ streamsDataListHead = &currentHalData->internalHalData->streamsDataListHead;
+ if(cds_list_empty(streamsDataListHead)) {
+ afb_req_fail(request, "streams_call_data", "Stream list is empty");
return;
}
diff --git a/src/4a-internals-hal/4a-internals-hal-api-loader.c b/src/4a-internals-hal/4a-internals-hal-api-loader.c
index 71779d7..8899f2c 100644
--- a/src/4a-internals-hal/4a-internals-hal-api-loader.c
+++ b/src/4a-internals-hal/4a-internals-hal-api-loader.c
@@ -28,6 +28,7 @@
#include <ctl-config.h>
#include "4a-hal-utilities-hal-api-handler.h"
+#include "4a-hal-utilities-hal-streams-handler.h"
#include "4a-internals-hal-api-loader.h"
#include "4a-internals-hal-alsacore-link.h"
@@ -62,6 +63,7 @@ static afb_verb_t InternalHalApiStaticVerbs[] =
{ .verb = "info", .callback = InternalHalInfo, .info = "List available streams/controls for this api" },
{ .verb = "subscribe", .callback = InternalHalSubscribe, .info = "Subscribe to event(s) for values changes (streams/controls) for this api" },
{ .verb = "unsubscribe", .callback = InternalHalUnsubscribe, .info = "Unsubscribe to event(s) for values changes (streams/controls) for this api" },
+ { .verb = HAL_ALL_STREAMS_VERB, .callback = HalUtlActionOnAllStream, .info = "Send a stream action on all streams" },
{ .verb = NULL } // Marker for end of the array
};
diff --git a/src/4a-internals-hal/4a-internals-hal-mixer-link.c b/src/4a-internals-hal/4a-internals-hal-mixer-link.c
index 42b64d7..96e5552 100644
--- a/src/4a-internals-hal/4a-internals-hal-mixer-link.c
+++ b/src/4a-internals-hal/4a-internals-hal-mixer-link.c
@@ -133,21 +133,6 @@ int InternalHalHandleMixerAttachResponse(afb_api_t apiHandle, struct InternalHal
}
}
- if(cds_list_empty(&currentHalSpecificData->streamsDataListHead)) {
- AFB_API_WARNING(apiHandle, "No stream detected in mixer response, %s verb won't be created", HAL_ALL_STREAMS_VERB);
- }
- else if(afb_api_add_verb(apiHandle,
- HAL_ALL_STREAMS_VERB,
- "Send a stream action on all streams",
- HalUtlActionOnAllStream,
- (void *) &currentHalSpecificData->streamsDataListHead,
- NULL,
- 0,
- 0)) {
- AFB_API_ERROR(apiHandle, "Error while creating verb for all streams : '%s'", HAL_ALL_STREAMS_VERB);
- return -4;
- }
-
return 0;
}