nRF5 SDK v17.1.0
Data Structures | Typedefs | Enumerations | Functions

Module for declaring system events API. More...

Data Structures

struct  sys_event_desc_t
 Event descriptor. More...
 

Typedefs

typedef void(* sys_event_callback_t )(const void *p_data)
 Prototype of user-implemented callback for processing an event. More...
 

Enumerations

enum  sys_event_id_t {
  SYS_EVENT_FALLING_ASLEEP,
  SYS_EVENT_WAKE_UP,
  SYS_EVENT_OUT_OF_MEMORY,
  SYS_EVENT_MEMORY_FREED,
  TST_EVENT_0,
  TST_EVENT_1,
  TST_EVENT_2,
  SYS_EVENTS_AMOUNT
}
 IDs of globally available events. More...
 

Functions

void sys_events_init (void)
 Function for initializing the global events infrastructure.
 
void sys_event_subscribe (sys_event_desc_t *p_event_desc)
 Function for subscribing to a system event. More...
 
void sys_event_unsubscribe (sys_event_desc_t *p_event_desc)
 Function for unsubscribing from a system event event. More...
 
void sys_events_array_subscribe (sys_event_desc_t *p_desc_array, size_t desc_amount)
 Function for subscribing to a group of events. More...
 
void sys_events_array_unsubscribe (sys_event_desc_t *p_desc_array, size_t desc_amount)
 Function for unsubscribing from the group of events. More...
 
void sys_event_post (sys_event_id_t event_id, const void *p_data)
 Function for posting an event. More...
 

Detailed Description

Module for declaring system events API.

The Events module defines some routines to subscribe/unsubscribe to/from system events. The events pool can be extended by adding new events to the sys_event_id_t enumeration. The registered callbacks can be called for an array of events. The callbacks can be called implicitly via posting the event by the sys_event_post() routine.

Typedef Documentation

typedef void(* sys_event_callback_t)(const void *p_data)

Prototype of user-implemented callback for processing an event.

This callback is registered for the given event by a *_subscribe routine, and is then called by the system events engine, when this event occurs.

Parameters
[in]p_dataPointer to the data, specific for this event.

Enumeration Type Documentation

IDs of globally available events.

Event IDs are system extension points that allow the user to implement specific processing of predefined set of events, occurring in different modules.

Enumerator
SYS_EVENT_FALLING_ASLEEP 

Falling asleep event.

SYS_EVENT_WAKE_UP 

Waking up event.

SYS_EVENT_OUT_OF_MEMORY 

Out of memory event.

SYS_EVENT_MEMORY_FREED 

Memory was freed up event.

TST_EVENT_0 
Note
The list of system events can be extended during the implementation phase. Test event #0.
TST_EVENT_1 

Test event #1.

TST_EVENT_2 

Test event #2.

Function Documentation

void sys_event_post ( sys_event_id_t  event_id,
const void *  p_data 
)

Function for posting an event.

This function is used to notify all the subscribers of the given events via their callbacks, when the given event occurs.

Parameters
[in]event_idID of the event to be posted.
[in]p_dataPointer to be passed to the event handlers' callbacks.
void sys_event_subscribe ( sys_event_desc_t p_event_desc)

Function for subscribing to a system event.

Parameters
[in]p_event_descPointer to the event descriptor.
void sys_event_unsubscribe ( sys_event_desc_t p_event_desc)

Function for unsubscribing from a system event event.

Parameters
[in]p_event_descPointer to the event descriptor.
void sys_events_array_subscribe ( sys_event_desc_t p_desc_array,
size_t  desc_amount 
)

Function for subscribing to a group of events.

Parameters
[in]p_desc_arrayPointer to the array of event descriptors.
[in]desc_amountAmount of event descriptors in the array.
void sys_events_array_unsubscribe ( sys_event_desc_t p_desc_array,
size_t  desc_amount 
)

Function for unsubscribing from the group of events.

Parameters
[in]p_desc_arrayPointer to the array of event descriptors.
[in]desc_amountAmount of the event descriptors in the array.

Documentation feedback | Developer Zone | Subscribe | Updated