Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
SerialPort Class Reference

#include <ser.h>

Public Member Functions

void close_port (void)
 
void flush (void)
 
int is_ok (void)
 
int read_frame (unsigned char *data)
 
void recv_proc (void)
 
 SerialPort (const char *port, int baud, int que_num, int que_maxlen)
 
int write_frame (unsigned char *data, int len)
 
 ~SerialPort (void)
 

Public Attributes

int que_maxlen_
 
int que_num_
 
serial::Serial ser
 

Private Types

enum  _UXBUS_RECV_STATE {
  UXBUS_START_FROMID = 0, UXBUS_START_TOOID = 1, UXBUS_STATE_LENGTH = 2, UXBUS_STATE_DATA = 3,
  UXBUS_STATE_CRC1 = 4, UXBUS_STATE_CRC2 = 5
}
 
typedef enum SerialPort::_UXBUS_RECV_STATE UXBUS_RECV_STATE
 

Private Member Functions

int init_serial (const char *port, int baud)
 
void parse_put (unsigned char *data, int len)
 
int read_char (unsigned char *ch)
 
int write_char (unsigned char ch)
 

Private Attributes

int fp_
 
unsigned char rx_buf_ [128]
 
int rx_data_idx_
 
int rx_length_
 
QueueMemcpyrx_que_
 
int rx_state_
 
int state_
 
std::thread thread_id_
 
unsigned char UXBUS_PROT_FROMID_
 
unsigned char UXBUS_PROT_TOID_
 

Detailed Description

Definition at line 17 of file ser.h.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
UXBUS_START_FROMID 
UXBUS_START_TOOID 
UXBUS_STATE_LENGTH 
UXBUS_STATE_DATA 
UXBUS_STATE_CRC1 
UXBUS_STATE_CRC2 

Definition at line 42 of file ser.h.

Constructor & Destructor Documentation

SerialPort::SerialPort ( const char *  port,
int  baud,
int  que_num,
int  que_maxlen 
)

Definition at line 52 of file ser.cc.

SerialPort::~SerialPort ( void  )

Definition at line 80 of file ser.cc.

Member Function Documentation

void SerialPort::close_port ( void  )

Definition at line 141 of file ser.cc.

void SerialPort::flush ( void  )

Definition at line 87 of file ser.cc.

int SerialPort::init_serial ( const char *  port,
int  baud 
)
private

Definition at line 220 of file ser.cc.

int SerialPort::is_ok ( void  )

Definition at line 85 of file ser.cc.

void SerialPort::parse_put ( unsigned char *  data,
int  len 
)
private

Definition at line 149 of file ser.cc.

int SerialPort::read_char ( unsigned char *  ch)
private

Definition at line 93 of file ser.cc.

int SerialPort::read_frame ( unsigned char *  data)

Definition at line 105 of file ser.cc.

void SerialPort::recv_proc ( void  )

Definition at line 26 of file ser.cc.

int SerialPort::write_char ( unsigned char  ch)
private

Definition at line 114 of file ser.cc.

int SerialPort::write_frame ( unsigned char *  data,
int  len 
)

Definition at line 125 of file ser.cc.

Member Data Documentation

int SerialPort::fp_
private

Definition at line 32 of file ser.h.

int SerialPort::que_maxlen_

Definition at line 28 of file ser.h.

int SerialPort::que_num_

Definition at line 29 of file ser.h.

unsigned char SerialPort::rx_buf_[128]
private

Definition at line 56 of file ser.h.

int SerialPort::rx_data_idx_
private

Definition at line 54 of file ser.h.

int SerialPort::rx_length_
private

Definition at line 57 of file ser.h.

QueueMemcpy* SerialPort::rx_que_
private

Definition at line 36 of file ser.h.

int SerialPort::rx_state_
private

Definition at line 55 of file ser.h.

serial::Serial SerialPort::ser

Definition at line 21 of file ser.h.

int SerialPort::state_
private

Definition at line 33 of file ser.h.

std::thread SerialPort::thread_id_
private

Definition at line 34 of file ser.h.

unsigned char SerialPort::UXBUS_PROT_FROMID_
private

Definition at line 51 of file ser.h.

unsigned char SerialPort::UXBUS_PROT_TOID_
private

Definition at line 52 of file ser.h.


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


xarm_api
Author(s):
autogenerated on Sat May 8 2021 02:51:23