A stream interface. More...
#include <streaminterface.h>
Public Member Functions | |
virtual uint32_t | getTimeout () const =0 |
The timeout used for read/write operations. More... | |
XsResultValue | setTimeout (uint32_t ms) override=0 |
Set the read/write timeout to ms A timeout of 0 means non-blocking operation of writeData() and readData(). More... | |
XSENS_DISABLE_COPY (StreamInterface) | |
~StreamInterface () | |
Destroy the stream interface. More... | |
![]() | |
virtual XsResultValue | appendData (const XsByteArray &bdata) |
Write data to the end of the file. More... | |
virtual void | cancelIo (void) const |
Cancel any pending io requests. More... | |
virtual XsResultValue | close (void)=0 |
Close the connection to the device. More... | |
virtual XsResultValue | closeAndDelete (void) |
Close the file and delete it. More... | |
virtual XsResultValue | create (const XsString &filename) |
Create an empty file. More... | |
virtual XsResultValue | deleteData (XsFilePos start, XsFilePos length) |
Delete the given data from the file. More... | |
virtual XsResultValue | find (const XsByteArray &needleV, XsFilePos &pos) |
Find a string of bytes in the file. More... | |
virtual XsResultValue | flushData (void)=0 |
Flush all data in the buffers to and from the device. More... | |
virtual XsFilePos | getFileSize (void) const |
Return the size of the file. More... | |
virtual XsResultValue | getLastResult (void) const =0 |
Returns the last result value produced by this interface. More... | |
virtual XsResultValue | getName (XsString &filename) const |
Retrieve the filename that was last successfully opened. More... | |
virtual XsFilePos | getReadPosition (void) const |
Return the current read position. More... | |
virtual XsFilePos | getWritePosition (void) const |
Return the current write position. More... | |
virtual XsResultValue | insertData (XsFilePos start, const XsByteArray &data) |
Insert the given data into the file. More... | |
virtual bool | isOpen (void) const =0 |
Returns true if the object has a connection to a device. More... | |
virtual bool | isReadOnly (void) const |
Return whether the file is read-only or not. More... | |
virtual XsResultValue | open (const XsPortInfo &portInfo, XsFilePos readBufSize=XS_DEFAULT_READ_BUFFER_SIZE, XsFilePos writeBufSize=XS_DEFAULT_WRITE_BUFFER_SIZE, PortOptions options=PO_XsensDefaults) |
Open a communication channel to the given port info. More... | |
virtual XsResultValue | open (const XsString &filename, bool createNew, bool readOnly) |
Open a file. More... | |
virtual XsResultValue | readData (XsFilePos maxLength, XsByteArray &data)=0 |
Read at most maxLength bytes from the device into data. More... | |
virtual XsResultValue | setReadPosition (XsFilePos pos) |
Set the new absolute read position. More... | |
virtual XsResultValue | setWritePosition (XsFilePos pos=-1) |
Set the new absolute write position. More... | |
virtual XsResultValue | waitForData (XsFilePos maxLength, XsByteArray &data) |
Wait for data to arrive or a timeout to occur. More... | |
virtual XsResultValue | writeData (const XsByteArray &data, XsFilePos *written=nullptr)=0 |
Write the data contained in data to the device. More... | |
virtual | ~IoInterface () |
Destructor. More... | |
Protected Member Functions | |
StreamInterface () | |
Create a stream interface. More... | |
![]() | |
IoInterface () | |
Constructor. More... | |
XSENS_DISABLE_COPY (IoInterface) | |
Additional Inherited Members | |
![]() | |
enum | PortOptions { PO_NoFlowControl = 0, PO_RtsCtsFlowControl = (1 << 0), PO_DtrDsrFlowControl = (1 << 1), PO_XonXoffFlowControl = (1 << 2), PO_OneStopBit = 0, PO_TwoStopBits = (1 << 3), PO_XsensDefaults = (PO_NoFlowControl | PO_TwoStopBits) } |
Options for flow control and stopbits which must be used when opening a port. More... | |
A stream interface.
This class provides an interface for dealing with streaming I/O devices, such as a COM port or a USB port.
Definition at line 75 of file streaminterface.h.
StreamInterface::~StreamInterface | ( | ) |
Destroy the stream interface.
Definition at line 69 of file streaminterface.cpp.
|
inlineprotected |
Create a stream interface.
Definition at line 95 of file streaminterface.h.
|
pure virtual |
The timeout used for read/write operations.
Implemented in SerialInterface, and UsbInterface.
|
overridepure virtual |
Set the read/write timeout to ms A timeout of 0 means non-blocking operation of writeData() and readData().
Reimplemented from IoInterface.
Implemented in SerialInterface, and UsbInterface.
StreamInterface::XSENS_DISABLE_COPY | ( | StreamInterface | ) |