TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
MessageDispatcher Class Reference

Reads stream and forwards messages to handler. More...

#include <MessageDispatcher.h>

Collaboration diagram for MessageDispatcher:
Collaboration graph
[legend]

Public Member Functions

 MessageDispatcher (MessageHandler &handler)
 
 MessageDispatcher (MessageHandler &handler, Stream &io)
 
bool begin ()
 
void end ()
 
virtual bool run ()
 
void setStream (Stream &io)
 
void setHandler (MessageHandler &handler)
 

Protected Attributes

Stream * p_stream = nullptr
 
bool is_active = false
 
MessageHandlerp_handler = nullptr
 

Detailed Description

Reads stream and forwards messages to handler.

The MessageDispatcher class reads messages from a communication stream (such as Serial, UDP, etc.) and dispatches them to the MessageHandler instance for processing. It handles message framing, validation, and error logging, providing a unified interface for remote control and telemetry.

Usage Example:

MessageDispatcher commMgr(handler, Serial);
while (true) {
commMgr.run();
}
Reads stream and forwards messages to handler.
Definition: MessageDispatcher.h:30

Member Function Documentation

◆ run()

virtual bool run ( )
inlinevirtual

Read messages from the stream and dispatch them to the vehicle for processing.


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