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

Message handler that prints all received messages to a Print stream. More...

#include <MessageHandlerPrint.h>

Inheritance diagram for MessageHandlerPrint:
Inheritance graph
[legend]
Collaboration diagram for MessageHandlerPrint:
Collaboration graph
[legend]

Public Member Functions

 MessageHandlerPrint (Print &printer)
 
void setOutput (Print &printer)
 
bool onMessage (const Message< float > &msg) override
 Handle an incoming message (pure virtual).
 
bool onMessage (const Message< Coordinate< float > > &msg) override
 
bool onMessage (const Message< GPSCoordinate > &msg) override
 
bool onMessage (const Message< MotionState3D > &msg) override
 
virtual bool onMessage (const Message< float > &msg)=0
 Handle an incoming message (pure virtual).
 
virtual bool onMessage (const Message< Coordinate< float > > &msg)
 
virtual bool onMessage (const Message< GPSCoordinate > &msg)
 
virtual bool onMessage (const Message< MotionState3D > &msg)
 

Protected Attributes

Print & printer_
 

Detailed Description

Message handler that prints all received messages to a Print stream.

This class implements the MessageHandler interface and outputs the content of all received messages (float, Coordinate<float>, GPSCoordinate) in a human-readable format to the provided Print object (e.g., Serial, file, etc). It uses string arrays to print the message type, unit, and source as readable text.

Example usage:

MessageHandlerPrint printer(Serial);
source.subscribe(printer);
Message handler that prints all received messages to a Print stream.
Definition: MessageHandlerPrint.h:140

This is useful for debugging, logging, or monitoring message traffic in a robotics system.

Member Function Documentation

◆ onMessage() [1/4]

bool onMessage ( const Message< Coordinate< float > > &  msg)
inlineoverridevirtual

Reimplemented from MessageHandler.

◆ onMessage() [2/4]

bool onMessage ( const Message< float > &  msg)
inlineoverridevirtual

Handle an incoming message (pure virtual).

This method should be implemented by derived classes to process messages.

Parameters
msgThe message to handle.
Returns
true if the message was handled successfully, false otherwise.

Implements MessageHandler.

◆ onMessage() [3/4]

bool onMessage ( const Message< GPSCoordinate > &  msg)
inlineoverridevirtual

Reimplemented from MessageHandler.

◆ onMessage() [4/4]

bool onMessage ( const Message< MotionState3D > &  msg)
inlineoverridevirtual

Reimplemented from MessageHandler.


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