summaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-06-11 20:57:06 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:52:51 +0200
commit340ff2dd0eb7c5d4b3d166e0f9fa29832d718b70 (patch)
tree21467b7411f246f70e674833559dc0ce3293b991 /4a-hal
parentdded1b16dc18bb5b692b58d0e2e303bde7ca0308 (diff)
Return the result of call to mixer
Return the response field of mixer reponse to the caller of stream/capture/playback verbs. Force the verbose key in sent object. Change-Id: I5b87da0042c86c6b7dc8853af66cddd2f6819532 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.c27
1 files changed, 20 insertions, 7 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 7089cf3..67df3b6 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -391,7 +391,7 @@ void HalCtlsActionOnCall(AFB_ReqT request)
struct SpecificHalData *currentCtlHalData;
struct CtlHalMixerData *currentMixerData;
- json_object *requestJson, *returnJ;
+ json_object *requestJson, *returnJ, *toReturnJ;
apiHandle = (AFB_ApiT) afb_request_get_dynapi(request);
if(! apiHandle) {
@@ -434,17 +434,30 @@ void HalCtlsActionOnCall(AFB_ReqT request)
return;
}
+ if(json_object_is_type(requestJson, json_type_object) && json_object_get_object(requestJson)->count > 0)
+ json_object_object_add(requestJson, "verbose", json_object_new_boolean(1));
+
// TBD JAI : handle the case of there is multiple 'playbacks' or 'captures' entries (call them all)
if(AFB_ServiceSync(apiHandle, apiToCall, currentMixerData->verbToCall, json_object_get(requestJson), &returnJ)) {
HalUtlHandleAppFwCallErrorInRequest(request, apiToCall, currentMixerData->verbToCall, returnJ, "call_action");
}
-
- AFB_ReqSuccessF(request,
- NULL,
- "Action %s correctly transferred to %s without any error raised",
- currentMixerData->verbToCall,
- apiToCall);
+ else if(wrap_json_unpack(returnJ, "{s:o}", "response", &toReturnJ)) {
+ AFB_ReqFailF(request,
+ "invalid_response",
+ "%s: Seems that %s call to api %s succeed, but response is not valid : '%s'",
+ __func__,
+ MIXER_ATTACH_VERB,
+ apiToCall,
+ json_object_get_string(returnJ));
+ }
+ else {
+ AFB_ReqSuccessF(request,
+ toReturnJ,
+ "Action %s correctly transferred to %s without any error raised",
+ MIXER_ATTACH_VERB,
+ apiToCall);
+ }
}
json_object *HalCtlsGetJsonArrayForMixerDataTable(AFB_ApiT apiHandle, struct CtlHalMixerDataT *currentMixerDataT, enum MixerDataType dataType)