Main MRPT website > C++ reference for MRPT 1.5.7
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 41 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=NULL)
 
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=NULL)
 
virtual int waitforrecv (_u32 timeout=-1, size_t *returned_size=NULL)
 
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=NULL)
 
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=NULL)
 
virtual int waitforrecv (_u32 timeout=-1, _word_size_t *returned_size=NULL)
 
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=NULL)
 
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=NULL)
 
virtual int waitforrecv (_u32 timeout=-1, size_t *returned_size=NULL)
 
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 44 of file linux/net_serial.h.

◆ anonymous enum

anonymous enum
Enumerator
SERIAL_RX_BUFFER_SIZE 
SERIAL_TX_BUFFER_SIZE 

Definition at line 44 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 44 of file win32/net_serial.h.

◆ anonymous enum

anonymous enum
inherited
Enumerator
ANS_OK 
ANS_TIMEOUT 
ANS_DEV_ERR 

Definition at line 44 of file abs_rxtx.h.

Constructor & Destructor Documentation

◆ raw_serial() [1/3]

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

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

References _init().

◆ ~raw_serial() [1/3]

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

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

References close().

◆ 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

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

References _portName, required_rx_cnt, required_tx_cnt, and serial_fd.

Referenced by raw_serial().

◆ _init() [2/3]

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

◆ _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 62 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]

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

Implements rp::hal::serial_rxtx.

◆ clearDTR() [2/3]

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

Implements rp::hal::serial_rxtx.

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

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

Referenced by open().

◆ 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 133 of file linux/net_serial.cpp.

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

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

◆ 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

◆ flush() [1/3]

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

Implements rp::hal::serial_rxtx.

Definition at line 177 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 298 of file linux/net_serial.cpp.

References BAUD_CONV.

Referenced by open().

◆ getTermBaudBitmap() [2/2]

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

◆ isOpened()

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

◆ open() [1/6]

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

Implements rp::hal::serial_rxtx.

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

References _baudrate, _flags, and _portName.

Referenced by open().

◆ 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,
uint32_t  baudrate,
uint32_t  flags = 0 
)
protected

◆ open() [5/6]

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

◆ open() [6/6]

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

◆ recvdata() [1/3]

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

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

◆ recvdata() [2/3]

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

◆ recvdata() [3/3]

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

Implements rp::hal::serial_rxtx.

◆ ReleaseRxTx()

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

◆ rxqueue_count() [1/3]

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

Implements rp::hal::serial_rxtx.

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

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

◆ 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,
_word_size_t  size 
)
virtual

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

◆ senddata() [2/3]

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

◆ 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 273 of file linux/net_serial.cpp.

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

◆ 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 ( size_t  data_count,
_u32  timeout = -1,
size_t *  returned_size = NULL 
)
virtual

◆ waitfordata() [2/3]

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

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

References _word_size_t().

◆ waitfordata() [3/3]

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

Implements rp::hal::serial_rxtx.

◆ waitforrecv() [1/3]

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

Implements rp::hal::serial_rxtx.

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

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

◆ waitforrecv() [2/3]

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

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

◆ waitforrecv() [3/3]

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

Implements rp::hal::serial_rxtx.

◆ waitforsent() [1/3]

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

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

◆ waitforsent() [2/3]

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

Implements rp::hal::serial_rxtx.

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

References required_tx_cnt.

◆ waitforsent() [3/3]

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

Implements rp::hal::serial_rxtx.

Member Data Documentation

◆ _baudrate

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

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

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

◆ _co

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

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

◆ _dcb

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

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

◆ _flags

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

Definition at line 76 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 81 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 74 of file linux/net_serial.h.

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

◆ _ro

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

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

◆ _serial_handle

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

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

◆ _wait_o

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

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

◆ _wo

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

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

◆ required_rx_cnt

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

Definition at line 81 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 80 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.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019