aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-31 16:39:56 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:51:00 +0200
commit509c14ede44b5d95f5ecc7d1e78a2c54609688e4 (patch)
tree302fb6ffdedd3b0e879fbf63ab3f87eafc42cde1 /4a-hal
parentc461cb867a97a6d49945210f2050ea3d9ec44ab3 (diff)
Store uid of the hal mixer configuration and use it
Stores uid of the hal mixer configuration in the specific controller hal structure. Use this uid as prefix when calling softmixer api. Change-Id: Iab00518e02e0f9ff6dbd78c126eda45225c55256 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c25
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h3
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.h1
3 files changed, 18 insertions, 11 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 317f0b3..30f89ba 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -64,9 +64,12 @@ int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_obje
if(wrap_json_unpack(MixerJ, "{s:s}", "mixerapi", &currentHalData->ctlHalSpecificData->mixerApiName))
return -5;
- if(! json_object_object_get_ex(MixerJ, "streams", &streamsArray))
+ if(wrap_json_unpack(MixerJ, "{s:s}", "uid", &currentHalData->ctlHalSpecificData->halSoftMixerVerb))
return -6;
+ if(! json_object_object_get_ex(MixerJ, "streams", &streamsArray))
+ return -7;
+
switch(json_object_get_type(streamsArray)) {
case json_type_object:
streamCount = 1;
@@ -75,7 +78,7 @@ int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_obje
streamCount = json_object_array_length(streamsArray);
break;
default:
- return -7;
+ return -8;
}
currentHalData->ctlHalSpecificData->ctlHalStreamsData.count = streamCount;
@@ -93,7 +96,7 @@ int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_obje
currentStream = streamsArray;
if(wrap_json_unpack(currentStream, "{s:s}", "uid", &currentStreamName))
- return -9-idx;
+ return -10-idx;
currentHalData->ctlHalSpecificData->ctlHalStreamsData.data[idx].name = strdup(currentStreamName);
currentHalData->ctlHalSpecificData->ctlHalStreamsData.data[idx].cardId = NULL;
@@ -104,7 +107,7 @@ int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_obje
}
if(HalUtlLoadVerbs(apiHandle, CtlHalDynApiStreamVerbs))
- return -8;
+ return -9;
}
return 0;
@@ -126,7 +129,7 @@ void HalCtlsActionOnStream(afb_request *request)
{
int verbToCallSize;
- char *apiToCall, *verbToCall;
+ char *apiToCall, *halSoftMixerVerb, *verbToCall;
afb_dynapi *apiHandle;
CtlConfigT *ctrlConfig;
@@ -165,15 +168,21 @@ void HalCtlsActionOnStream(afb_request *request)
return;
}
+ halSoftMixerVerb = currentCtlHalData->ctlHalSpecificData->halSoftMixerVerb;
+ if(! halSoftMixerVerb) {
+ afb_request_fail(request, "hal_softmixer_verb", "Can't get hal mixer verb prefix");
+ return;
+ }
+
// TODO JAI: check status of hal before doing anything
- // TODO JAI : remove action prefix, streams should be created as verb by mixer
- verbToCallSize = (int) strlen(API_STREAM_PREFIX) + (int) strlen(request->verb) + 2;
+ // TODO JAI : remove verb to call prefix, each hal should have its own api in softmixer, and each streams should be created as verb by mixer
+ verbToCallSize = (int) strlen(halSoftMixerVerb) + (int) strlen(request->verb) + 2;
verbToCall = (char *) alloca(verbToCallSize * sizeof(char));
verbToCall[0] = '\0';
verbToCall[verbToCallSize - 1] = '\0';
- strcat(verbToCall, API_STREAM_PREFIX);
+ strcat(verbToCall, halSoftMixerVerb);
strcat(verbToCall, "/");
strcat(verbToCall, request->verb);
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
index 8238c37..e6c7dfd 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.h
@@ -25,9 +25,6 @@
#include <ctl-config.h>
-// TODO JAI: remove this define
-#define API_STREAM_PREFIX "simple_mixer"
-
// HAL controllers sections parsing functions
int HalCtlsHalMixerConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object *MixerJ);
int HalCtlsHalMapConfig(afb_dynapi *apiHandle, CtlSectionT *section, json_object *StreamControlsJ);
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
index f9b9b36..1d15785 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.h
@@ -45,6 +45,7 @@ struct CtlHalStreamsDataT {
struct CtlHalSpecificData {
char *mixerApiName;
+ char *halSoftMixerVerb;
json_object *halMixerJ;
struct CtlHalStreamsDataT ctlHalStreamsData;