diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-12-16 15:20:54 +0100 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-12-17 09:49:13 +0100 |
commit | 154361da85ac7eab864b803dd77deb2e4f0aa650 (patch) | |
tree | 373eca6e1eba73fb51570c80cd74f75c6bbee574 /alsa-hook/PolicyAlsaHook.c | |
parent | ad7b3a4b69f1598da8caf0f386dc70eaa9acdf0f (diff) |
Adapt policy ALSA hook to latest afbinder changesicefish_8.99.5icefish_8.99.4icefish/8.99.5icefish/8.99.48.99.58.99.4
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 <jonathan.aillet@iot.bzh>
Diffstat (limited to 'alsa-hook/PolicyAlsaHook.c')
-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; } |