template_pkg  1.0.0
A template ROS2 Package
Loading...
Searching...
No Matches
roship_io::transport::LspSerial Class Reference

A class for serial communication using libserialport. More...

#include <lsp_serial.hpp>

Inheritance diagram for roship_io::transport::LspSerial:
Collaboration diagram for roship_io::transport::LspSerial:

Classes

struct  Params
 Configuration parameters for the serial connection. More...
 

Public Types

using byte = uint8_t
 
using MessageCallback = std::function<void(const std::vector<byte>&)>
 

Public Member Functions

 LspSerial (Params params)
 Constructor for LspSerial.
 
 ~LspSerial ()
 Destructor for LspSerial.
 
void send (const std::vector< byte > &message) override
 Send a message over the serial connection.
 
void spinOnce () override
 does nothing, legacy from asio boost implementation.
 
void addCallback (const MessageCallback &callback) override
 Set the callback function for received messages.
 

Detailed Description

A class for serial communication using libserialport.

This class provides an interface for serial communication using the libserialport library. It implements the TransportInterface for sending and receiving messages over a serial connection.

Member Typedef Documentation

◆ byte

◆ MessageCallback

using roship_io::transport::LspSerial::MessageCallback = std::function<void(const std::vector<byte>&)>

Constructor & Destructor Documentation

◆ LspSerial()

TRANSPORT_NS_HEAD LspSerial::LspSerial ( Params params)

Constructor for LspSerial.

Parameters
paramsConfiguration parameters for the serial connection.

◆ ~LspSerial()

LspSerial::~LspSerial ( )

Destructor for LspSerial.

Member Function Documentation

◆ addCallback()

void LspSerial::addCallback ( const MessageCallback & callback)
overridevirtual

Set the callback function for received messages.

Implements roship_io::transport::TransportInterface.

◆ send()

void LspSerial::send ( const std::vector< byte > & message)
overridevirtual

Send a message over the serial connection.

Implements roship_io::transport::TransportInterface.

◆ spinOnce()

void LspSerial::spinOnce ( )
overridevirtual

does nothing, legacy from asio boost implementation.

Implements roship_io::transport::TransportInterface.


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