From 154361da85ac7eab864b803dd77deb2e4f0aa650 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Mon, 16 Dec 2019 15:20:54 +0100 Subject: Adapt policy ALSA hook to latest afbinder changes These changes are about : - '.on_event_push' expected callback prototype in 'afb_proto_ws_client_itf' structure. - how 'afb_proto_ws_client_call' function is called. BUG-AGL: SPEC-3058 Change-Id: Icee4dafba3ff5ae9711bf52e5a5186c5b4df4f13 Signed-off-by: Jonathan Aillet --- alsa-hook/PolicyAlsaHook.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/alsa-hook/PolicyAlsaHook.c b/alsa-hook/PolicyAlsaHook.c index 62b1a2f..568f94f 100644 --- a/alsa-hook/PolicyAlsaHook.c +++ b/alsa-hook/PolicyAlsaHook.c @@ -141,7 +141,11 @@ typedef enum { HOOK_CLOSE, } hookActionT; +#if defined(AFB_PROTO_WS_VERSION) && (AFB_PROTO_WS_VERSION >= 4) +void OnEventCB(void *handle, uint16_t evtid, struct json_object *dataJ) { +#else void OnEventCB(void *handle, const char *event, int evtid, struct json_object *dataJ) { +#endif afbClientT *afbClient = (afbClientT*) handle; afbEventT **afbEvent = afbClient->event; json_object *tmpJ; @@ -150,7 +154,7 @@ void OnEventCB(void *handle, const char *event, int evtid, struct json_object *d // if no event handler just ignore events if (!afbEvent) goto OnErrorExit; - if (afbClient->verbose) printf("ON-EVENT processing signal event=%s search=%s session=%s\n", event, json_object_get_string(dataJ), afbClient->uid); + if (afbClient->verbose) printf("ON-EVENT processing signal evtid=%d search=%s session=%s\n", evtid, json_object_get_string(dataJ), afbClient->uid); // loop on event/signal mapping table for (index=0; afbEvent[index]!= NULL; index++) { @@ -183,7 +187,7 @@ void OnEventCB(void *handle, const char *event, int evtid, struct json_object *d return; OnErrorExit: - if (afbClient->verbose) SNDERR("ON-EVENT Fail/Ignored %s(%s)\n", event, json_object_get_string(dataJ)); + if (afbClient->verbose) SNDERR("ON-EVENT Fail/Ignored %d(%s)\n", evtid, json_object_get_string(dataJ)); return; } @@ -298,11 +302,13 @@ static int CallWithTimeout(afbClientT *afbClient, afbRequestT *afbRequest, int c // release action is optional if (afbRequest->apiverb) { if (afbClient->verbose) printf("CALL-REQUEST verb=%s query=%s tag=%s session=%s\n", afbRequest->apiverb, json_object_get_string(queryJ), afbRequest->callIdTag, afbClient->uid); - err = afb_proto_ws_client_call(afbClient->pws, afbRequest->apiverb, queryJ, afbClient->uid, afbRequest -#if defined(AFB_PROTO_WS_VERSION) && (AFB_PROTO_WS_VERSION >= 3) - , NULL +#if defined(AFB_PROTO_WS_VERSION) && (AFB_PROTO_WS_VERSION >= 4) + err = afb_proto_ws_client_call(afbClient->pws, afbRequest->apiverb, queryJ, 0, 0, afbRequest, NULL); +#elif defined(AFB_PROTO_WS_VERSION) && (AFB_PROTO_WS_VERSION == 3) + err = afb_proto_ws_client_call(afbClient->pws, afbRequest->apiverb, queryJ, afbClient->uid, afbRequest, NULL); +#else + err = afb_proto_ws_client_call(afbClient->pws, afbRequest->apiverb, queryJ, afbClient->uid, afbRequest); #endif - ); if (err < 0 ) goto OnErrorExit; } -- cgit 1.2.3-korg