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);
252 void gotoWrite(
void);
328 bool isReadOnly(
void)
const {
return !m_isOpen || m_readOnly; }
XsensResultValue flushData(void)
Flush all data to be transmitted / received.
Definition: cmt1.cpp:285
uint32_t m_endTime
The time at which an operation will end in ms, used by several functions.
Definition: cmt1.h:91
bool isReadOnly(void) const
Return whether the file is readonly or not.
Definition: cmt1.h:328
#define CMT_MAX_FILENAME_LENGTH
Definition: cmtdef.h:960
HANDLE getHandle(void) const
Return the handle of the port.
Definition: cmt1.cpp:300
#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
bool isOpen(void) const
Return whether the communication port is open or not.
Definition: cmt1.cpp:310
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
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 getReadPos(void) const
Return the current read position.
Definition: cmt1.h:313
XsensFilePos m_writePos
The last write position in the file.
Definition: cmt1.h:230
int32_t HANDLE
Definition: cmt1.h:58
XsensResultValue close(void)
Close the serial communication port.
Definition: cmt1.cpp:186
~Cmt1s()
Destructor, de-initializes, frees memory allocated for buffers, etc.
Definition: cmt1.cpp:179
uint16_t m_port
The opened COM port nr.
Definition: cmt1.h:97
bool isOpen(void) const
Return whether the file is open or not.
Definition: cmt1.h:326
termios m_commState
Stored settings about the serial port.
Definition: cmt1.h:108
The low-level file communication class.
Definition: cmt1.h:217
uint32_t getBaudrate(void) const
Return the baudrate that is currently being used by the port.
Definition: cmt1.cpp:298
XsensFilePos getFileSize(void) const
Return the size of the file.
Definition: cmt1.h:297
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
#define CMT1_DEFAULT_TIMEOUT
The default timeout value for blocking CMT1s operations in ms.
Definition: cmtdef.h:835
uint32_t getTimeout(void) const
Return the current timeout value.
Definition: cmt1.cpp:308
uint16_t getPortNr(void) const
Retrieve the port number that was last successfully opened.
Definition: cmt1.cpp:302
void(__cdecl * CmtCallbackFunction)(int32_t instance, int32_t callbackType, void *param, void *userParam)
Function prototype for Cmt callback functions.
Definition: cmtdef.h:1134
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
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.
The namespace of all Xsens software since 2006.
Definition: cmt1.cpp:62
XsensResultValue getLastResult(void) const
Return the result code of the last operation.
Definition: cmt1.h:299
XsensResultValue getLastResult(void) const
Return the error code of the last operation.
Definition: cmt1.cpp:306
void getPortName(char *portname) const
Retrieve the port name that was last successfully opened.
Definition: cmt1.cpp:304
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
XsensFilePos getWritePos(void) const
Return the current write position.
Definition: cmt1.h:315
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
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
__off64_t XsensFilePos
Definition: xsens_file.h:21