diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-06-03 19:07:26 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:51:00 +0200 |
commit | 8bbaffadc1a5bcfc9b14174793f034565baecb52 (patch) | |
tree | e81c16bb3d37307e34951782dabac742da39079f /4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c | |
parent | 6629b727ca8554e7f27891af91d315addc532b47 (diff) |
Use error codes when handling mixer init response
Use error codes when handling mixer initialization response.
Change-Id: Ie62b022f1a653be18766a09f1803995a77ae8582
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c')
-rw-r--r-- | 4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c index fa5ca4e..789913d 100644 --- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c +++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-handler.c @@ -32,7 +32,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT *currentHalStreamsData, json_object *mixerResponseJ) { - int err = 0; + int err = (int) MIXER_NO_ERROR; unsigned int idx; char *currentStreamName, *currentStreamCardId; @@ -46,7 +46,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT apiHandle = (afb_dynapi *) afb_request_get_dynapi(request); if(! apiHandle) { AFB_REQUEST_WARNING(request, "%s: Can't get current hal api handle", __func__); - return -1; + return (int) MIXER_ERROR_API_UNAVAILABLE; } switch(json_object_get_type(mixerResponseJ)) { @@ -59,7 +59,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT default: currentHalStreamsData->count = 0; AFB_REQUEST_WARNING(request, "%s: no streams returned", __func__); - return -2; + return (int) MIXER_ERROR_NO_STREAMS; } currentHalStreamsData->data = (struct CtlHalStreamData *) calloc(currentHalStreamsData->count, sizeof(struct CtlHalStreamData)); @@ -76,11 +76,11 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT if(wrap_json_unpack(currentStreamJ, "{s:s}", "uid", ¤tStreamName)) { AFB_REQUEST_WARNING(request, "%s: can't find name in current stream object", __func__); - err -= 10; + err += (int) MIXER_ERROR_STREAM_NAME_UNAVAILABLE; } else if(wrap_json_unpack(currentStreamJ, "{s:s}", "alsa", ¤tStreamCardId)) { AFB_REQUEST_WARNING(request, "%s: can't find card id in current stream object", __func__); - err -= 1000; + err += (int) MIXER_ERROR_STREAM_CARDID_UNAVAILABLE; } else { currentHalStreamsData->data[idx].name = strdup(currentStreamName); @@ -94,7 +94,7 @@ int HalCtlsHandleMixerAttachResponse(AFB_ReqT request, struct CtlHalStreamsDataT if(HalUtlLoadVerbs(apiHandle, CtlHalDynApiStreamVerbs)) { AFB_REQUEST_WARNING(request, "%s: error while creating verbs for streams", __func__); - err -= 100000; + err += (int) MIXER_ERROR_COULDNT_ADD_STREAMS_AS_VERB; } return err; |