diff options
author | José Bollo <jose.bollo@iot.bzh> | 2016-06-17 22:06:41 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2016-06-17 22:08:58 +0200 |
commit | b0848149c1ef5236791c0ba5196540d05d9f15fd (patch) | |
tree | aed121d97730579fd26281e614a88011f1b389f0 | |
parent | 31f85d741a3f35f853114e0bc299213f4456fcbc (diff) |
evt: exposes name of events
Change-Id: I1976848be0e8aeb170da37e1254208035e0e741a
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-evt.c | 8 | ||||
-rw-r--r-- | src/afb-evt.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/afb-evt.c b/src/afb-evt.c index a99dc894..53ab0e0b 100644 --- a/src/afb-evt.c +++ b/src/afb-evt.c @@ -205,6 +205,14 @@ struct afb_event afb_evt_create_event(const char *name) } /* + * Returns the name of the 'event' + */ +const char *afb_evt_event_name(struct afb_event event) +{ + return (event.itf != &afb_evt_event_itf) ? NULL : ((struct afb_evt_event *)event.closure)->name; +} + +/* * Returns an instance of the listener defined by the 'send' callback * and the 'closure'. * Returns NULL in case of memory depletion. diff --git a/src/afb-evt.h b/src/afb-evt.h index 8e102546..157a7776 100644 --- a/src/afb-evt.h +++ b/src/afb-evt.h @@ -30,6 +30,7 @@ extern struct afb_evt_listener *afb_evt_listener_addref(struct afb_evt_listener extern void afb_evt_listener_unref(struct afb_evt_listener *listener); extern struct afb_event afb_evt_create_event(const char *name); +extern const char *afb_evt_event_name(struct afb_event event); extern int afb_evt_add_watch(struct afb_evt_listener *listener, struct afb_event event); extern int afb_evt_remove_watch(struct afb_evt_listener *listener, struct afb_event event); |