23 #define XS_DEFAULT_READ_BUFFER_SIZE (XS_MAXMSGLEN * 8) 25 #define XS_DEFAULT_WRITE_BUFFER_SIZE XS_MAXMSGLEN 28 #define XS_MAX_FILENAME_LENGTH 512 30 #define XS_MAX_FILENAME_LENGTH PATH_MAX 36 #define XsIoHandle HANDLE 38 #define XsFileHandle FILE 60 virtual bool isOpen(
void)
const = 0;
111 const XsString& filename,
bool createNew,
bool readOnly);
virtual bool isOpen(void) const =0
Returns true if the object has a connection to a device.
virtual void cancelIo(void) const
Cancel any pending io requests.
virtual XsResultValue writeData(const XsByteArray &data, XsSize *written=nullptr)=0
Write the data contained in data to the device.
struct XsByteArray XsByteArray
virtual XsResultValue setWritePosition(XsFilePos pos=-1)
Set the new absolute write position.
virtual XsResultValue deleteData(XsFilePos start, XsSize length)
Delete the given data from the file.
virtual bool isReadOnly(void) const
Return whether the file is readonly or not.
virtual XsResultValue closeAndDelete(void)
Close the file and delete it.
size_t XsSize
XsSize must be unsigned number!
virtual XsResultValue setReadPosition(XsFilePos pos)
Set the new absolute read position.
#define XS_DEFAULT_WRITE_BUFFER_SIZE
The default size of the serial write buffer in bytes.
virtual XsFilePos getReadPosition(void) const
Return the current read position.
virtual XsResultValue getLastResult(void) const =0
Returns the last result value produced by this interface.
IoInterface()
Constructor.
virtual XsResultValue flushData(void)=0
Flush all data in the buffers to and from the device.
virtual XsResultValue close(void)=0
Close the connection to the device.
XsResultValue
Xsens result values.
__int64 XsFilePos
The type that is used for positioning inside a file.
virtual XsResultValue open(const XsPortInfo &portInfo, uint32_t readBufSize=XS_DEFAULT_READ_BUFFER_SIZE, uint32_t writeBufSize=XS_DEFAULT_WRITE_BUFFER_SIZE)
Open a communication channel to the given port info.
virtual XsResultValue setTimeout(uint32_t ms)
Set the default timeout value to use in blocking operations.
virtual XsResultValue appendData(const XsByteArray &bdata)
Write data to the end of the file.
virtual XsResultValue waitForData(XsSize maxLength, XsByteArray &data)
Wait for data to arrive or a timeout to occur.
virtual XsFilePos getWritePosition(void) const
Return the current write position.
#define XSENS_DISABLE_COPY(className)
Add this macro to the start of a class definition to prevent automatic creation of copy functions...
virtual XsResultValue find(const XsByteArray &needleV, XsFilePos &pos)
Find a string of bytes in the file.
virtual XsResultValue getName(XsString &filename) const
Retrieve the filename that was last successfully opened.
virtual ~IoInterface()
Destructor.
An abstract IO interface.
GLuint GLsizei GLsizei * length
virtual XsResultValue create(const XsString &filename)
Create an empty file.
virtual XsResultValue readData(XsSize maxLength, XsByteArray &data)=0
Read at most maxLength bytes from the device into data.
#define XsIoHandle
The type that is used for low-level identification of an open I/O device.
unsigned __int32 uint32_t
GLsizei GLsizei GLenum GLenum const GLvoid * data
#define XS_DEFAULT_READ_BUFFER_SIZE
The default size of the serial read buffer in bytes.
virtual XsResultValue insertData(XsFilePos start, const XsByteArray &data)
Insert the given data into the file.
virtual XsFilePos getFileSize(void) const
Return the size of the file.