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