#include "FreeRTOS.h"
#include "queue.h"
#include "stdbool.h"
Go to the source code of this file.
Data Structures | |
struct | Message |
Type definition for generic message struct. More... | |
struct | Topic |
Public representation of a Topic. More... | |
Macros | |
#define | SUBSCRIBE_TOPIC(topic, inbox, length, size) |
Macro to declare a subscription to a specific topic. | |
#define | CREATE_MESSAGE(name, length_) |
Macro to define, on the stack, a named message struct. | |
Functions | |
bool | Topic_comment (Topic *topic, uint8_t *comment) |
Send a "comment" back to the originator of a topic. | |
struct Message |
Type definition for generic message struct.
Typically variables of this type should not be defined on their own, however the Message structure is useful in parsing received messages from their raw binary.
For initialisation of a message to be sent on a topic refer to CREATE_MESSAGE.
struct Topic |
#define SUBSCRIBE_TOPIC | ( | topic, | |
inbox, | |||
length, | |||
size ) |
Macro to declare a subscription to a specific topic.
This macro declares a FreeRTOS queue handle (subscription
) and places it into a special linker section named ".<topic>_subscription". The CREATE_TOPIC
macro uses these sections to automatically discover all subscribers for a given topic at runtime during initialization.
subscription
variable. This macro only declares the handle and places it in the linker section for discovery. #define CREATE_MESSAGE | ( | name, | |
length_ ) |
Macro to define, on the stack, a named message struct.
This structure provides receivers of messages on a topic with the associated data and its length for parsing.
The message length is encoded in the first byte, with data as a fixed length array member.
bool Topic_comment | ( | Topic * | topic, |
uint8_t * | comment ) |
Send a "comment" back to the originator of a topic.
This function allows a task (typically a subscriber, but not necessarily) to send data back to the task that created the topic.
topic | Pointer to the public Topic structure representing the target topic. This structure must have been properly initialized. |
comment | Pointer to the data buffer containing the comment message to send. The size and structure of this data must be known by both the sender and the topic originator's receiving task. |
true
if the comment was successfully sent to the topic's queue (or if arguments were valid). false
if topic
or comment
is NULL.TODO: Implement optional argument for block time to allow readers to define how long the task should block when the queue is full.