Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
zbus_observer Struct Reference

Type used to represent an observer. More...

#include <zbus.h>

Data Fields

const char *const name
 Observer name.
 
enum zbus_observer_type type
 Type indication.
 
struct zbus_observer_data *const data
 Mutable observer data struct.
 
union {
   struct k_msgq *const   queue
 Observer message queue. More...
 
   void(*const   callback )(const struct zbus_channel *chan)
 Observer callback function. More...
 
   struct k_fifo *const   message_fifo
 Observer message FIFO. More...
 
}; 
 

Detailed Description

Type used to represent an observer.

Every observer has an representation structure containing the relevant information. An observer is a code portion interested in some channel. The observer can be notified synchronously or asynchronously and it is called listener and subscriber respectively. The observer can be enabled or disabled during runtime by change the enabled boolean field of the structure. The listeners have a callback function that is executed by the bus with the index of the changed channel as argument when the notification is sent. The subscribers have a message queue where the bus enqueues the index of the changed channel when a notification is sent.

See also
zbus_obs_set_enable function to properly change the observer's enabled field.

Field Documentation

◆ 

union { ... } zbus_observer::@420

◆ callback

void(*const zbus_observer::callback) (const struct zbus_channel *chan)

Observer callback function.

It turns the observer into a listener.

◆ data

struct zbus_observer_data* const zbus_observer::data

Mutable observer data struct.

◆ message_fifo

struct k_fifo* const zbus_observer::message_fifo

Observer message FIFO.

It turns the observer into a message subscriber. It only exists if the CONFIG_ZBUS_MSG_SUBSCRIBER is enabled.

◆ name

const char* const zbus_observer::name

Observer name.

◆ queue

struct k_msgq* const zbus_observer::queue

Observer message queue.

It turns the observer into a subscriber.

◆ type

enum zbus_observer_type zbus_observer::type

Type indication.


The documentation for this struct was generated from the following file: