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

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

#include <MessageHandlerPrint.h>

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

Public Member Functions

 MessageHandlerPrintXML (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 as XML to a Print stream.

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

Example usage:

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

This is useful for logging, exporting, or integrating message traffic with systems that consume XML data.

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: