99#ifndef ZIGPC_COMMON_OBSERVER_H
100#define ZIGPC_COMMON_OBSERVER_H
114#define ZIGPC_OBSERVER_EVENTS_MAX 20
120#define ZIGPC_OBSERVER_EVENT_CALLBACKS_MAX 5
212 const uint8_t event_count);
#define data
Definition: ctimer.c:49
uint32_t sl_status_t
Definition: sl_status.h:139
#define ZIGPC_OBSERVER_EVENTS_MAX
Maximum number of events supported by an observable instance.
Definition: zigpc_common_observable.h:114
sl_status_t zigpc_observable_unregister(struct zigpc_observable *observable, const zigpc_observer_event_t event, const zigpc_observer_callback_t callback)
Unregister an observer with a corresponding event from observable instance.
Definition: zigpc_common_observable.c:171
#define ZIGPC_OBSERVER_EVENT_CALLBACKS_MAX
Maximum number of listeners per event supported by an observable instance.
Definition: zigpc_common_observable.h:120
sl_status_t zigpc_observable_register(struct zigpc_observable *observable, const zigpc_observer_event_t event, zigpc_observer_callback_t callback)
Register an observer with a corresponding event to observable instance.
Definition: zigpc_common_observable.c:136
void(* zigpc_observer_callback_t)(void *data)
Observer callback that is called by subjects when notifying observers of new events.
Definition: zigpc_common_observable.h:136
sl_status_t zigpc_observable_init(struct zigpc_observable *observable, const zigpc_observer_event_t *event_list, const uint8_t event_count)
Initialize observable with an approved event list.
Definition: zigpc_common_observable.c:231
uint8_t zigpc_observer_event_t
Observer event type.
Definition: zigpc_common_observable.h:126
sl_status_t zigpc_observable_notify(const struct zigpc_observable *observable, const zigpc_observer_event_t event, void *data)
Inform Observers of observable instance of an event with data.
Definition: zigpc_common_observable.c:79
void zigpc_observable_clear(struct zigpc_observable *observable)
Stop all observers from being notified.
Definition: zigpc_common_observable.c:264
Definition: zigpc_common_observable.h:138
zigpc_observer_callback_t callbacks[ZIGPC_OBSERVER_EVENT_CALLBACKS_MAX]
Definition: zigpc_common_observable.h:140
zigpc_observer_event_t event
Definition: zigpc_common_observable.h:139
Observable instance.
Definition: zigpc_common_observable.h:147
struct zigpc_observable_event_entry event_list[ZIGPC_OBSERVER_EVENTS_MAX]
Definition: zigpc_common_observable.h:148
uint8_t event_count
Definition: zigpc_common_observable.h:149