aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-06 15:08:36 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-06 15:28:38 +0200
commitb6191f84c7dd39e298607ac81be94eb4ee4bc26e (patch)
tree6ce624636711f9c8f4fa530ee75d758c6a271ff6
parent66623af9225cb98e2c2491ad8608eb814513ae10 (diff)
Send 'hal-dependencies' info with mixer attach
Send available 'hal-dependencies' compact json info with mixer attach call to allow mixer to use 'hal-dependencies' for audio cards detection/resolution. BUG-AGL: SPEC-2329 Change-Id: I0e64a45bc9296e1aa1310f6c01b1ebbce8524dcd Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
-rw-r--r--src/4a-internals-hal/4a-internals-hal-mixer-link.c21
1 files changed, 16 insertions, 5 deletions
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 d5b9be9..985de96 100644
--- a/src/4a-internals-hal/4a-internals-hal-mixer-link.c
+++ b/src/4a-internals-hal/4a-internals-hal-mixer-link.c
@@ -162,7 +162,7 @@ int InternalHalAttachToMixer(afb_api_t apiHandle)
struct HalData *currentHalData;
- json_object *responseJ = NULL;
+ json_object *requestJ, *dependencyJ, *responseJ = NULL;
if(! apiHandle) {
AFB_API_ERROR(apiHandle, "Can't get current internal hal api handle");
@@ -200,10 +200,21 @@ int InternalHalAttachToMixer(afb_api_t apiHandle)
return -5;
}
+ dependencyJ = HalUtlGetJsonArrayForAvailableDependencies(apiHandle,
+ &currentHalData->internalHalData->probedDevicesList,
+ DEPENDENCY_COMPACT_JSON);
+ if(! dependencyJ) {
+ AFB_API_ERROR(apiHandle, "Didn't succeed to generate available dependencies compact json array");
+ return -6;
+ }
+
+ requestJ = wrap_json_clone(currentHalData->internalHalData->halMixerJ);
+ json_object_object_add(requestJ, "hal-dependencies", dependencyJ);
+
if(afb_api_call_sync(apiHandle,
apiToCall,
MIXER_ATTACH_VERB,
- json_object_get(currentHalData->internalHalData->halMixerJ),
+ requestJ,
&responseJ,
&returnedError,
&returnedInfo)) {
@@ -213,14 +224,14 @@ int InternalHalAttachToMixer(afb_api_t apiHandle)
apiToCall,
returnedError ? returnedError : "not returned",
returnedInfo ? returnedInfo : "not returned");
- err = -6;
+ err = -7;
}
else if(! responseJ) {
AFB_API_ERROR(apiHandle,
"Seems that %s call to api %s succeed but no response was returned",
MIXER_ATTACH_VERB,
apiToCall);
- err = -7;
+ err = -8;
}
else {
mixerError = InternalHalHandleMixerAttachResponse(apiHandle, currentHalData->internalHalData, responseJ);
@@ -231,7 +242,7 @@ int InternalHalAttachToMixer(afb_api_t apiHandle)
apiToCall,
mixerError,
json_object_get_string(responseJ));
- err = -8;
+ err = -9;
}
else {
AFB_API_NOTICE(apiHandle,