NTURT Zephyr v0.0.1
NTURT common library for Zephyr RTOS
Loading...
Searching...
No Matches
Message

Inter-thread communication support. More...

+ Collaboration diagram for Message:

Topics

 Aggregation
 Data aggregation.
 
 Message Interface
 Message type definitions.
 
 Message Logging
 Inter-thread communication logging support.
 

Data Structures

struct  msg_chan_data
 Message channel data. More...
 

Macros

#define MSG_LIST   MSG_SENSOR_LIST, MSG_TRACTIVE_LIST
 List of all messages.
 
#define MSG_AGG_TO_MSG_DEFINE(name, msg, init_val, period, min_separation, watermark, flag, ...)
 Define a data aggregration for aggregating into message msg . May be specified as static to limit the scope of the aggregation.
 
#define MSG_CHAN_DEFINE(list)
 Define one message channel for every message in list .
 
#define MSG_CHAN_DECLARE(list)
 Declare one message channel for every message in list .
 
#define MSG_VCU_LIST   MSG_CTRL_LIST, MSG_STATES_LIST
 List of all VCU messages.
 

Typedefs

typedef void(* msg_print_t) (const void *data)
 Print function of a message.
 
typedef const char *(* msg_csv_header_t) ()
 Function to get the CSV header of a message.
 
typedef int(* msg_csv_write_t) (char *buf, size_t len, const void *data)
 Function to write a message to a CSV format.
 

Functions

 MSG_CHAN_DECLARE (MSG_LIST)
 
bool msg_chan_is_from_msg (const struct zbus_channel *chan)
 Check if the given zbus channel is a message channel.
 
void msg_chan_print (const struct zbus_channel *chan, const void *data)
 Print a message based on the channel.
 
const char * msg_chan_csv_header (const struct zbus_channel *chan)
 Get the CSV header of a message channel.
 
int msg_chan_csv_write (const struct zbus_channel *chan, const void *data, char *buf, size_t len)
 Write a message in CSV format to a buffer based on the channel.
 
void msg_agg_publish (const void *data, void *user_data)
 Publishing function for MSG_AGG_DEFINE.
 
 MSG_CHAN_DECLARE (MSG_VCU_LIST)
 

Variables

struct agg_typed msg_sensor_wheel_agg
 

Detailed Description

Inter-thread communication support.

Macro Definition Documentation

◆ MSG_AGG_TO_MSG_DEFINE

#define MSG_AGG_TO_MSG_DEFINE ( name,
msg,
init_val,
period,
min_separation,
watermark,
flag,
... )

#include <nturt/msg/msg.h>

Value:
AGG_TYPED_DEFINE(name, struct msg, init_val, period, min_separation, \
watermark, flag, msg_agg_publish, (void *)&_MSG_CHAN(msg), \
__VA_ARGS__);
#define AGG_TYPED_DEFINE(_name, _type, _init_val, _period, _min_separation, _watermark, _flag, _publish, _user_data,...)
Define a data aggregation named _name to monitor the update of members within a data type....
Definition aggregation.h:153
void msg_agg_publish(const void *data, void *user_data)
Publishing function for MSG_AGG_DEFINE.

Define a data aggregration for aggregating into message msg . May be specified as static to limit the scope of the aggregation.

Parameters
[in]nameName of the aggregation.
[in]msgMessage to aggregate.
[in]init_valInitial value of the message, must be a specified by AGG_DATA_INIT.
[in]periodPeriod of data publishing.
[in]min_separationMinimum separation time between two data publishing.
[in]watermarkWatermark to wait for late-arriving members.
[in]flagFlag of the aggregation. The same ones and rules as flag in AGG_DEFINE.
[in]...Members of msg to be monitored, must be specified by AGG_MEMBER.

◆ MSG_CHAN_DECLARE

#define MSG_CHAN_DECLARE ( list)

#include <nturt/msg/msg.h>

Value:
ZBUS_CHAN_DECLARE(FOR_EACH(_MSG_CHAN, (, ), list))

Declare one message channel for every message in list .

Parameters
[in]listList of messages to define channels.

◆ MSG_CHAN_DEFINE

#define MSG_CHAN_DEFINE ( list)

#include <nturt/msg/msg.h>

Value:
N_FOR_EACH(_MSG_CHAN_DEFINE, (;), list)
#define N_FOR_EACH(F, sep,...)
Same as Zephyr FOR_EACH, useful for nested FOR_EACH macros.
Definition util.h:83

Define one message channel for every message in list .

Parameters
[in]listList of messages to define channels.
Note
This macro uses logging to print messages, so a log module must be registered or declared before using this macro.

◆ MSG_LIST

#define MSG_LIST   MSG_SENSOR_LIST, MSG_TRACTIVE_LIST

#include <nturt/msg/msg.h>

List of all messages.

◆ MSG_VCU_LIST

#define MSG_VCU_LIST   MSG_CTRL_LIST, MSG_STATES_LIST

#include <vcu/msg/msg.h>

List of all VCU messages.

Typedef Documentation

◆ msg_csv_header_t

typedef const char *(* msg_csv_header_t) ()

#include <nturt/msg/msg.h>

Function to get the CSV header of a message.

Returns
Pointer to the CSV header string.

◆ msg_csv_write_t

typedef int(* msg_csv_write_t) (char *buf, size_t len, const void *data)

#include <nturt/msg/msg.h>

Function to write a message to a CSV format.

Parameters
[in]bufBuffer to write the CSV data to.
[in]lenLength of the buffer.
[in]dataPointer to the message data.
Returns
Number of bytes that would be written to the buffer if it were large enough, excluding the null terminator.

◆ msg_print_t

typedef void(* msg_print_t) (const void *data)

#include <nturt/msg/msg.h>

Print function of a message.

Parameters
[in]dataPointer to the message data.

Function Documentation

◆ msg_agg_publish()

void msg_agg_publish ( const void * data,
void * user_data )

#include <nturt/msg/msg.h>

Publishing function for MSG_AGG_DEFINE.

Warning
Internal use only.

◆ msg_chan_csv_header()

const char * msg_chan_csv_header ( const struct zbus_channel * chan)

#include <nturt/msg/msg.h>

Get the CSV header of a message channel.

Parameters
[in]chanMessage channel.
Returns
Pointer to the CSV header string.
Warning
Only zbus channels defined with MSG_CHAN_DEFINE can be used with this function.

◆ msg_chan_csv_write()

int msg_chan_csv_write ( const struct zbus_channel * chan,
const void * data,
char * buf,
size_t len )

#include <nturt/msg/msg.h>

Write a message in CSV format to a buffer based on the channel.

Parameters
[in]chanMessage channel.
[in]dataPointer to the message data.
[in]bufBuffer to write the CSV data to.
[in]lenLength of the buffer.
Returns
Number of bytes that would be written to the buffer if it were large enough, excluding the null terminator.
Warning
Only zbus channels defined with MSG_CHAN_DEFINE can be used with this function.

◆ MSG_CHAN_DECLARE() [1/2]

MSG_CHAN_DECLARE ( MSG_LIST )

#include <nturt/msg/msg.h>

◆ MSG_CHAN_DECLARE() [2/2]

MSG_CHAN_DECLARE ( MSG_VCU_LIST )

#include <vcu/msg/msg.h>

◆ msg_chan_is_from_msg()

bool msg_chan_is_from_msg ( const struct zbus_channel * chan)

#include <nturt/msg/msg.h>

Check if the given zbus channel is a message channel.

Parameters
chanZbus channel to check.
Returns
True if the channel is a message channel, false otherwise.

◆ msg_chan_print()

void msg_chan_print ( const struct zbus_channel * chan,
const void * data )

#include <nturt/msg/msg.h>

Print a message based on the channel.

Parameters
[in]chanMessage channel.
[in]dataPointer to the message data.
Warning
Only zbus channels defined with MSG_CHAN_DEFINE can be used with this function.

Variable Documentation

◆ msg_sensor_wheel_agg

struct agg_typed msg_sensor_wheel_agg
extern

#include <vcu/msg/msg.h>