Very Simple Kernel 0.1.0
Loading...
Searching...
No Matches
vsk_EventSubscription.h
Go to the documentation of this file.
1/**
2 * @file
3 */
4#ifndef VSK_EVENTSUBSCRIPTION_H
5#define VSK_EVENTSUBSCRIPTION_H
6/**
7 * @ingroup vsk
8 * @defgroup vsk_EventSubscription vsk_EventSubscription
9 * @{
10 */
11
12/**
13 * @brief Event subscription
14 */
16
17#include "vsk_Inbox.h"
18#include "vsk_Message.h"
19
20/**
21 * @brief Event subscription
22 */
24 ctb_DNode_t node; /**< Node to allow event subscription to be added to a list */
25 vsk_Inbox_t * inbox; /**< Inbox to post the event message to */
26 vsk_Message_t message; /**< Message to post to the inbox */
27};
28
29/**
30 * @brief Initializes an event subscription
31 *
32 * @param self Event subscription reference
33 * @param inbox Inbox to post the event message to
34 * @param handler Message handler to be called when the event is dispatched
35 * @param obj Object reference to pass to the handler
36 * @return Initialized event subscription
37 */
39 vsk_EventSubscription_t * const self,
40 vsk_Inbox_t * const inbox,
41 vsk_Message_Handler_t const handler,
42 void * const obj
43);
44
45/**
46 * @brief Publishes the event message to the associated inbox
47 *
48 * @param self Event subscription reference
49 */
51
52/** @} */
53#endif // VSK_EVENTSUBSCRIPTION_H
vsk_EventSubscription_t * vsk_EventSubscription_init(vsk_EventSubscription_t *const self, vsk_Inbox_t *const inbox, vsk_Message_Handler_t const handler, void *const obj)
Initializes an event subscription.
Definition vsk_EventSubscription.c:3
void vsk_EventSubscription_publish(vsk_EventSubscription_t *const self)
Publishes the event message to the associated inbox.
Definition vsk_EventSubscription.c:14
void(* vsk_Message_Handler_t)(void *const obj)
Message handler.
Definition vsk_Message.h:22
Event subscription.
Definition vsk_EventSubscription.h:23
vsk_Message_t message
Definition vsk_EventSubscription.h:26
ctb_DNode_t node
Definition vsk_EventSubscription.h:24
vsk_Inbox_t * inbox
Definition vsk_EventSubscription.h:25
Inbox.
Definition vsk_Inbox.h:36
Message.
Definition vsk_Message.h:27