APIs description

Doxygen complete API documentation

Doxygen documentation Link to doxygen API documentation

Protobuf complete API documentation

Protobuf documentation Link to protobuf API documentation

Available classes

PROTOBUF_MSG

Warning

doxygenstruct: Cannot find class “PROTOBUF_MSG” in doxygen xml output for project “libDM_protobuf” from directory: ./doxyfiles/xml

PROTOBUF_UTILS

class PROTOBUF_UTILS

Provides functionality for sending and receiving Protobuf messages over various streams.

This class provides functionality for sending and receiving Protobuf messages over various streams. It supports hardware streams and sending/receiving messages over them.

Public Functions

inline explicit PROTOBUF_UTILS(streamLogger *streamObj, timerTool *timerObj)

Constructor for the PROTOBUF_UTILS class.

Parameters:
  • streamObj – A pointer to the streamLogger object to use for logging.

  • timerObj – A pointer to the timerTool object to use for timing.

bool initiateLogging()

Initiates the logging process of the sent/received messages.

This function initiates the logging process by setting up the necessary parameters and starting the logging thread. Returns true if the logging process was successfully initiated, false otherwise.

Returns:

true if the logging process was successfully initiated, false otherwise.

bool addStream(HardwareSerial *serialObj)

Adds a Protobuf serial stream for protobuf reception/emission.

This function adds a Protobuf serial stream to the library, which can be used to send and receive Protobuf messages.

Parameters:

serialObj – A pointer to the HardwareSerial object that represents the serial port to use for the Protobuf stream.

Returns:

true if the Protobuf stream was added successfully, false otherwise.

void updateReceivedMessages(const uint8_t *buffer, size_t bufferLength)

Updates the received messages from the buffer provided coming from the given source.

This function updates the received messages using the buffer provided by the caller. This function does not directly use hardware buffers to avoid pruning it if multiple protocols are used for the same interface. For example if mavlink and protobuf are used on the same serial bus, the caller has to copy the serial buffer into a temporary buffer and provide it to this function.

Parameters:
  • buffer – A pointer to the buffer containing the received messages.

  • bufferLength – The length of the buffer in bytes.

bool sendMessages()

Sends messages that are ready to be sent.

This function sends messages that are ready to be sent. It should be called periodically to ensure that all messages are sent in a timely manner.

Returns:

true if ProtoFrame has been sent successfully, false otherwise.

inline bool isNewMsgReceived() const

Checks if a new message has been received.

Returns:

true if a new message has been received, false otherwise.

inline PROTOBUF_MSG *getReceivedMsg()

Returns a pointer to the most recently received protobuf message.

Returns:

A pointer to the most recently received protobuf message.

inline PROTOBUF_MSG *getMsgToSend()

Returns a pointer to the protobuf message that should be sent.

Returns:

A pointer to the protobuf message to send.

inline size_t getLastEncodedMessageSize() const

Returns the size of the last encoded message.

Returns:

The size of the last encoded message.