![]() |
YDLIDAR X2 SDK
V1.4.1
|
Classes | |
class | MillisecondTimer |
struct | PortInfo |
class | Serial |
struct | termios2 |
struct | Timeout |
Enumerations | |
enum | bytesize_t { fivebits = 5, sixbits = 6, sevenbits = 7, eightbits = 8 } |
enum | parity_t { parity_none = 0, parity_odd = 1, parity_even = 2, parity_mark = 3, parity_space = 4 } |
enum | stopbits_t { stopbits_one = 1, stopbits_two = 2, stopbits_one_point_five } |
enum | flowcontrol_t { flowcontrol_none = 0, flowcontrol_software, flowcontrol_hardware } |
Functions | |
std::vector< PortInfo > | list_ports () |
timespec | timespec_from_ms (const uint32_t millis) |
setup_port - Configure the port, eg. baud rate, data bits,etc.
fd | : The serial port |
speed | : The baud rate |
data_bits | : The data bits |
parity | : The parity bits |
stop_bits | : The stop bits |
Member Description c_cflag Control options c_lflag Line options c_iflag Input options c_oflag Output options c_cc Control characters c_ispeed Input baud (new interface) c_ospeed Output baud (new interface)The c_cflag member controls the baud rate, number of data bits, parity, stop bits, and hardware flow control. There are constants for all of the supported configurations. Constant Description
CBAUD Bit mask for baud rate B0 0 baud (drop DTR) B50 50 baud B75 75 baud B110 110 baud B134 134.5 baud B150 150 baud B200 200 baud B300 300 baud B600 600 baud B1200 1200 baud B1800 1800 baud B2400 2400 baud B4800 4800 baud B9600 9600 baud B19200 19200 baud B38400 38400 baud B57600 57,600 baud B76800 76,800 baud B115200 115,200 baud EXTA External rate clock EXTB External rate clock CSIZE Bit mask for data bits CS5 5 data bits CS6 6 data bits CS7 7 data bits CS8 8 data bits CSTOPB 2 stop bits (1 otherwise) CREAD Enable receiver PARENB Enable parity bit PARODD Use odd parity instead of even HUPCL Hangup (drop DTR) on last close CLOCAL Local line - do not change "owner" of port LOBLK Block job control output CNEW_RTSCTS CRTSCTS Enable hardware flow control (not supported on all platforms)The input modes member c_iflag controls any input processing that is done to characters received on the port. Like the c_cflag field, the final value stored in c_iflag is the bitwise OR of the desired options.
Constant Description INPCK Enable parity check IGNPAR Ignore parity errors PARMRK Mark parity errors ISTRIP Strip parity bits IXON Enable software flow control (outgoing) IXOFF Enable software flow control (incoming) IXANY Allow any character to start flow again IGNBRK Ignore break condition BRKINT Send a SIGINT when a break condition is detected INLCR Map NL to CR IGNCR Ignore CR ICRNL Map CR to NL IUCLC Map uppercase to lowercase IMAXBEL Echo BEL on input line too longHere are some examples of setting parity checking:
options.c_cflag &= ~PARENB options.c_cflag &= ~CSTOPB options.c_cflag &= ~CSIZE; options.c_cflag |= CS8;Even parity (7E1):
options.c_cflag |= PARENB options.c_cflag &= ~PARODD options.c_cflag &= ~CSTOPB options.c_cflag &= ~CSIZE; options.c_cflag |= CS7;Odd parity (7O1):
options.c_cflag |= PARENB options.c_cflag |= PARODD options.c_cflag &= ~CSTOPB options.c_cflag &= ~CSIZE; options.c_cflag |= CS7;
enum serial::bytesize_t |
Enumeration defines the possible bytesizes for the serial port.
Enumeration defines the possible flowcontrol types for the serial port.
enum serial::parity_t |
Enumeration defines the possible parity types for the serial port.
enum serial::stopbits_t |
Enumeration defines the possible stopbit types for the serial port.