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

Message handler that writes all received messages as raw binary to a Print stream. More...

#include <MessageHandlerPrint.h>

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

Public Member Functions

 MessageHandlerBinary (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
 
void setOutput (Print &printer)
 
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 writes all received messages as raw binary to a Print stream.

This class implements the MessageHandler interface and outputs the content of all received messages (float, Coordinate<float>, GPSCoordinate) as raw binary data to the provided Print object (e.g., Serial, file, etc).

Example usage:

MessageHandlerBinary printer(Serial);
source.subscribe(printer);
Message handler that writes all received messages as raw binary to a Print stream.
Definition: MessageHandlerPrint.h:91

This is useful for efficient logging, binary protocols, or communication with systems that expect binary-encoded messages.

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: