1 #ifndef XSENS_MONOLITHIC
38 #define _strnicmp strncasecmp
47 # if defined(XSENS_DEBUG) || defined(CMT_LOG_ALWAYS)
48 void CMTLOG(
const char *str, ...);
49 # define CMTEXITLOG(str) JanitorFunc2R<const char*,XsensResultValue> _cmtExitLog(CMTLOG,str " returns %u",m_lastResult);
52 # define CMTEXITLOG(...)
57 int _wcsnicmp(
const wchar_t* s1,
const wchar_t* s2,
int count);
84 int32_t m_onBytesReceivedInstance;
86 void* m_onBytesReceivedParam;
181 uint32_t* length = NULL);
200 uint32_t* length = NULL);
XsensResultValue flushData(void)
Flush all data to be transmitted / received.
Definition: cmt1.cpp:285
XsensResultValue find(const void *needle, const uint32_t needleLength, XsensFilePos &pos)
Find a string of bytes in the file.
Definition: cmt1.cpp:959
void getPortName(char *portname) const
Retrieve the port name that was last successfully opened.
Definition: cmt1.cpp:304
XsensResultValue insertData(const XsensFilePos start, const uint32_t length, const void *data)
Insert the given data into the file.
Definition: cmt1.cpp:1071
uint32_t m_endTime
The time at which an operation will end in ms, used by several functions.
Definition: cmt1.h:91
XsensResultValue appendData(const uint32_t length, const void *data)
Write data to the end of the file.
Definition: cmt1.cpp:703
XsensResultValue getLastResult(void) const
Return the result code of the last operation.
Definition: cmt1.h:299
XsensFilePos getWritePos(void) const
Return the current write position.
Definition: cmt1.h:315
wchar_t m_filename_w[CMT_MAX_FILENAME_LENGTH]
Contains the name of the file that was last successfully opened using unicode.
Definition: cmt1.h:236
#define CMT_MAX_FILENAME_LENGTH
Definition: cmtdef.h:960
HANDLE getHandle(void) const
Return the handle of the port.
Definition: cmt1.cpp:300
XsensResultValue writeData(const uint32_t length, const void *data)
Write data to the file.
Definition: cmt1.cpp:1346
XsensResultValue setReadPos(const XsensFilePos pos)
Set the new absolute read position.
Definition: cmt1.cpp:1300
Cmt1f()
Default constructor, initializes all members to their default values.
Definition: cmt1.cpp:681
XsensFilePos getFileSize(void) const
Return the size of the file.
Definition: cmt1.h:297
void gotoWrite(void)
Change from reading to writing mode.
Definition: cmt1.cpp:1059
#define CMTLOG(...)
Definition: cmt1.h:51
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.
Definition: cmt1.cpp:314
The low-level serial communication class.
Definition: cmt1.h:67
#define CMT_DEFAULT_BAUD_RATE
The default baud rate of the Cmt1s serial communication.
Definition: cmtdef.h:828
CmtCallbackType
Definition: cmtdef.h:1101
XsensResultValue writeData(const uint32_t length, const uint8_t *data, uint32_t *written)
Write the data to the serial port.
Definition: cmt1.cpp:634
CmtControlLine
Definition: cmtdef.h:853
XsensResultValue setCallbackFunction(CmtCallbackType tp, int32_t instance, CmtCallbackFunction func, void *param)
Set the callback function for when bytes have been received.
Definition: cmt1.cpp:547
uint32_t getTimeout(void) const
Return the current timeout value.
Definition: cmt1.cpp:308
XsensResultValue m_lastResult
The last result of an operation.
Definition: cmt1.h:232
int _wcsnicmp(const wchar_t *s1, const wchar_t *s2, int count)
Definition: cmt1.cpp:65
XsensResultValue
Xsens return values.
Definition: xsens_std.h:43
bool m_unicode
Indicates if we're using the unicode filename or the regular filename.
Definition: cmt1.h:240
bool m_isOpen
Indicates if the file is open or not.
Definition: cmt1.h:238
~Cmt1f()
Destructor.
Definition: cmt1.cpp:696
XsensResultValue escape(const CmtControlLine mask, const CmtControlLine state)
Manipulate the Serial control lines.
Definition: cmt1.cpp:226
XsensFilePos m_readPos
The last read position in the file.
Definition: cmt1.h:228
XsensFilePos m_writePos
The last write position in the file.
Definition: cmt1.h:230
int32_t HANDLE
Definition: cmt1.h:58
XsensResultValue getName(char *filename) const
Retrieve the filename that was last successfully opened.
Definition: cmt1.cpp:1027
XsensResultValue close(void)
Close the serial communication port.
Definition: cmt1.cpp:186
XsensResultValue create(const char *filename)
Open an empty file.
Definition: cmt1.cpp:803
XsensResultValue setWritePos(const XsensFilePos pos=-1)
Set the new absolute write position.
Definition: cmt1.cpp:1317
~Cmt1s()
Destructor, de-initializes, frees memory allocated for buffers, etc.
Definition: cmt1.cpp:179
uint32_t getBaudrate(void) const
Return the baudrate that is currently being used by the port.
Definition: cmt1.cpp:298
uint16_t m_port
The opened COM port nr.
Definition: cmt1.h:97
termios m_commState
Stored settings about the serial port.
Definition: cmt1.h:108
XsensResultValue readData(const uint32_t maxLength, void *data, uint32_t *length)
Read data from the file and put it into the data buffer.
Definition: cmt1.cpp:1245
The low-level file communication class.
Definition: cmt1.h:217
void(__cdecl * CmtCallbackFunction)(int32_t instance, int32_t callbackType, void *param, void *userParam)
Function prototype for Cmt callback functions.
Definition: cmtdef.h:1134
char m_filename[CMT_MAX_FILENAME_LENGTH]
Contains the name of the file that was last successfully opened.
Definition: cmt1.h:234
XsensResultValue open(const char *filename, const bool create, const bool readOnly)
Open a file.
Definition: cmt1.cpp:1140
Cmt1s()
Default constructor, initializes all members to their default values.
Definition: cmt1.cpp:161
FILE * m_handle
The file handle.
Definition: cmt1.h:224
#define CMT_DEFAULT_WRITE_BUFFER_SIZE
The default size of the serial write buffer in bytes.
Definition: cmtdef.h:826
XsensResultValue flushData(void)
Flush all data to be written. This function writes any remaining data immediately and does not return...
Definition: cmt1.cpp:1018
XsensResultValue getLastResult(void) const
Return the error code of the last operation.
Definition: cmt1.cpp:306
#define CMT1_DEFAULT_TIMEOUT
The default timeout value for blocking CMT1s operations in ms.
Definition: cmtdef.h:835
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.
Definition: cmt1.cpp:471
XsensResultValue deleteData(const XsensFilePos start, const uint32_t length)
Delete the given data from the file.
Definition: cmt1.cpp:883
int32_t m_handle
The serial port handle.
Definition: cmt1.h:109
XsensResultValue waitForData(const uint32_t maxLength, uint8_t *data, uint32_t *length=NULL)
Wait for data to arrive or a timeout to occur.
Definition: cmt1.cpp:606
Macros and types for use in the Xsens communication protocol and CMT classes.
XsensResultValue close(void)
Close the file.
Definition: cmt1.cpp:725
bool m_isOpen
Indicates if the port is open or not.
Definition: cmt1.h:93
XsensResultValue m_lastResult
The last result of an operation.
Definition: cmt1.h:95
#define CMT_DEFAULT_READ_BUFFER_SIZE
The default size of the serial read buffer in bytes.
Definition: cmtdef.h:824
XsensFilePos m_fileSize
Contains the size of the file.
Definition: cmt1.h:226
void gotoRead(void)
Change from writing to reading mode.
Definition: cmt1.cpp:1047
XsensResultValue closeAndDelete(void)
Close the file and delete it.
Definition: cmt1.cpp:750
XsensResultValue setTimeout(const uint32_t ms=CMT1_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
Definition: cmt1.cpp:561
uint32_t m_timeout
Definition: cmt1.h:102
bool m_readOnly
Indicates if the file was opened in read-only mode.
Definition: cmt1.h:248
bool m_reading
Indicates whether the last operation was a read or write operation.
Definition: cmt1.h:246
bool isOpen(void) const
Return whether the communication port is open or not.
Definition: cmt1.cpp:310
char m_portname[32]
Definition: cmt1.h:98
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
Definition: cmt1.h:89
uint16_t getPortNr(void) const
Retrieve the port number that was last successfully opened.
Definition: cmt1.cpp:302
XsensFilePos getReadPos(void) const
Return the current read position.
Definition: cmt1.h:313
__off64_t XsensFilePos
Definition: xsens_file.h:21
bool isOpen(void) const
Return whether the file is open or not.
Definition: cmt1.h:326
bool isReadOnly(void) const
Return whether the file is readonly or not.
Definition: cmt1.h:328