|
xsens_imu
|
Mid-level serial communication class. More...
#include <cmt2.h>
Public Member Functions | |
| Cmt2s () | |
| Default constructor, initialize all members to their default values. More... | |
| ~Cmt2s () | |
| Destructor, de-initialize, free memory allocated for buffers, etc. More... | |
| XsensResultValue | close (void) |
| Close the serial communication port. More... | |
| uint32_t | getBaudrate (void) |
| Return the baudrate that is currently being used by the port. More... | |
| Cmt1s * | getCmt1s (void) |
| Return a reference to the embedded Cmt1s object. More... | |
| XsensResultValue | getLastResult (void) const |
| Return the error code of the last operation. More... | |
| XsensResultValue | getPortNr (uint16_t &port) const |
| Retrieve the port that the object is connected to. More... | |
| XsensResultValue | getPortNr (int32_t &port) const |
| XsensResultValue | getPortName (char *portname) const |
| uint32_t | getTimeout (void) const |
| Return the current timeout value in ms. More... | |
| bool | isOpen (void) const |
| Return whether the communication port is open or not. More... | |
| 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 communication channel to the given serial port name. More... | |
| XsensResultValue | readMessage (Message *rcv) |
| Read a message from the COM port. More... | |
| XsensResultValue | setCallbackFunction (CmtCallbackType tp, int32_t instance, CmtCallbackFunction func, void *param) |
| Set the callback function for when a message has been received or sent. More... | |
| XsensResultValue | setTimeout (const uint32_t ms=CMT2_DEFAULT_TIMEOUT) |
| Set the default timeout value to use in blocking operations. More... | |
| XsensResultValue | waitForMessage (Message *rcv, const uint8_t msgId, uint32_t timeoutOverride, bool acceptErrorMessage) |
| Wait for a message to arrive. More... | |
| XsensResultValue | writeMessage (Message *msg) |
| Send a message over the COM port. More... | |
Protected Attributes | |
| uint32_t | m_baudrate |
| The baudrate that was last set to be used by the port. More... | |
| Cmt1s | m_cmt1s |
| The CMT level 1 object that this class operates on. More... | |
| XsensResultValue | m_lastResult |
| The last result of an operation. More... | |
| uint8_t | m_readBuffer [CMT_DEFAULT_READ_BUFFER_SIZE] |
| Buffer for reading data until a valid message is read. Should be rarely used. More... | |
| uint16_t | m_readBufferCount |
| The number of valid bytes in the readBuffer. More... | |
| uint32_t | m_timeout |
| Timeout in ms for blocking operations. More... | |
| uint32_t | m_toEnd |
| The timestamp at which to end an operation. More... | |
Mid-level serial communication class.
The class uses CMT level 1, but does not inherit from it. If software needs to access the level 1 component, it needs to be done through the getCmt1s() function.
| xsens::Cmt2s::Cmt2s | ( | ) |
Default constructor, initialize all members to their default values.
| xsens::Cmt2s::~Cmt2s | ( | ) |
Destructor, de-initialize, free memory allocated for buffers, etc.
| XsensResultValue xsens::Cmt2s::close | ( | void | ) |
Close the serial communication port.
|
inline |
Return the baudrate that is currently being used by the port.
|
inline |
|
inline |
Return the error code of the last operation.
| XsensResultValue xsens::Cmt2s::getPortName | ( | char * | portname | ) | const |
| XsensResultValue xsens::Cmt2s::getPortNr | ( | uint16_t & | port | ) | const |
Retrieve the port that the object is connected to.
| XsensResultValue xsens::Cmt2s::getPortNr | ( | int32_t & | port | ) | const |
|
inline |
Return the current timeout value in ms.
|
inline |
Return whether the communication port is open or not.
| XsensResultValue xsens::Cmt2s::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 communication channel to the given serial port name.
| XsensResultValue xsens::Cmt2s::readMessage | ( | Message * | rcv | ) |
| XsensResultValue xsens::Cmt2s::setCallbackFunction | ( | CmtCallbackType | tp, |
| int32_t | instance, | ||
| CmtCallbackFunction | func, | ||
| void * | param | ||
| ) |
Set the callback function for when a message has been received or sent.
| XsensResultValue xsens::Cmt2s::setTimeout | ( | const uint32_t | ms = CMT2_DEFAULT_TIMEOUT | ) |
Set the default timeout value to use in blocking operations.
This function sets the level 2 timeout value. The L1 value is set to half the given timeout value.
| XsensResultValue xsens::Cmt2s::waitForMessage | ( | Message * | rcv, |
| const uint8_t | msgId, | ||
| uint32_t | timeoutOverride, | ||
| bool | acceptErrorMessage | ||
| ) |
Wait for a message to arrive.
The function waits for a message to arrive or until a timeout occurs. If the msgId parameter is set to a value other than 0, the function will wait until a message has arrived with that particular msgId.
| XsensResultValue xsens::Cmt2s::writeMessage | ( | Message * | msg | ) |
Send a message over the COM port.
The function attempts to write the message over the connected COM port.
| msg | The message to send. |
|
protected |
The baudrate that was last set to be used by the port.
|
protected |
The CMT level 1 object that this class operates on.
|
mutableprotected |
The last result of an operation.
|
protected |
Buffer for reading data until a valid message is read. Should be rarely used.
|
protected |
The number of valid bytes in the readBuffer.
|
protected |
Timeout in ms for blocking operations.
|
protected |
The timestamp at which to end an operation.
1.8.13