diff options
-rw-r--r-- | alsa-hook/PolicyAlsaHook.c | 18 |
1 files 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; } |