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
Enumerator
SERIAL_RX_BUFFER_SIZE 
SERIAL_TX_BUFFER_SIZE 

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

anonymous enum
Enumerator
SERIAL_RX_BUFFER_SIZE 
SERIAL_TX_BUFFER_SIZE 

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

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
inherited
Enumerator
ANS_OK 
ANS_TIMEOUT 
ANS_DEV_ERR 

Definition at line 44 of file abs_rxtx.h.

Constructor & Destructor Documentation

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

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

References _init().

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

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

References close().

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

Member Function Documentation

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().

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

Implements rp::hal::serial_rxtx.

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.

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

Implements rp::hal::serial_rxtx.

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

Implements rp::hal::serial_rxtx.

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().

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

Implements rp::hal::serial_rxtx.

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

Implements rp::hal::serial_rxtx.

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().

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

Implements rp::hal::serial_rxtx.

serial_rxtx * rp::hal::serial_rxtx::CreateRxTx ( )
staticinherited
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.

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

Implements rp::hal::serial_rxtx.

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

Implements rp::hal::serial_rxtx.

_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().

_u32 rp::arch::net::raw_serial::getTermBaudBitmap ( _u32  baud)
virtual bool rp::hal::serial_rxtx::isOpened ( )
inlinevirtualinherited
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().

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

Implements rp::hal::serial_rxtx.

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

Implements rp::hal::serial_rxtx.

bool rp::arch::net::raw_serial::open ( const char *  portname,
uint32_t  baudrate,
uint32_t  flags = 0 
)
protected
bool rp::arch::net::raw_serial::open ( const char *  portname,
uint32_t  baudrate,
uint32_t  flags = 0 
)
protected
bool rp::arch::net::raw_serial::open ( const char *  portname,
_u32  baudrate,
_u32  flags 
)
protected
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.

References rp::hal::serial_rxtx::isOpened().

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

Implements rp::hal::serial_rxtx.

void rp::hal::serial_rxtx::ReleaseRxTx ( serial_rxtx rxtx)
staticinherited
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.

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

Implements rp::hal::serial_rxtx.

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

Implements rp::hal::serial_rxtx.

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.

References rp::hal::serial_rxtx::isOpened().

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

Implements rp::hal::serial_rxtx.

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.

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

Implements rp::hal::serial_rxtx.

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

Implements rp::hal::serial_rxtx.

int rp::arch::net::raw_serial::waitfordata ( size_t  data_count,
_u32  timeout = -1,
size_t *  returned_size = NULL 
)
virtual
int rp::arch::net::raw_serial::waitfordata ( _word_size_t  data_count,
_u32  timeout = -1,
_word_size_t returned_size = NULL 
)
virtual
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.

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.

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.

References rp::hal::serial_rxtx::isOpened().

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

Implements rp::hal::serial_rxtx.

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.

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.

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

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().

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

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

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

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

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

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

Referenced by bind(), and open().

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().

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

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

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

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

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

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

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

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

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

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

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

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().

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().

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



Page generated by Doxygen 1.8.11 for MRPT 1.5.7 Git: 2190203 Tue May 15 02:01:15 2018 +0200 at miƩ may 16 12:40:16 CEST 2018