diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-06-11 20:49:01 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:52:51 +0200 |
commit | 3611753da97f29fc1342ac33a34a25f79acdc672 (patch) | |
tree | 1ce164fb290538b5b9ba5ae98111efb79aacc782 /4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c | |
parent | 4e05b191805c728fb2208bce4491eb322681b0c9 (diff) |
Print some errors in info verbs
Print errors info when an error happen during call to mixer 'info' verb.
Change-Id: Ic3b0b6312743af3ba41a7868d1347ce6b0fcc8cd
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
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.c | 17 |
1 files changed, 13 insertions, 4 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 3d45260..c74e7a4 100644 --- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c +++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c @@ -491,7 +491,7 @@ json_object *HalCtlsGetJsonArrayForMixerDataTable(AFB_ApiT apiHandle, struct Ctl void HalCtlsInfo(AFB_ReqT request) { - char *apiToCall; + char *apiToCall, *returnedStatus = NULL, *returnedInfo = NULL; AFB_ApiT apiHandle; CtlConfigT *ctrlConfig; @@ -524,15 +524,24 @@ void HalCtlsInfo(AFB_ReqT request) return; } - if(json_object_is_type(requestJson, json_type_object)) { + if(json_object_is_type(requestJson, json_type_object) && json_object_get_object(requestJson)->count > 0) { apiToCall = currentCtlHalData->ctlHalSpecificData->mixerApiName; if(! apiToCall) { AFB_ReqFail(request, "mixer_api", "Can't get mixer api"); return; } - if(HalCtlsGetInfoFromMixer(apiHandle, apiToCall, requestJson, &toReturnJ)) { - AFB_ReqFail(request, "mixer_info", "Call to mixer info verb didn't succeed"); + if(HalCtlsGetInfoFromMixer(apiHandle, apiToCall, requestJson, &toReturnJ, &returnedStatus, &returnedInfo)) { + if(returnedStatus && returnedInfo) { + AFB_ReqFailF(request, + "mixer_info", + "Call to mixer info verb didn't succeed with status '%s' and info '%s'", + returnedStatus, + returnedInfo); + } + else { + AFB_ReqFail(request, "mixer_info", "Call to mixer info verb didn't succeed"); + } return; } |