Files | Data Structures | Macros | Typedefs | Functions
EventHub

A framework for distributing events in a system. More...

+ Collaboration diagram for EventHub:

Files

file  BCDS_EventHub.h
 

Data Structures

struct  EventHub_S
 
struct  EventObserver_S
 

Macros

#define CONFIG_EVENTHUB_MAX_OBSERVERS   (16)
 

Typedefs

typedef void(* EventHandler_T )(TaskEvent_T event, void *data)
 
typedef struct EventHub_S EventHub_T
 
typedef struct EventObserver_S EventObserver_T
 
typedef uint32_t TaskEvent_T
 

Functions

Retcode_T EventHub_Initialize (EventHub_T *hub)
 This function initializes a given event hub handle. More...
 
Retcode_T EventHub_Notify (EventHub_T *hub, TaskEvent_T Event, void *data)
 This function informs the hub that a given event has occurred. More...
 
Retcode_T EventHub_Observe (EventHub_T *hub, EventHandler_T handler, TaskEvent_T event)
 This function adds an observe of a given event to a hub. More...
 
Retcode_T EventHub_ObserveAll (EventHub_T *hub, EventHandler_T handler)
 This function adds an observe of all events to a hub. More...
 

Detailed Description

A module can register a callback to be called when another module informs the system that an event has occurred. This can be used for detecting connection to or disconnection from a network, updated LWM2M resources and so on. By default, the module allows for up to 16 observers per event hub but this can be overridden by changing the CONFIG_EVENTHUB_MAX_OBSERVERS flag.


Data Structure Documentation

struct EventHub_S
+ Collaboration diagram for EventHub_S:

Data Fields

void * lock
 
uint32_t observerCount
 
EventObserver_T observers [CONFIG_EVENTHUB_MAX_OBSERVERS]
 

Field Documentation

void* lock
uint32_t observerCount
struct EventObserver_S

Data Fields

bool allEvents
 
TaskEvent_T event
 
EventHandler_T handler
 

Field Documentation

bool allEvents
TaskEvent_T event
EventHandler_T handler

Macro Definition Documentation

#define CONFIG_EVENTHUB_MAX_OBSERVERS   (16)

Typedef Documentation

typedef void(* EventHandler_T)(TaskEvent_T event, void *data)
typedef struct EventHub_S EventHub_T
typedef uint32_t TaskEvent_T

Function Documentation

Retcode_T EventHub_Initialize ( EventHub_T hub)
Parameters
[in,out]hub- A pointer to an EventHub structure
Return values
RETCODE_OKwhen the event hub is initialized successfully
RETCODE_NULL_POINTERwhen the hub parameter pointer is NULL
RETCODE_SEMAPHORE_ERRORwhen the associated lock is not created successfully
Retcode_T EventHub_Notify ( EventHub_T hub,
TaskEvent_T  Event,
void *  data 
)
Parameters
[in]hub- A pointer to an EventHub structure
[in]event- The event that occurred
[in]data- Additional data to hand to the observer

Event notifications from interrupt context is not supported.

Return values
RETCODE_OKwhen all observers have been notified successfully
RETCODE_NULL_POINTERwhen the hub pointer is NULL
RETCODE_UNINITIALIZEDwhen the hub has not been initialized previously
RETCODE_SEMAPHORE_ERRORwhen the hub lock can't be taken or released successfully
Retcode_T EventHub_Observe ( EventHub_T hub,
EventHandler_T  handler,
TaskEvent_T  event 
)
Parameters
[in]hub- A pointer to an EventHub structure
[in]handler- A function pointer to the user-code run function that should be called when the event is signaled
[in]event- The event that should be observed
Return values
RETCODE_OKwhen the observation is added successfully
RETCODE_NULL_POINTERwhen the hub parameter pointer is NULL
RETCODE_UNINITIALIZEDwhen the hub has not been initialized previously
RETCODE_SEMAPHORE_ERRORwhen the hub lock can't be taken or released successfully
RETCODE_OUT_OF_RESOURCESwhen the maximum number of observation is already reached (see CONFIG_EVENTHUB_MAX_OBSERVERS)
Retcode_T EventHub_ObserveAll ( EventHub_T hub,
EventHandler_T  handler 
)
Parameters
[in]hub- A pointer to an EventHub structure
[in]handler- A function pointer to the user-code run function that should be called when the event is signaled
Return values
RETCODE_OKwhen observations for all event are added successfully
RETCODE_NULL_POINTERwhen hub or handler pointer is NULL

This documentation file has been automatically generated on Fri Oct 4 2019 03:47:39 by doxygen 1.8.8