9 #ifndef _CMT1_H_2006_04_12 10 #define _CMT1_H_2006_04_12 12 #ifndef _CMTDEF_H_2006_05_01 25 #define _strnicmp strncasecmp 34 # if defined(_DEBUG) || defined(_LOG_ALWAYS) 35 void CMTLOG(
const char *str, ...);
36 # define CMTEXITLOG(str) JanitorFunc2<const char*,XsensResultValue> _cmtExitLog(CMTLOG,str " returns %u",m_lastResult); 39 # define CMTEXITLOG(...) 44 int _wcsnicmp(
const wchar_t* s1,
const wchar_t* s2,
int count);
361 #endif // _CMT1_H_2006_04_12 int32_t m_onBytesReceivedInstance
Custom, user supplied parameter for the OnBytesReceived callback function, passed as the first argume...
GLuint GLuint GLsizei count
Cmt1s()
Default constructor, initializes all members to their default values.
XsensResultValue appendData(const uint32_t length, const void *data)
Write data to the end of the file.
void getPortName(char *portname) const
Retrieve the port name that was last successfully opened.
XsensResultValue setReadPos(const CmtFilePos pos)
Set the new absolute read position.
XsensResultValue writeData(const uint32_t length, const uint8_t *data, uint32_t *written)
Write the data to the serial port.
XsensResultValue getName(char *filename) const
Retrieve the filename that was last successfully opened.
CmtCallbackFunction m_onBytesReceived
The bytes received function.
void gotoRead(void)
Change from writing to reading mode.
#define CMT_MAX_FILENAME_LENGTH
bool isOpen(void) const
Return whether the file is open or not.
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
#define CMT_DEFAULT_BAUD_RATE
The default baud rate of the Cmt1s serial communication.
CmtFilePos getReadPos(void) const
Return the current read position.
XsensResultValue readData(const uint32_t maxLength, void *data, uint32_t *length)
Read data from the file and put it into the data buffer.
XsensResultValue writeData(const uint32_t length, const void *data)
Write data to the file.
XsensResultValue closeAndDelete(void)
Close the file and delete it.
XsensResultValue deleteData(const CmtFilePos start, const uint32_t length)
Delete the given data from the file.
CmtFilePos getWritePos(void) const
Return the current write position.
CmtFilePos m_readPos
The last read position in the file.
XsensResultValue open(const char *filename, const bool create, const bool readOnly)
Open a file.
HANDLE getHandle(void) const
Return the handle of the port.
FILE * m_handle
The file handle.
XsensResultValue setTimeout(const uint32_t ms=CMT1_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
XsensResultValue insertData(const CmtFilePos start, const uint32_t length, const void *data)
Insert the given data into the file.
char m_filename[CMT_MAX_FILENAME_LENGTH]
Contains the name of the file that was last successfully opened.
XsensResultValue(__cdecl * CmtCallbackFunction)(int32_t, CmtCallbackSelector, void *, void *)
XsensResultValue
Xsens return values.
XsensResultValue waitForData(const uint32_t maxLength, uint8_t *data, uint32_t *length=NULL)
Wait for data to arrive or a timeout to occur.
XsensResultValue find(const void *needle, const uint32_t needleLength, CmtFilePos &pos)
Find a string of bytes in the file.
XsensResultValue open(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE, uint32_t readBufSize=CMT_DEFAULT_READ_BUFFER_SIZE, uint32_t writeBufSize=CMT_DEFAULT_WRITE_BUFFER_SIZE)
Open a communcation channel to the given serial port name.
XsensResultValue readData(const uint32_t maxLength, uint8_t *data, uint32_t *length=NULL)
Read data from the serial port and put it into the data buffer.
CmtFilePos m_fileSize
Contains the size of the file.
~Cmt1s()
Destructor, de-initializes, frees memory allocated for buffers, etc.
Cmt1f()
Default constructor, initializes all members to their default values.
wchar_t m_filename_w[CMT_MAX_FILENAME_LENGTH]
Contains the name of the file that was last successfully opened using unicode.
bool m_isOpen
Indicates if the file is open or not.
XsensResultValue close(void)
Close the file.
XsensResultValue escape(const CmtControlLine mask, const CmtControlLine state)
Manipulate the Serial control lines.
void gotoWrite(void)
Change from reading to writing mode.
bool m_unicode
Indicates if we're using the unicode filename or the regular filename.
XsensResultValue getLastResult(void) const
Return the result code of the last operation.
#define CMT_DEFAULT_WRITE_BUFFER_SIZE
The default size of the serial write buffer in bytes.
The low-level serial communication class.
#define CMT1_DEFAULT_TIMEOUT
The default timeout value for blocking CMT1s operations in ms.
bool m_isOpen
Indicates if the port is open or not.
CmtFilePos m_writePos
The last write position in the file.
XsensResultValue setCallbackFunction(CmtCallbackSelector tp, int32_t instance, CmtCallbackFunction func, void *param)
Set the callback function for when bytes have been received.
uint8_t getPortNr(void) const
Retrieve the port number that was last successfully opened.
HANDLE m_handle
The serial port handle.
bool m_reading
Indicates whether the last operation was a read or write operation.
uint32_t getTimeout(void) const
Return the current timeout value.
CmtFilePos getFileSize(void) const
Return the size of the file.
void * m_onBytesReceivedParam
Custom, user supplied parameter for the OnBytesReceived callback function, passed as the last argumen...
uint32_t m_endTime
The time at which an operation will end in ms, used by several functions.
GLuint GLsizei GLsizei * length
bool isOpen(void) const
Return whether the communication port is open or not.
XsensResultValue m_lastResult
The last result of an operation.
The low-level file communication class.
int BASE_IMPEXP sprintf(char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
The namespace of all Xsens software since 2006.
bool m_readOnly
Indicates if the file was opened in read-only mode.
XsensResultValue create(const char *filename)
Open an empty file.
XsensResultValue close(void)
Close the serial communication port.
bool isReadOnly(void) const
Return whether the file is readonly or not.
#define CMT_DEFAULT_READ_BUFFER_SIZE
The default size of the serial read buffer in bytes.
uint8_t m_port
The opened COM port nr.
unsigned __int32 uint32_t
GLsizei GLsizei GLenum GLenum const GLvoid * data
XsensResultValue setWritePos(const CmtFilePos pos=-1)
Set the new absolute write position.
XsensResultValue getLastResult(void) const
Return the error code of the last operation.
DCB m_commState
Stored settings about the serial port.
XsensResultValue flushData(void)
Flush all data to be written. This function writes any remaining data immediately and does not return...
XsensResultValue flushData(void)
Flush all data to be transmitted / received.
XsensResultValue m_lastResult
The last result of an operation.
uint32_t getBaudrate(void) const
Return the baudrate that is currently being used by the port.