Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
rp::arch::net::raw_serial Class Reference

Detailed Description

Definition at line 44 of file linux/net_serial.h.

#include <rplidar/src/arch/linux/net_serial.h>

Inheritance diagram for rp::arch::net::raw_serial:
Inheritance graph

Public Types

enum  { SERIAL_RX_BUFFER_SIZE = 512, SERIAL_TX_BUFFER_SIZE = 128 }
 
enum  { SERIAL_RX_BUFFER_SIZE = 512, SERIAL_TX_BUFFER_SIZE = 128 }
 
enum  { SERIAL_RX_BUFFER_SIZE = 512, SERIAL_TX_BUFFER_SIZE = 128, SERIAL_RX_TIMEOUT = 2000, SERIAL_TX_TIMEOUT = 2000 }
 
enum  { ANS_OK = 0, ANS_TIMEOUT = -1, ANS_DEV_ERR = -2 }
 

Public Member Functions

 raw_serial ()
 
virtual ~raw_serial ()
 
virtual bool bind (const char *portname, uint32_t baudrate, uint32_t flags=0)
 
virtual bool open ()
 
virtual void close ()
 
virtual void flush (_u32 flags)
 
virtual int waitfordata (size_t data_count, _u32 timeout=-1, size_t *returned_size=nullptr)
 
virtual int senddata (const unsigned char *data, size_t size)
 
virtual int recvdata (unsigned char *data, size_t size)
 
virtual int waitforsent (_u32 timeout=-1, size_t *returned_size=nullptr)
 
virtual int waitforrecv (_u32 timeout=-1, size_t *returned_size=nullptr)
 
virtual size_t rxqueue_count ()
 
virtual void setDTR ()
 
virtual void clearDTR ()
 
_u32 getTermBaudBitmap (_u32 baud)
 
 raw_serial ()
 
virtual ~raw_serial ()
 
virtual bool bind (const char *portname, uint32_t baudrate, uint32_t flags=0)
 
virtual bool open ()
 
virtual void close ()
 
virtual void flush (_u32 flags)
 
virtual int waitfordata (_word_size_t data_count, _u32 timeout=-1, _word_size_t *returned_size=nullptr)
 
virtual int senddata (const unsigned char *data, _word_size_t size)
 
virtual int recvdata (unsigned char *data, _word_size_t size)
 
virtual int waitforsent (_u32 timeout=-1, _word_size_t *returned_size=nullptr)
 
virtual int waitforrecv (_u32 timeout=-1, _word_size_t *returned_size=nullptr)
 
virtual size_t rxqueue_count ()
 
virtual void setDTR ()
 
virtual void clearDTR ()
 
_u32 getTermBaudBitmap (_u32 baud)
 
 raw_serial ()
 
virtual ~raw_serial ()
 
virtual bool bind (const char *portname, _u32 baudrate, _u32 flags=0)
 
virtual bool open ()
 
virtual void close ()
 
virtual void flush (_u32 flags)
 
virtual int waitfordata (size_t data_count, _u32 timeout=-1, size_t *returned_size=nullptr)
 
virtual int senddata (const unsigned char *data, size_t size)
 
virtual int recvdata (unsigned char *data, size_t size)
 
virtual int waitforsent (_u32 timeout=-1, size_t *returned_size=nullptr)
 
virtual int waitforrecv (_u32 timeout=-1, size_t *returned_size=nullptr)
 
virtual size_t rxqueue_count ()
 
virtual void setDTR ()
 
virtual void clearDTR ()
 
virtual bool isOpened ()
 

Static Public Member Functions

static serial_rxtxCreateRxTx ()
 
static void ReleaseRxTx (serial_rxtx *)
 

Protected Member Functions

bool open (const char *portname, uint32_t baudrate, uint32_t flags=0)
 
void _init ()
 
bool open (const char *portname, uint32_t baudrate, uint32_t flags=0)
 
void _init ()
 
bool open (const char *portname, _u32 baudrate, _u32 flags)
 
void _init ()
 

Protected Attributes

char _portName [200]
 
uint32_t _baudrate
 
uint32_t _flags
 
int serial_fd
 
size_t required_tx_cnt
 
size_t required_rx_cnt
 
OVERLAPPED _ro
 
OVERLAPPED _wo
 
OVERLAPPED _wait_o
 
volatile HANDLE _serial_handle
 
DCB _dcb
 
COMMTIMEOUTS _co
 
volatile bool _is_serial_opened
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
SERIAL_RX_BUFFER_SIZE 
SERIAL_TX_BUFFER_SIZE 

Definition at line 47 of file linux/net_serial.h.

◆ anonymous enum

anonymous enum
Enumerator
SERIAL_RX_BUFFER_SIZE 
SERIAL_TX_BUFFER_SIZE 

Definition at line 47 of file macOS/net_serial.h.

◆ anonymous enum

anonymous enum
Enumerator
SERIAL_RX_BUFFER_SIZE 
SERIAL_TX_BUFFER_SIZE 
SERIAL_RX_TIMEOUT 
SERIAL_TX_TIMEOUT 

Definition at line 47 of file win32/net_serial.h.

◆ anonymous enum

anonymous enum
inherited
Enumerator
ANS_OK 
ANS_TIMEOUT 
ANS_DEV_ERR 

Definition at line 45 of file abs_rxtx.h.

Constructor & Destructor Documentation

◆ raw_serial() [1/3]

rp::arch::net::raw_serial::raw_serial ( )

Definition at line 45 of file linux/net_serial.cpp.

References _init().

Here is the call graph for this function:

◆ ~raw_serial() [1/3]

rp::arch::net::raw_serial::~raw_serial ( )
virtual

Definition at line 51 of file linux/net_serial.cpp.

References close().

Here is the call graph for this function:

◆ raw_serial() [2/3]

rp::arch::net::raw_serial::raw_serial ( )

◆ ~raw_serial() [2/3]

virtual rp::arch::net::raw_serial::~raw_serial ( )
virtual

◆ raw_serial() [3/3]

rp::arch::net::raw_serial::raw_serial ( )

◆ ~raw_serial() [3/3]

virtual rp::arch::net::raw_serial::~raw_serial ( )
virtual

Member Function Documentation

◆ _init() [1/3]

void rp::arch::net::raw_serial::_init ( )
protected

◆ _init() [2/3]

void rp::arch::net::raw_serial::_init ( )
protected

Definition at line 275 of file linux/net_serial.cpp.

References _portName, required_rx_cnt, required_tx_cnt, and serial_fd.

Referenced by raw_serial().

Here is the caller graph for this function:

◆ _init() [3/3]

void rp::arch::net::raw_serial::_init ( )
protected

◆ bind() [1/3]

virtual bool rp::arch::net::raw_serial::bind ( const char *  portname,
uint32_t  baudrate,
uint32_t  flags = 0 
)
virtual

Implements rp::hal::serial_rxtx.

◆ bind() [2/3]

bool rp::arch::net::raw_serial::bind ( const char *  portname,
uint32_t  baudrate,
uint32_t  flags = 0 
)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 53 of file linux/net_serial.cpp.

References _baudrate, _flags, and _portName.

◆ bind() [3/3]

virtual bool rp::arch::net::raw_serial::bind ( const char *  portname,
_u32  baudrate,
_u32  flags = 0 
)
virtual

Implements rp::hal::serial_rxtx.

◆ clearDTR() [1/3]

void rp::arch::net::raw_serial::clearDTR ( )
virtual

Implements rp::hal::serial_rxtx.

Definition at line 267 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::isOpened(), and serial_fd.

Referenced by open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearDTR() [2/3]

virtual void rp::arch::net::raw_serial::clearDTR ( )
virtual

Implements rp::hal::serial_rxtx.

◆ clearDTR() [3/3]

virtual void rp::arch::net::raw_serial::clearDTR ( )
virtual

Implements rp::hal::serial_rxtx.

◆ close() [1/3]

virtual void rp::arch::net::raw_serial::close ( )
virtual

Implements rp::hal::serial_rxtx.

◆ close() [2/3]

void rp::arch::net::raw_serial::close ( )
virtual

Implements rp::hal::serial_rxtx.

Definition at line 124 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::_is_serial_opened, and serial_fd.

Referenced by open(), and ~raw_serial().

Here is the caller graph for this function:

◆ close() [3/3]

virtual void rp::arch::net::raw_serial::close ( )
virtual

Implements rp::hal::serial_rxtx.

◆ CreateRxTx()

serial_rxtx * rp::hal::serial_rxtx::CreateRxTx ( )
staticinherited

Definition at line 319 of file linux/net_serial.cpp.

Referenced by rp::standalone::rplidar::RPlidarDriverSerialImpl::RPlidarDriverSerialImpl().

Here is the caller graph for this function:

◆ flush() [1/3]

void rp::arch::net::raw_serial::flush ( _u32  flags)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 165 of file linux/net_serial.cpp.

References serial_fd.

◆ flush() [2/3]

virtual void rp::arch::net::raw_serial::flush ( _u32  flags)
virtual

Implements rp::hal::serial_rxtx.

◆ flush() [3/3]

virtual void rp::arch::net::raw_serial::flush ( _u32  flags)
virtual

Implements rp::hal::serial_rxtx.

◆ getTermBaudBitmap() [1/2]

_u32 rp::arch::net::raw_serial::getTermBaudBitmap ( _u32  baud)

Definition at line 282 of file linux/net_serial.cpp.

References BAUD_CONV.

Referenced by open().

Here is the caller graph for this function:

◆ getTermBaudBitmap() [2/2]

_u32 rp::arch::net::raw_serial::getTermBaudBitmap ( _u32  baud)

◆ isOpened()

virtual bool rp::hal::serial_rxtx::isOpened ( )
inlinevirtualinherited

Definition at line 80 of file abs_rxtx.h.

References rp::hal::serial_rxtx::_is_serial_opened.

Referenced by clearDTR(), open(), recvdata(), rxqueue_count(), senddata(), setDTR(), waitfordata(), and waitforrecv().

Here is the caller graph for this function:

◆ open() [1/6]

bool rp::arch::net::raw_serial::open ( )
virtual

Implements rp::hal::serial_rxtx.

Definition at line 52 of file linux/net_serial.cpp.

References _baudrate, _flags, and _portName.

Referenced by open().

Here is the caller graph for this function:

◆ open() [2/6]

virtual bool rp::arch::net::raw_serial::open ( )
virtual

Implements rp::hal::serial_rxtx.

◆ open() [3/6]

virtual bool rp::arch::net::raw_serial::open ( )
virtual

Implements rp::hal::serial_rxtx.

◆ open() [4/6]

bool rp::arch::net::raw_serial::open ( const char *  portname,
_u32  baudrate,
_u32  flags 
)
protected

◆ open() [5/6]

bool rp::arch::net::raw_serial::open ( const char *  portname,
uint32_t  baudrate,
uint32_t  flags = 0 
)
protected

Definition at line 61 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::_is_serial_opened, clearDTR(), close(), getTermBaudBitmap(), rp::hal::serial_rxtx::isOpened(), open(), and serial_fd.

Here is the call graph for this function:

◆ open() [6/6]

bool rp::arch::net::raw_serial::open ( const char *  portname,
uint32_t  baudrate,
uint32_t  flags = 0 
)
protected

◆ recvdata() [1/3]

int rp::arch::net::raw_serial::recvdata ( unsigned char *  data,
size_t  size 
)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 154 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::isOpened(), required_rx_cnt, and serial_fd.

Here is the call graph for this function:

◆ recvdata() [2/3]

virtual int rp::arch::net::raw_serial::recvdata ( unsigned char *  data,
size_t  size 
)
virtual

Implements rp::hal::serial_rxtx.

◆ recvdata() [3/3]

int rp::arch::net::raw_serial::recvdata ( unsigned char *  data,
_word_size_t  size 
)
virtual

Definition at line 155 of file macOS/net_serial.cpp.

◆ ReleaseRxTx()

void rp::hal::serial_rxtx::ReleaseRxTx ( serial_rxtx rxtx)
staticinherited

Definition at line 324 of file linux/net_serial.cpp.

Referenced by rp::standalone::rplidar::RPlidarDriverSerialImpl::~RPlidarDriverSerialImpl().

Here is the caller graph for this function:

◆ rxqueue_count() [1/3]

size_t rp::arch::net::raw_serial::rxqueue_count ( )
virtual

Implements rp::hal::serial_rxtx.

Definition at line 250 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::isOpened(), and serial_fd.

Here is the call graph for this function:

◆ rxqueue_count() [2/3]

virtual size_t rp::arch::net::raw_serial::rxqueue_count ( )
virtual

Implements rp::hal::serial_rxtx.

◆ rxqueue_count() [3/3]

virtual size_t rp::arch::net::raw_serial::rxqueue_count ( )
virtual

Implements rp::hal::serial_rxtx.

◆ senddata() [1/3]

int rp::arch::net::raw_serial::senddata ( const unsigned char *  data,
size_t  size 
)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 132 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::isOpened(), required_tx_cnt, and serial_fd.

Here is the call graph for this function:

◆ senddata() [2/3]

int rp::arch::net::raw_serial::senddata ( const unsigned char *  data,
_word_size_t  size 
)
virtual

Definition at line 133 of file macOS/net_serial.cpp.

◆ senddata() [3/3]

virtual int rp::arch::net::raw_serial::senddata ( const unsigned char *  data,
size_t  size 
)
virtual

Implements rp::hal::serial_rxtx.

◆ setDTR() [1/3]

void rp::arch::net::raw_serial::setDTR ( )
virtual

Implements rp::hal::serial_rxtx.

Definition at line 259 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::isOpened(), and serial_fd.

Here is the call graph for this function:

◆ setDTR() [2/3]

virtual void rp::arch::net::raw_serial::setDTR ( )
virtual

Implements rp::hal::serial_rxtx.

◆ setDTR() [3/3]

virtual void rp::arch::net::raw_serial::setDTR ( )
virtual

Implements rp::hal::serial_rxtx.

◆ waitfordata() [1/3]

int rp::arch::net::raw_serial::waitfordata ( _word_size_t  data_count,
_u32  timeout = -1,
_word_size_t *  returned_size = nullptr 
)
virtual

Definition at line 181 of file macOS/net_serial.cpp.

◆ waitfordata() [2/3]

int rp::arch::net::raw_serial::waitfordata ( size_t  data_count,
_u32  timeout = -1,
size_t *  returned_size = nullptr 
)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 180 of file linux/net_serial.cpp.

References _baudrate, rp::hal::serial_rxtx::ANS_DEV_ERR, rp::hal::serial_rxtx::ANS_TIMEOUT, rp::hal::serial_rxtx::isOpened(), and serial_fd.

Here is the call graph for this function:

◆ waitfordata() [3/3]

virtual int rp::arch::net::raw_serial::waitfordata ( size_t  data_count,
_u32  timeout = -1,
size_t *  returned_size = nullptr 
)
virtual

Implements rp::hal::serial_rxtx.

◆ waitforrecv() [1/3]

int rp::arch::net::raw_serial::waitforrecv ( _u32  timeout = -1,
size_t *  returned_size = nullptr 
)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 172 of file linux/net_serial.cpp.

References rp::hal::serial_rxtx::isOpened(), and required_rx_cnt.

Here is the call graph for this function:

◆ waitforrecv() [2/3]

virtual int rp::arch::net::raw_serial::waitforrecv ( _u32  timeout = -1,
size_t *  returned_size = nullptr 
)
virtual

Implements rp::hal::serial_rxtx.

◆ waitforrecv() [3/3]

int rp::arch::net::raw_serial::waitforrecv ( _u32  timeout = -1,
_word_size_t *  returned_size = nullptr 
)
virtual

Definition at line 173 of file macOS/net_serial.cpp.

◆ waitforsent() [1/3]

int rp::arch::net::raw_serial::waitforsent ( _u32  timeout = -1,
size_t *  returned_size = nullptr 
)
virtual

Implements rp::hal::serial_rxtx.

Definition at line 166 of file linux/net_serial.cpp.

References required_tx_cnt.

◆ waitforsent() [2/3]

int rp::arch::net::raw_serial::waitforsent ( _u32  timeout = -1,
_word_size_t *  returned_size = nullptr 
)
virtual

Definition at line 167 of file macOS/net_serial.cpp.

◆ waitforsent() [3/3]

virtual int rp::arch::net::raw_serial::waitforsent ( _u32  timeout = -1,
size_t *  returned_size = nullptr 
)
virtual

Implements rp::hal::serial_rxtx.

Member Data Documentation

◆ _baudrate

uint32_t rp::arch::net::raw_serial::_baudrate
protected

Definition at line 82 of file linux/net_serial.h.

Referenced by bind(), open(), and waitfordata().

◆ _co

COMMTIMEOUTS rp::arch::net::raw_serial::_co
protected

Definition at line 88 of file win32/net_serial.h.

◆ _dcb

DCB rp::arch::net::raw_serial::_dcb
protected

Definition at line 87 of file win32/net_serial.h.

◆ _flags

uint32_t rp::arch::net::raw_serial::_flags
protected

Definition at line 83 of file linux/net_serial.h.

Referenced by bind(), and open().

◆ _is_serial_opened

volatile bool rp::hal::serial_rxtx::_is_serial_opened
protectedinherited

Definition at line 82 of file abs_rxtx.h.

Referenced by close(), rp::hal::serial_rxtx::isOpened(), and open().

◆ _portName

char rp::arch::net::raw_serial::_portName
protected

Definition at line 81 of file linux/net_serial.h.

Referenced by _init(), bind(), and open().

◆ _ro

OVERLAPPED rp::arch::net::raw_serial::_ro
protected

Definition at line 84 of file win32/net_serial.h.

◆ _serial_handle

volatile HANDLE rp::arch::net::raw_serial::_serial_handle
protected

Definition at line 86 of file win32/net_serial.h.

◆ _wait_o

OVERLAPPED rp::arch::net::raw_serial::_wait_o
protected

Definition at line 85 of file win32/net_serial.h.

◆ _wo

OVERLAPPED rp::arch::net::raw_serial::_wo
protected

Definition at line 84 of file win32/net_serial.h.

◆ required_rx_cnt

size_t rp::arch::net::raw_serial::required_rx_cnt
protected

Definition at line 88 of file linux/net_serial.h.

Referenced by _init(), recvdata(), and waitforrecv().

◆ required_tx_cnt

size_t rp::arch::net::raw_serial::required_tx_cnt
protected

Definition at line 87 of file linux/net_serial.h.

Referenced by _init(), senddata(), and waitforsent().

◆ serial_fd

int rp::arch::net::raw_serial::serial_fd
protected



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019