X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmain-afb-client-demo.c;h=b587748577fbc4218473cc7f00e69ac375e821b0;hb=7386e1c5090b4e76036bc212f2a2cf32920bb160;hp=4b3ce4b7f8e662fb9c4ffa49017e353506b86cfd;hpb=0342cd1f15478365bad504d9398d56a03b89781a;p=src%2Fapp-framework-binder.git diff --git a/src/main-afb-client-demo.c b/src/main-afb-client-demo.c index 4b3ce4b7..b5877485 100644 --- a/src/main-afb-client-demo.c +++ b/src/main-afb-client-demo.c @@ -55,12 +55,12 @@ static void on_wsj1_event(void *closure, const char *event, struct afb_wsj1_msg static void on_pws_hangup(void *closure); static void on_pws_reply(void *closure, void *request, struct json_object *result, const char *error, const char *info); -static void on_pws_event_create(void *closure, const char *event_name, int event_id); -static void on_pws_event_remove(void *closure, const char *event_name, int event_id); -static void on_pws_event_subscribe(void *closure, void *request, const char *event_name, int event_id); -static void on_pws_event_unsubscribe(void *closure, void *request, const char *event_name, int event_id); -static void on_pws_event_push(void *closure, const char *event_name, int event_id, struct json_object *data); -static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data); +static void on_pws_event_create(void *closure, uint16_t event_id, const char *event_name); +static void on_pws_event_remove(void *closure, uint16_t event_id); +static void on_pws_event_subscribe(void *closure, void *request, uint16_t event_id); +static void on_pws_event_unsubscribe(void *closure, void *request, uint16_t event_id); +static void on_pws_event_push(void *closure, uint16_t event_id, struct json_object *data); +static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data, const afb_proto_ws_uuid_t uuid, uint8_t hop); static void idle(); static int process_stdin(); @@ -497,40 +497,40 @@ static void on_pws_reply(void *closure, void *request, struct json_object *resul dec_callcount(); } -static void on_pws_event_create(void *closure, const char *event_name, int event_id) +static void on_pws_event_create(void *closure, uint16_t event_id, const char *event_name) { printf("ON-EVENT-CREATE: [%d:%s]\n", event_id, event_name); fflush(stdout); } -static void on_pws_event_remove(void *closure, const char *event_name, int event_id) +static void on_pws_event_remove(void *closure, uint16_t event_id) { - printf("ON-EVENT-REMOVE: [%d:%s]\n", event_id, event_name); + printf("ON-EVENT-REMOVE: [%d]\n", event_id); fflush(stdout); } -static void on_pws_event_subscribe(void *closure, void *request, const char *event_name, int event_id) +static void on_pws_event_subscribe(void *closure, void *request, uint16_t event_id) { - printf("ON-EVENT-SUBSCRIBE %s: [%d:%s]\n", (char*)request, event_id, event_name); + printf("ON-EVENT-SUBSCRIBE %s: [%d]\n", (char*)request, event_id); fflush(stdout); } -static void on_pws_event_unsubscribe(void *closure, void *request, const char *event_name, int event_id) +static void on_pws_event_unsubscribe(void *closure, void *request, uint16_t event_id) { - printf("ON-EVENT-UNSUBSCRIBE %s: [%d:%s]\n", (char*)request, event_id, event_name); + printf("ON-EVENT-UNSUBSCRIBE %s: [%d]\n", (char*)request, event_id); fflush(stdout); } -static void on_pws_event_push(void *closure, const char *event_name, int event_id, struct json_object *data) +static void on_pws_event_push(void *closure, uint16_t event_id, struct json_object *data) { if (raw) - printf("ON-EVENT-PUSH: [%d:%s]\n%s\n", event_id, event_name, json_object_to_json_string_ext(data, JSON_C_TO_STRING_NOSLASHESCAPE)); + printf("ON-EVENT-PUSH: [%d]\n%s\n", event_id, json_object_to_json_string_ext(data, JSON_C_TO_STRING_NOSLASHESCAPE)); if (human) - printf("ON-EVENT-PUSH: [%d:%s]\n%s\n", event_id, event_name, json_object_to_json_string_ext(data, JSON_C_TO_STRING_PRETTY|JSON_C_TO_STRING_NOSLASHESCAPE)); + printf("ON-EVENT-PUSH: [%d]\n%s\n", event_id, json_object_to_json_string_ext(data, JSON_C_TO_STRING_PRETTY|JSON_C_TO_STRING_NOSLASHESCAPE)); fflush(stdout); } -static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data) +static void on_pws_event_broadcast(void *closure, const char *event_name, struct json_object *data, const afb_proto_ws_uuid_t uuid, uint8_t hop) { if (raw) printf("ON-EVENT-BROADCAST: [%s]\n%s\n", event_name, json_object_to_json_string_ext(data, JSON_C_TO_STRING_NOSLASHESCAPE)); @@ -564,7 +564,7 @@ static void pws_call(const char *verb, const char *object) if (jerr != json_tokener_success) o = json_object_new_string(object); } - rc = afb_proto_ws_client_call(pws, verb, o, sessionid, key, NULL); + rc = afb_proto_ws_client_call(pws, verb, o, 0, 0, key, NULL); json_object_put(o); if (rc < 0) { fprintf(stderr, "calling %s(%s) failed: %m\n", verb, object?:"");