ros2_rover
Loading...
Searching...
No Matches
lx16a::Serial Class Reference

#include <serial.hpp>

Collaboration diagram for lx16a::Serial:

Public Member Functions

 Serial (std::string device_name, unsigned int baud_rate)
 
bool connect ()
 
bool read (unsigned char &receive_data)
 
bool read_with_timeout (unsigned char &receive_data, int timeout=3)
 
void time_out (const boost::system::error_code &error)
 
void read_complete (bool &read_error, const boost::system::error_code &error, size_t bytes_transferred)
 
bool write (unsigned char &data)
 
bool write (const std::vector< uint8_t > &data)
 

Private Attributes

std::string device_name
 
unsigned int baud_rate
 
std::unique_ptr< boost::asio::io_service > io_service
 
std::unique_ptr< boost::asio::serial_port > serial_port
 
std::unique_ptr< boost::asio::deadline_timer > timer
 

Constructor & Destructor Documentation

◆ Serial()

Serial::Serial ( std::string device_name,
unsigned int baud_rate )

Member Function Documentation

◆ connect()

bool Serial::connect ( )

◆ read()

bool Serial::read ( unsigned char & receive_data)

◆ read_complete()

void Serial::read_complete ( bool & read_error,
const boost::system::error_code & error,
size_t bytes_transferred )

◆ read_with_timeout()

bool Serial::read_with_timeout ( unsigned char & receive_data,
int timeout = 3 )

◆ time_out()

void Serial::time_out ( const boost::system::error_code & error)

◆ write() [1/2]

bool Serial::write ( const std::vector< uint8_t > & data)

◆ write() [2/2]

bool Serial::write ( unsigned char & data)

Member Data Documentation

◆ baud_rate

unsigned int lx16a::Serial::baud_rate
private

◆ device_name

std::string lx16a::Serial::device_name
private

◆ io_service

std::unique_ptr<boost::asio::io_service> lx16a::Serial::io_service
private

◆ serial_port

std::unique_ptr<boost::asio::serial_port> lx16a::Serial::serial_port
private

◆ timer

std::unique_ptr<boost::asio::deadline_timer> lx16a::Serial::timer
private

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