From: José Bollo Date: Tue, 17 May 2016 21:47:13 +0000 (+0200) Subject: event sender: better naming X-Git-Tag: blowfish_2.0.1~109 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=031601a0c5aa944493660f991d66702cc7e52755;p=src%2Fapp-framework-binder.git event sender: better naming Change-Id: I82d918cd14b1e368ef509fa3a1b21c3e55a6b98d Signed-off-by: José Bollo --- diff --git a/include/afb/afb-evmgr-itf.h b/include/afb/afb-event-sender-itf.h similarity index 71% rename from include/afb/afb-evmgr-itf.h rename to include/afb/afb-event-sender-itf.h index 90b1e0a9..ad354319 100644 --- a/include/afb/afb-evmgr-itf.h +++ b/include/afb/afb-event-sender-itf.h @@ -19,16 +19,16 @@ struct json_object; -struct afb_evmgr_itf { - void (*push)(void *evmgr, const char *name, struct json_object *object); +struct afb_event_sender_itf { + void (*push)(void *event_sender, const char *name, struct json_object *object); }; -struct afb_evmgr { - const struct afb_evmgr_itf *itf; +struct afb_event_sender { + const struct afb_event_sender_itf *itf; void *closure; }; -static inline void afb_evmgr_push(struct afb_evmgr mgr, const char *name, struct json_object *object) +static inline void afb_event_sender_push(struct afb_event_sender mgr, const char *name, struct json_object *object) { return mgr.itf->push(mgr.closure, name, object); } diff --git a/include/afb/afb-plugin.h b/include/afb/afb-plugin.h index d3f6423d..de1ab419 100644 --- a/include/afb/afb-plugin.h +++ b/include/afb/afb-plugin.h @@ -18,7 +18,7 @@ #pragma once #include -#include +#include /* * Definition of the versions of the plugin. @@ -93,7 +93,7 @@ struct sd_bus; * Definition of the facilities provided by the daemon. */ struct afb_daemon_itf { - struct afb_evmgr (*get_evmgr)(void *closure); /* get the event manager */ + struct afb_event_sender (*get_event_sender)(void *closure); /* get the event manager */ struct sd_event *(*get_event_loop)(void *closure); /* get the common systemd's event loop */ struct sd_bus *(*get_user_bus)(void *closure); /* get the common systemd's user d-bus */ struct sd_bus *(*get_system_bus)(void *closure); /* get the common systemd's system d-bus */ @@ -101,7 +101,7 @@ struct afb_daemon_itf { /* * Structure for accessing daemon. - * See also: afb_daemon_get_evmgr, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus + * See also: afb_daemon_get_event_sender, afb_daemon_get_event_loop, afb_daemon_get_user_bus, afb_daemon_get_system_bus */ struct afb_daemon { const struct afb_daemon_itf *itf; /* the interfacing functions */ @@ -127,9 +127,9 @@ extern const struct AFB_plugin *pluginAfbV1Register (const struct AFB_interface * Retrieves the event sender of AFB * 'daemon' MUST be the daemon given in interface when activating the plugin. */ -static inline struct afb_evmgr afb_daemon_get_evmgr(struct afb_daemon daemon) +static inline struct afb_event_sender afb_daemon_get_event_sender(struct afb_daemon daemon) { - return daemon.itf->get_evmgr(daemon.closure); + return daemon.itf->get_event_sender(daemon.closure); } /* diff --git a/plugins/afm-main-plugin/afm-main-plugin.c b/plugins/afm-main-plugin/afm-main-plugin.c index 41e55404..786468a1 100644 --- a/plugins/afm-main-plugin/afm-main-plugin.c +++ b/plugins/afm-main-plugin/afm-main-plugin.c @@ -46,7 +46,7 @@ static const char _uninstall_[] = "uninstall"; static const char _uri_[] = "uri"; static const struct AFB_interface *afb_interface; -static struct afb_evmgr evmgr; +static struct afb_event_sender event_sender; static struct jbus *jbus; @@ -69,7 +69,7 @@ static struct memo *make_memo(struct afb_req request, const char *method) static void application_list_changed(const char *data, void *closure) { - afb_evmgr_push(evmgr, "application-list-changed", NULL); + afb_event_sender_push(event_sender, "application-list-changed", NULL); } static struct json_object *embed(const char *tag, struct json_object *obj) @@ -343,7 +343,7 @@ const struct AFB_plugin *pluginAfbV1Register(const struct AFB_interface *itf) /* records the interface */ assert (afb_interface == NULL); afb_interface = itf; - evmgr = afb_daemon_get_evmgr(itf->daemon); + event_sender = afb_daemon_get_event_sender(itf->daemon); /* creates the jbus for accessing afm-user-daemon */ sbus = afb_daemon_get_user_bus(itf->daemon); diff --git a/plugins/samples/HelloWorld.c b/plugins/samples/HelloWorld.c index 35b95cab..78a1eafd 100644 --- a/plugins/samples/HelloWorld.c +++ b/plugins/samples/HelloWorld.c @@ -54,7 +54,7 @@ static void pingBug (struct afb_req request) static void pingEvent(struct afb_req request) { json_object *query = afb_req_json(request); - afb_evmgr_push(afb_daemon_get_evmgr(interface->daemon), "event", query); + afb_event_sender_push(afb_daemon_get_event_sender(interface->daemon), "event", query); ping(request, json_object_get(query), "event"); } diff --git a/src/afb-api-so.c b/src/afb-api-so.c index cc3447ab..693385d5 100644 --- a/src/afb-api-so.c +++ b/src/afb-api-so.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include "session.h" #include "afb-common.h" @@ -50,7 +50,7 @@ static int api_timeout = 15; static const char plugin_register_function[] = "pluginAfbV1Entry"; -static void afb_api_so_evmgr_push(struct api_so_desc *desc, const char *name, struct json_object *object) +static void afb_api_so_event_sender_push(struct api_so_desc *desc, const char *name, struct json_object *object) { size_t length; char *event; @@ -64,17 +64,17 @@ static void afb_api_so_evmgr_push(struct api_so_desc *desc, const char *name, st ctxClientEventSend(NULL, event, object); } -static const struct afb_evmgr_itf evmgr_itf = { - .push = (void*)afb_api_so_evmgr_push +static const struct afb_event_sender_itf event_sender_itf = { + .push = (void*)afb_api_so_event_sender_push }; -static struct afb_evmgr afb_api_so_get_evmgr(struct api_so_desc *desc) +static struct afb_event_sender afb_api_so_get_event_sender(struct api_so_desc *desc) { - return (struct afb_evmgr){ .itf = &evmgr_itf, .closure = desc }; + return (struct afb_event_sender){ .itf = &event_sender_itf, .closure = desc }; } static const struct afb_daemon_itf daemon_itf = { - .get_evmgr = (void*)afb_api_so_get_evmgr, + .get_event_sender = (void*)afb_api_so_get_event_sender, .get_event_loop = (void*)afb_common_get_event_loop, .get_user_bus = (void*)afb_common_get_user_bus, .get_system_bus = (void*)afb_common_get_system_bus