10 #ifndef _CMT2_H_2006_04_13
11 #define _CMT2_H_2006_04_13
13 #ifndef _CMT_MONOLITHIC
The low-level file communication class.
The low-level serial communication class.
uint32_t getBaudrate(void) const
Return the baudrate that is currently being used by the port.
bool isOpen(void) const
Return whether the communication port is open or not.
The mid-level file communication class.
bool m_readOnly
When set to true, the file is read-only and attempts to write to it will fail.
Cmt2f(const Cmt2f &ref)
This object cannot be copied, so this function is not implemented.
XsensResultValue writeMessage(const Message *msg)
Write a message to the end of the file.
XsensResultValue readMessage(Message *msg, const uint8_t msgId=0)
Read the next message from the file, when msgId is non-zero, the first matching message will be retur...
CmtFilePos getFileSize(void)
Get the current file size.
CmtFilePos getReadPosition(void)
Get the current read position.
XsensResultValue m_lastResult
The last result of an operation.
XsensResultValue close(void)
Close the file.
Cmt1f * getCmt1f(void)
Get a reference to the embedded Cmt1f object.
XsensResultValue closeAndDelete(void)
Close the file and delete it.
XsensResultValue create(const char *filename)
Create a new file with level 2 header.
Cmt1f m_cmt1f
The Cmt1f object that is used for the low-level operations.
XsensResultValue setReadPosition(CmtFilePos pos)
Set the read position to the given position.
XsensResultValue getName(char *filename) const
Retrieve the filename that was last successfully opened.
Cmt2f()
Default constructor.
XsensResultValue getLastResult(void) const
Return the error code of the last operation.
bool isOpen(void) const
Return whether the file is open or not.
XsensResultValue open(const char *filename, const bool readOnly=false)
Open a file and read the header.
Mid-level serial communication class.
XsensResultValue writeMessage(Message *msg)
Send a message over the COM port.
XsensResultValue setCallbackFunction(CmtCallbackSelector tp, int32_t instance, CmtCallbackFunction func, void *param)
Set the callback function for when a message has been received or sent.
XsensResultValue getLastResult(void) const
Return the error code of the last operation.
Cmt2s()
Default constructor, initialize all members to their default values.
Cmt2s(const Cmt2s &ref)
This object cannot be copied, so this function is not implemented.
~Cmt2s()
Destructor, de-initialize, free memory allocated for buffers, etc.
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
uint32_t m_timeout
Timeout in ms for blocking operations.
CmtCallbackFunction m_onMessageReceived
The message received function.
bool isOpen(void) const
Return whether the communication port is open or not.
void * m_onMessageReceivedParam
Custom, user supplied parameter for the OnMessageReceived callback function, passed as the last argum...
int32_t m_onMessageReceivedInstance
Custom, user supplied parameter for the OnMessageReceived callback function, passed as the first argu...
uint32_t m_toEnd
The timestamp at which to end an operation.
XsensResultValue close(void)
Close the serial communication port.
XsensResultValue setTimeout(const uint32_t ms=CMT2_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
Cmt1s m_cmt1s
The CMT level 1 object that this class operates on.
XsensResultValue getPortNr(uint8_t &port) const
Retrieve the port that the object is connected to.
XsensResultValue readMessage(Message *rcv)
Read a message from the COM port.
CmtCallbackFunction m_onMessageSent
The message sent function.
uint32_t getBaudrate(void)
Return the baudrate that is currently being used by the port.
uint32_t getTimeout(void) const
Return the current timeout value in ms.
XsensResultValue m_lastResult
The last result of an operation.
int32_t m_onMessageSentInstance
Custom, user supplied parameter for the OnMessageSent callback function, passed as the first argument...
void * m_onMessageSentParam
Custom, user supplied parameter for the OnMessageSent callback function, passed as the last argument.
XsensResultValue open(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
Open a communication channel to the given serial port name.
uint8_t m_readBuffer[CMT_DEFAULT_READ_BUFFER_SIZE]
Buffer for reading data until a valid message is read. Should be rarely used.
XsensResultValue waitForMessage(Message *rcv, const uint8_t msgId, uint32_t timeoutOverride, bool acceptErrorMessage)
Wait for a message to arrive.
XsensResultValue getPortName(char *portname) const
Cmt1s * getCmt1s(void)
Return a reference to the embedded Cmt1s object.
uint16_t m_readBufferCount
The number of valid bytes in the readBuffer.
Class for storing a single message.
XsensResultValue(__cdecl * CmtCallbackFunction)(int32_t, CmtCallbackSelector, void *, void *)
#define CMT_DEFAULT_BAUD_RATE
The default baud rate of the Cmt1s serial communication.
#define CMT_DEFAULT_READ_BUFFER_SIZE
The default size of the serial read buffer in bytes.
#define CMT2_DEFAULT_TIMEOUT
Timeout in ms for level 2.
The namespace of all Xsens software since 2006.
int32_t findValidMessage(const uint8_t *buffer, const uint16_t bufferLength)
Find a valid message in the given buffer. If nothing is found, the function returns -1....
unsigned __int16 uint16_t
unsigned __int32 uint32_t
XsensResultValue
Xsens return values.