Go to the documentation of this file.
65 #ifndef SERIALINTERFACE_H
66 #define SERIALINTERFACE_H
int32_t XsIoHandle
The type that is used for low-level identification of an open I/O device.
void getPortName(XsString &portname) const
Retrieve the port name that was last successfully opened.
uint16_t getPortNumber(void) const
Retrieve the port number that was last successfully opened.
uint16_t m_port
The opened COM port nr.
A list of uint8_t values.
XsResultValue setTimeout(uint32_t ms)
Set the default timeout value to use in blocking operations.
XsResultValue close(void) override
Close the serial communication port.
XsControlLine
Serial control lines.
SerialInterface::PortOptions operator|(SerialInterface::PortOptions lhs, SerialInterface::PortOptions rhs)
Logical or operator for flow controls.
uint32_t m_endTime
The time at which an operation will end in ms, used by several functions.
XsBaudRate m_baudrate
The baudrate that was last set to be used by the port.
XsResultValue getLastResult(void) const
Return the error code of the last operation.
XsResultValue readData(XsFilePos maxLength, XsByteArray &data) override
Read data from the serial port and put it into the data buffer.
PortOptions
Options for flow control and stopbits which must be used when opening a port.
#define XS_DEFAULT_READ_BUFFER_SIZE
The default size of the serial read buffer in bytes.
XsResultValue
Xsens result values.
XsResultValue m_lastResult
The last result of an operation.
#define XS_DEFAULT_WRITE_BUFFER_SIZE
The default size of the serial write buffer in bytes.
XsResultValue closeLive(void)
Close the serial communication port.
enum XsBaudRate XsBaudRate
Communication speed.
virtual ~SerialInterface()
Destructor, de-initializes, frees memory allocated for buffers, etc.
Contains a descriptor for opening a communication port to an Xsens device.
XsBaudRate getBaudrate(void) const
Return the baudrate that is currently being used by the port.
void applyHwControlLinesOptions(PortOptions options, int portLinesOptions, int &p)
Apply the specified options for the hardware control lines.
XsResultValue open(const XsPortInfo &portInfo, XsFilePos readBufSize=XS_DEFAULT_READ_BUFFER_SIZE, XsFilePos writeBufSize=XS_DEFAULT_WRITE_BUFFER_SIZE, PortOptions options=PO_XsensDefaults) override
Open a communication channel to the given port info.
XsResultValue flushData(void) override
Flush all data in the buffers to and from the device.
XsIoHandle getHandle(void) const
Return the handle of the port.
SerialInterface()
Default constructor, initializes all members to their default values.
XsResultValue escape(XsControlLine mask, XsControlLine state)
Manipulate the Serial control lines.
void cancelIo(void) const
Cancel any pending io requests.
The low-level serial communication class.
Encapsulates a file, providing a platform independent interface.
bool isOpen(void) const
Return whether the communication port is open or not.
XsResultValue writeData(const XsByteArray &data, XsFilePos *written=0) override
Write the data contained in data to the device.
XsResultValue waitForData(XsFilePos maxLength, XsByteArray &data) override
Wait for data to arrive or a timeout to occur.
XSENS_DISABLE_COPY(SerialInterface)
SerialInterface::PortOptions operator&(SerialInterface::PortOptions lhs, SerialInterface::PortOptions rhs)
Logical and operator for flow controls.
uint32_t getTimeout(void) const
Return the current timeout value.
termios m_commState
Stored settings about the serial port.
SerialInterface::PortOptions operator~(SerialInterface::PortOptions lhs)
Logical inversion operator for flow controls.
int32_t m_handle
The serial port handle, also indicates if the port is open or not.
int64_t XsFilePos
The type that is used for positioning inside a file.
A 0-terminated managed string of characters.
char m_portname[32]
The name of the open serial port.