Public Member Functions | Private Attributes | List of all members
sl::SerialPortChannel Class Reference
Inheritance diagram for sl::SerialPortChannel:
Inheritance graph
[legend]

Public Member Functions

bool bind (const std::string &device, sl_s32 baudrate)
 
void clearReadCache ()
 
void close ()
 
void flush ()
 
int getChannelType ()
 
bool open ()
 
int read (void *buffer, size_t size)
 
 SerialPortChannel (const std::string &device, int baudrate)
 
void setDTR (bool dtr)
 
bool waitForData (size_t size, sl_u32 timeoutInMs, size_t *actualReady)
 
sl_result waitForDataExt (size_t &size_hint, sl_u32 timeoutInMs)
 
int write (const void *data, size_t size)
 
 ~SerialPortChannel ()
 
- Public Member Functions inherited from sl::ISerialPortChannel
virtual ~ISerialPortChannel ()
 
- Public Member Functions inherited from sl::IChannel
virtual ~IChannel ()
 

Private Attributes

int _baudrate
 
bool _closePending
 
std::string _device
 
rp::hal::serial_rxtx_rxtxSerial
 

Detailed Description

Definition at line 40 of file sl_serial_channel.cpp.

Constructor & Destructor Documentation

◆ SerialPortChannel()

sl::SerialPortChannel::SerialPortChannel ( const std::string &  device,
int  baudrate 
)
inline

Definition at line 43 of file sl_serial_channel.cpp.

◆ ~SerialPortChannel()

sl::SerialPortChannel::~SerialPortChannel ( )
inline

Definition at line 49 of file sl_serial_channel.cpp.

Member Function Documentation

◆ bind()

bool sl::SerialPortChannel::bind ( const std::string &  device,
sl_s32  baudrate 
)
inline

Definition at line 55 of file sl_serial_channel.cpp.

◆ clearReadCache()

void sl::SerialPortChannel::clearReadCache ( )
inlinevirtual

Clear read cache

Implements sl::IChannel.

Definition at line 119 of file sl_serial_channel.cpp.

◆ close()

void sl::SerialPortChannel::close ( )
inlinevirtual

Close communication channel

Implements sl::IChannel.

Definition at line 68 of file sl_serial_channel.cpp.

◆ flush()

void sl::SerialPortChannel::flush ( )
inlinevirtual

Flush all written data to remote endpoint

Implements sl::IChannel.

Definition at line 74 of file sl_serial_channel.cpp.

◆ getChannelType()

int sl::SerialPortChannel::getChannelType ( )
inlinevirtual

Implements sl::IChannel.

Definition at line 129 of file sl_serial_channel.cpp.

◆ open()

bool sl::SerialPortChannel::open ( )
inlinevirtual

Open communication channel (return true if succeed)

Implements sl::IChannel.

Definition at line 61 of file sl_serial_channel.cpp.

◆ read()

int sl::SerialPortChannel::read ( void *  buffer,
size_t  size 
)
inlinevirtual

Read data from the chanel

Parameters
bufferThe buffer to receive data
sizeThe size of the read buffer
Returns
Bytes read (negative for read failure)

Implements sl::IChannel.

Definition at line 112 of file sl_serial_channel.cpp.

◆ setDTR()

void sl::SerialPortChannel::setDTR ( bool  dtr)
inlinevirtual

Implements sl::ISerialPortChannel.

Definition at line 124 of file sl_serial_channel.cpp.

◆ waitForData()

bool sl::SerialPortChannel::waitForData ( size_t  size,
sl_u32  timeoutInMs,
size_t *  actualReady 
)
inlinevirtual

Wait for some data

Parameters
sizeBytes to wait
timeoutInMsWait timeout (in microseconds, -1 for forever)
actualReady[out] actual ready bytes
Returns
true for data ready

Implements sl::IChannel.

Definition at line 101 of file sl_serial_channel.cpp.

◆ waitForDataExt()

sl_result sl::SerialPortChannel::waitForDataExt ( size_t &  size_hint,
sl_u32  timeoutInMs 
)
inlinevirtual

Wait for some data

Parameters
size_hintByte count may available to retrieve without beening blocked
timeoutInMsWait timeout (in microseconds, -1 for forever)
Returns
RESULT_OK if there is data available for receiving RESULT_OPERATION_TIMEOUT if the given timeout duration is exceed RESULT_OPERATION_FAIL if there is something wrong with the channel

Implements sl::IChannel.

Definition at line 79 of file sl_serial_channel.cpp.

◆ write()

int sl::SerialPortChannel::write ( const void *  data,
size_t  size 
)
inlinevirtual

Send data to remote endpoint

Parameters
dataThe data buffer
sizeThe size of data buffer (in bytes)
Returns
Bytes written (negative for write failure)

Implements sl::IChannel.

Definition at line 107 of file sl_serial_channel.cpp.

Member Data Documentation

◆ _baudrate

int sl::SerialPortChannel::_baudrate
private

Definition at line 137 of file sl_serial_channel.cpp.

◆ _closePending

bool sl::SerialPortChannel::_closePending
private

Definition at line 135 of file sl_serial_channel.cpp.

◆ _device

std::string sl::SerialPortChannel::_device
private

Definition at line 136 of file sl_serial_channel.cpp.

◆ _rxtxSerial

rp::hal::serial_rxtx* sl::SerialPortChannel::_rxtxSerial
private

Definition at line 134 of file sl_serial_channel.cpp.


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


rplidar_ros
Author(s):
autogenerated on Fri Aug 2 2024 08:42:14