39 # define CMT3LOG CMTLOG
40 # define CMT3EXITLOG JanitorLogFunc<XsensResultValue,uint32_t> _cmtExitLog(CMTLOG,"L3: " __FUNCTION__ " returns %u\n",m_lastResult);
47 # define CMT3LOGDAT CMTLOG
48 # define CMT3EXITLOGDAT JanitorLogFunc<XsensResultValue,uint32_t> _cmtExitLog(CMTLOG,"L3: " __FUNCTION__ " returns %u\n",m_lastResult);
50 # define CMT3LOGDAT(...)
51 # define CMT3EXITLOGDAT
54 #define CMT3F_DEVINFO_SIZE (sizeof(CmtDeviceId) + sizeof(CmtDataFormat))
123 return (115200.0 / ((1.0 + (
double) skip) * (
double) period));
145 return (115200.0 / ((1.0 + (
double)
m_skip) * (
double)
m_period));
147 return (115200.0 / ((
double)
m_period));
168 if (frequency >= 512)
198 #define DO_DATA_REQUEST_BID(req,bid)\
201 if (bid == CMT_BID_INVALID || bid == CMT_BID_BROADCAST)\
202 return (m_lastResult = XRV_INVALIDID);\
203 if (!m_readFromFile)\
206 m_serial.writeMessage(&snd);\
207 if ((m_lastResult = m_serial.waitForMessage(&rcv,req+1,0,true)) != XRV_OK)\
208 return m_lastResult;\
210 m_logFile.writeMessage(&rcv);\
211 if (rcv.getMessageId() == CMT_MID_ERROR)\
212 { m_lastHwErrorDeviceId = m_config.m_masterDeviceId;\
213 if (rcv.getDataSize() >= 2)\
215 uint8_t biddy = rcv.getDataByte(1);\
216 getDeviceId(biddy,m_lastHwErrorDeviceId);\
218 return m_lastResult = m_lastHwError = (XsensResultValue) rcv.getDataByte();\
224 if ((m_lastResult = m_logFile.readMessage(&rcv,req+1)) != XRV_OK)\
225 return m_lastResult;\
226 if (rcv.getBusId() == bid || (rcv.getBusId() == 1 && bid == CMT_BID_MASTER))\
230 #define DO_DATA_REQUEST(req)\
231 uint8_t bid = getBusIdInternal(deviceId);\
232 DO_DATA_REQUEST_BID(req,bid);
236 #define DO_DATA_SET_BID(req,size,type,data,bid)\
237 Message snd(req,size);\
239 snd.setData ## type (data);\
240 if (bid == CMT_BID_BROADCAST)\
242 for (uint8_t i=0;i<m_config.m_numberOfDevices;++i)\
245 m_serial.writeMessage(&snd);\
246 m_lastResult = m_serial.waitForMessage(&rcv,req+1,0,true);\
247 if (m_lastResult != XRV_OK)\
248 return m_lastResult;\
250 m_logFile.writeMessage(&rcv);\
251 if (rcv.getMessageId() == CMT_MID_ERROR)\
252 { m_lastHwErrorDeviceId = m_config.m_masterDeviceId;\
253 if (rcv.getDataSize() >= 2)\
255 uint8_t biddy = rcv.getDataByte(1);\
256 getDeviceId(biddy,m_lastHwErrorDeviceId);\
258 return m_lastResult = m_lastHwError = (XsensResultValue) rcv.getDataByte();\
263 m_serial.writeMessage(&snd);\
264 m_lastResult = m_serial.waitForMessage(&rcv,req+1,0,true);\
265 if (m_lastResult != XRV_OK)\
266 return m_lastResult;\
268 m_logFile.writeMessage(&rcv);\
269 if (rcv.getMessageId() == CMT_MID_ERROR)\
270 { m_lastHwErrorDeviceId = m_config.m_masterDeviceId;\
271 if (rcv.getDataSize() >= 2)\
273 uint8_t biddy = rcv.getDataByte(1);\
274 getDeviceId(biddy,m_lastHwErrorDeviceId);\
276 return m_lastResult = m_lastHwError = (XsensResultValue) rcv.getDataByte();\
280 #define DO_DATA_SET(req,size,type,data)\
281 uint8_t bid = getBusIdInternal(deviceId);\
282 if (bid == CMT_BID_INVALID)\
283 return (m_lastResult = XRV_INVALIDID);\
284 DO_DATA_SET_BID(req,size,type,data,bid);
286 #define HANDLE_ERR_RESULT\
287 if (rcv.getMessageId() == CMT_MID_ERROR)\
289 m_lastHwErrorDeviceId = m_config.m_masterDeviceId;\
290 if (rcv.getDataSize() >= 2)\
292 uint8_t biddy = rcv.getDataByte(1);\
293 getDeviceId(biddy,m_lastHwErrorDeviceId);\
295 return m_lastResult = m_lastHwError = (XsensResultValue) rcv.getDataByte(0);\
348 CMT3LOG(
"L3: Closing L2 port\n");
394 state = (rcv.getDataShort() != 0);
403 CMT3LOG(
"L3: getBatteryLevel\n");
407 level = rcv.getDataByte();
428 CMT3LOG(
"L3: getBluetoothState\n");
432 enabled = (rcv.getDataByte() == 0);
482 CMT3LOG(
"L3: getBusPowerState\n");
486 enabled = (rcv.getDataShort() != 0);
506 CMT3LOG(
"L3: getConfiguration\n");
556 length = rcv.getDataShort();
564 CMT3LOG(
"L3: getDeviceCount\n");
693 for (
uint8_t page=0;page < 4;++page)
696 for (
uint8_t part=0;part < 4;++part, ++emtPos)
800 mode = rcv.getDataShort();
805 mode = rcv.getDataShort();
904 CMT3LOG(
"L3: getLogFileReadPosition\n");
920 CMT3LOG(
"L3: getLogFileSize\n");
936 CMT3LOG(
"L3: getLogFileName (char)\n");
949 CMT3LOG(
"L3: getLogFileName (wchar_t)\n");
1026 productCode[
len] =
'\0';
1035 CMT3LOG(
"L3: getSampleFrequency\n");
1040 return mode.getSampleFrequency();
1047 CMT3LOG(
"L3: getSerialBaudrate\n");
1096 CMT3LOG(
"L3: getSyncInSettings\n");
1144 CMT3LOG(
"L3: getSyncInMode\n");
1169 CMT3LOG(
"L3: getSyncInSkipFactor\n");
1194 CMT3LOG(
"L3: getSyncInOffset\n");
1234 CMT3LOG(
"L3: getSyncOutSettings\n");
1293 CMT3LOG(
"L3: getSyncOutMode\n");
1318 CMT3LOG(
"L3: getSyncOutPulseWidth\n");
1346 CMT3LOG(
"L3: getSyncOutSkipFactor\n");
1371 CMT3LOG(
"L3: getSyncOutOffset\n");
1435 CMT3LOG(
"L3: getXmOutputMode\n");
1461 CMT3LOG(
"L3: Attempt to goto config %d\n",tries);
1483 CMT3LOG(
"L3: Goto config succeeded\n");
1489 msleep(((
long)rand() * 10)/RAND_MAX);
1553 CMT3LOG(
"L3: openPort: Low level port opened, gotoConfig\n");
1568 CMT3LOG(
"L3: openPort: gotoConfig succeeded, requesting initBus\n");
1578 CMT3LOG(
"L3: openPort: initBus succeeded, cleaning up the cache\n");
1586 CMT3LOG(
"L3: openPort: returning OK\n");
1606 CMT3LOG(
"L3: openPort: Low level port opened, gotoConfig\n");
1621 CMT3LOG(
"L3: openPort: gotoConfig succeeded, requesting initBus\n");
1631 CMT3LOG(
"L3: openPort: initBus succeeded, cleaning up the cache\n");
1639 CMT3LOG(
"L3: openPort: returning OK\n");
1648 CMT3LOG(
"L3: peekLogMessageId started\n");
1662 CMT3LOG(
"L3: peekLogMessageId, no messages to be read\n");
1666 CMT3LOG(
"L3: peekLogMessageId found msg with ID %02x\n",(
int32_t) messageId);
1674 CMT3LOGDAT(
"L3: readDataPacket %p %u\n",pack,acceptOther?1:0);
1684 CMT3LOGDAT(
"L3: readDataPacket, no data messages to be read\n");
1698 CMT3LOGDAT(
"L3: readDataPacket, data message read\n");
1726 CMT3LOGDAT(
"L3: readDataPacket, no data messages to be read\n");
1738 CMT3LOGDAT(
"L3: readDataPacket, data message read\n");
1837 CMT3LOG(
"L3: setBaudrate %u %u\n",baudrate,reconnect?1:0);
1885 CMT3LOG(
"L3: sending reset for reconnect\n");
1899 CMT3LOG(
"L3: reopening port at new baud rate\n");
1926 CMT3LOG(
"L3: setBluetoothState %u\n",enabled?1:0);
1938 CMT3LOG(
"L3: setBusPowerState %u\n",enabled?1:0);
2000 xperiod =
mode.m_period * (
mode.m_skip + 1);
2002 xperiod =
mode.m_period;
2153 CMT3LOG(
"L3: setXmPowerOff\n");
2245 CMT3LOG(
"L3: setSyncInSettings %u\n",skipFactor);
2406 CMT3LOG(
"L3: setSyncOutSettings %u\n",pulseWidth);
2435 CMT3LOG(
"L3: setSyncOutSettings %u\n",skipFactor);
2492 CMT3LOG(
"L3: setTimeoutConfig %u\n",timeout);
2505 CMT3LOG(
"L3: setTimeoutMeasurement %u\n",timeout);
2531 CMT3LOG(
"L3: refreshCache %d\n",file?1:0);
2547 CMT3LOG(
"L3: refreshCache Device in configuration mode, reading device information\n");
2580 CMT3LOG(
"L3: refreshCache Reading device configuration information from file\n");
2606 CMT3LOGDAT(
"L3: waitForDataMessage %p\n",pack);
2646 CMT3LOG(
"L3: createLogFile \"%s\" %u\n",filename?filename:
"",startLogging?1:0);
2678 CMT3LOG(
"L3: createLogFile \"%S\" %u\n",filename?filename:L
"",startLogging?1:0);
2710 CMT3LOG(
"L3: closeLogFile %u\n",del?1:0);
2725 CMT3LOG(
"L3: isLogFileOpen \"%s\"\n",filename?filename:
"");
2729 if (filename != NULL && filename[0] != 0)
2744 CMT3LOG(
"L3: isLogFileOpen \"%S\"\n",filename?filename:L
"");
2748 if (filename != NULL && filename[0] != L
'\0')
2763 CMT3LOG(
"L3: openLogFile \"%s\"\n",filename?filename:
"");
2788 CMT3LOG(
"L3: openLogFile \"%S\"\n",filename?filename:L
"");
2813 CMT3LOG(
"L3: setDataSource %s\n",readFromFile?
"file":
"port");
2844 CMT3LOG(
"L3: setLogMode %u\n",active?1:0);
2856 CMT3LOG(
"L3: resetLogFileReadPos\n");
2865 CMT3LOG(
"L3: writeMessageToLogFile\n");
XsensResultValue flushData(void)
Flush all data to be transmitted / received.
uint8_t getPortNr(void) const
Retrieve the port number that was last successfully opened.
The mid-level file communication class.
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 close(void)
Close the file.
XsensResultValue closeAndDelete(void)
Close the file and delete it.
XsensResultValue create(const char *filename)
Create a new file with level 2 header.
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.
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 getLastResult(void) const
Return the error code of the last operation.
bool isOpen(void) const
Return whether the communication port is open or not.
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.
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.
XsensResultValue open(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
Open a communication channel to the given serial port name.
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.
XsensResultValue setXmOutputMode(const uint8_t mode)
Set the dual-output mode of the XM.
XsensResultValue getSyncMode(uint8_t &mode)
Retrieve the sync mode of the Xbus Master.
XsensResultValue writeMessageToLogFile(const Message &msg)
uint16_t m_period
The sample period of the port.
XsensResultValue setBaudrate(const uint32_t baudrate, bool reconnect=true)
Set the baudrate and possibly reconnect.
CmtMtTimeStamp m_rtcLastSc
The last received sample counter, used to determine wrap-around.
XsensResultValue getEMtsData(void *buffer, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the eMts data of the specified sensor(s).
bool isLogFileOpen(const char *filename) const
Return whether or not(true or false) the supplied file is open.
XsensResultValue storeXkfState(const CmtDeviceId deviceId=CMT_DID_MASTER)
Store important components of the XKF filter state to non-volatile memory.
uint32_t m_timeoutConf
The config mode timeout.
XsensResultValue setBusPowerState(const bool enabled)
Switch the Xbus Master bus power on or off.
XsensResultValue setSyncInOffset(const uint32_t offset)
Set the inbound synchronization offset of an MT device.
Cmt2s * getCmt2s(void)
Return a reference to the embedded Cmt2s (comm port) object.
uint32_t getTimeoutConfig(void) const
Return the configuration mode timeout.
XsensResultValue m_lastResult
The last result of an operation.
XsensResultValue getDeviceMode2(CmtDeviceMode2 &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode2.
CmtDeviceConfiguration m_config
The configuration of the connected devices.
XsensResultValue setSyncOutOffset(const uint32_t offset)
Set the outbound synchronization offset of an MT device.
XsensResultValue setMagneticDeclination(const double declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the stored magnetic declination.
Cmt2f * getCmt2f(void)
Return a reference to the embedded Cmt2f (logfile) object.
uint16_t m_gotoConfigTries
The number of times a goto config is attempted before the function fails.
Cmt2f m_logFile
The (optional) CMT level 2 logfile object that this class operates on.
XsensResultValue waitForDataMessage(Packet *pack)
Wait for a data message to arrive.
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
XsensResultValue setLogMode(bool active)
Set the logging mode.
~Cmt3()
Destructor, de-initializes, frees memory allocated for buffers, etc.
XsensResultValue setBluetoothState(const bool enabled)
Set the Bluetooth state of the Xbus Master.
XsensResultValue getSyncInOffset(uint32_t &offset)
Retrieve the inbound synchronization offset of an MT device.
void fillRtc(Packet *pack)
Internal function to compute the RTC value.
XsensResultValue getDataLength(uint32_t &length, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve data size.
bool isXm(void) const
Return whether the main device is an Xbus Master or not.
Cmt3()
Default constructor, initializes all members to their default values.
XsensResultValue getDeviceId(const uint8_t busId, CmtDeviceId &deviceId) const
Retrieve the DeviceId of a device given its Bus ID.
XsensResultValue getSerialBaudrate(uint32_t &baudrate)
Return the baud rate used for serial communication.
XsensResultValue closePort(bool gotoConfigFirst=true)
Close the communication port.
XsensResultValue getUtcTime(CmtUtcTime &utc, const CmtDeviceId deviceId)
Return the UTC time of the last received sample.
uint32_t m_timeoutMeas
The measurement mode timeout.
bool m_readFromFile
Indicates whether to read from the log file or from the serial port.
XsensResultValue getBluetoothState(bool &enabled)
Get the state of the bluetooth communication.
XsensResultValue getSyncOutPulseWidth(uint32_t &pulseWidth)
Retrieve the outbound synchronization pulse width of an MT device.
bool m_rtcInitialized
Indicates if the rtc is initialised or not.
XsensResultValue getConfiguration(CmtDeviceConfiguration &configuration)
Get device configuration.
XsensResultValue getSyncOutOffset(uint32_t &offset)
Retrieve the outbound synchronization offset of an MT device.
XsensResultValue setDeviceMode2(const CmtDeviceMode2 &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode2 of a device.
XsensResultValue setGpsLeverArm(const CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used GPS lever arm.
XsensResultValue getLogFileName(char *filename)
Retrieve the name of the open log file or an empty string if no logfile is open.
XsensResultValue setLocationId(uint16_t locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the location ID of a sensor.
CmtDeviceId getMasterId(void)
void * m_eMtsData[CMT_MAX_DEVICES_PER_PORT]
Cached eMTS data.
XsensResultValue getDeviceMode(CmtDeviceMode &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode.
XsensResultValue gotoConfig(void)
Place all connected devices into Configuration Mode.
XsensResultValue openLogFile(const char *filename)
Open a log file for input.
XsensResultValue restoreFactoryDefaults(const CmtDeviceId deviceId=CMT_DID_MASTER)
Restore the device to factory default settings.
XsensResultValue getSyncOutSettings(CmtSyncOutSettings &settings)
Retrieve the outbound synchronization settings of the master MT device.
XsensResultValue resetLogFileReadPos(void)
Restart reading from the start of the open log file.
bool m_useRtc
Indicates if the RTC should be computed or not (to save CPU time).
XsensResultValue closeLogFile(bool del=false)
Close an open log file.
XsensResultValue getHeading(double &heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the heading offset.
XsensResultValue gotoMeasurement(void)
Place all connected devices into Measurement Mode.
XsensResultValue initBus(void)
Perform an initBus request.
XsensResultValue peekLogMessageId(uint8_t &messageId)
Open a communication channel to the given COM port number.
XsensResultValue m_lastHwError
Contains the last error reported by hardware.
XsensResultValue getPortNr(uint8_t &port) const
Return the device Id of an MT device.
XsensResultValue getBusPowerState(bool &enabled)
Get the state of the Xbus power.
XsensResultValue openPort(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
XsensResultValue getBaudrate(uint32_t &baudrate)
Get the baudrate used by a port.
XsensResultValue getGravityMagnitude(double &magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the currently used magnitude of the gravity vector.
XsensResultValue getAvailableScenarios(CmtScenario *scenarios, const CmtDeviceId deviceId=CMT_DID_MASTER)
Write the specified message to the open log file.
XsensResultValue createLogFile(const char *filename, bool startLogging=false)
Create a log file for incoming messages.
XsensResultValue getLogFileReadPosition(CmtFilePos &pos)
Retrieve the read position of the log file.
XsensResultValue getProductCode(char *productCode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return product code.
XsensResultValue getScenario(uint8_t &scenarioType, uint8_t &scenarioVersion, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently active scenario from a Motion Tracker.
XsensResultValue getMagneticDeclination(double &declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the stored magnetic declination.
bool m_measuring
Keeps track of whether the connected device is measuring or being configured.
XsensResultValue setSyncInSkipFactor(const uint16_t skipFactor)
Set the inbound synchronization skip factor of an MT device.
XsensResultValue setSyncOutSettings(const CmtSyncOutSettings &settings)
Set the outbound synchronization settings of an MT device.
XsensResultValue setTimeoutConfig(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_CONF)
Set the configuration mode timeout.
XsensResultValue getFirmwareRevision(CmtVersion &revision, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return Firmware revision.
XsensResultValue setTimeoutMeasurement(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_MEAS)
Set the measurement mode timeout.
uint16_t getSampleFrequency(void)
Return current sample frequency.
XsensResultValue readDataPacket(Packet *pack, bool acceptOther=false)
Retrieve a data message.
uint16_t getMtCount(void) const
Return the device Id of the first device (master).
XsensResultValue setSyncOutSkipFactor(const uint16_t skipFactor)
Set the outbound synchronization skip factor of an MT device.
XsensResultValue getErrorMode(uint16_t &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the error mode of the device.
XsensResultValue refreshCache(const bool file=false)
Update device information stored on host PC.
XsensResultValue getSyncOutSkipFactor(uint16_t &skipFactor)
Retrieve the outbound synchronization skip factor of an MT device.
uint16_t m_skip
The skip factor of the port.
XsensResultValue getGpsStatus(CmtGpsStatus &status, const CmtDeviceId deviceId=CMT_DID_MASTER)
Request the status of the GPS satellites in orbit.
XsensResultValue setGotoConfigTries(const uint16_t tries)
Set the number of times the gotoConfig function will attempt a gotoConfig before failing.
XsensResultValue getBusId(uint8_t &busId, const CmtDeviceId deviceId=CMT_DID_MASTER) const
Retrieve the BusId of a device.
XsensResultValue getMtDeviceId(const uint8_t index, CmtDeviceId &deviceId) const
XsensResultValue setSyncInSettings(const CmtSyncInSettings &settings)
Set the inbound synchronization settings of an MT device.
XsensResultValue getSyncInSettings(CmtSyncInSettings &settings)
Retrieve the inbound synchronization settings of the master MT device.
CmtDeviceId m_lastHwErrorDeviceId
Contains the Device ID of the device that caused the last hardware error.
double m_rtcMsPerSample
ms per sample = 1000 / sample frequency.
XsensResultValue setHeading(const double heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the heading offset.
TimeStamp m_rtcStart
The start of the RTC counter, the time of arrival of sample 0.
XsensResultValue getBatteryLevel(uint8_t &level)
Get an Xbus Master's battery level.
XsensResultValue setSyncMode(const uint8_t mode)
Set the sync mode of the Xbus Master.
Cmt2s m_serial
The (optional) CMT level 2 serial object that this class operates on.
XsensResultValue requestData(Packet *pack)
XsensResultValue getGpsLeverArm(CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently used GPS lever arm.
XsensResultValue setScenario(const uint8_t scenarioType, const CmtDeviceId deviceId=CMT_DID_MASTER)
Specify the scenario to use in the sensor.
uint32_t getDeviceCount(void) const
Retrieve total device count.
XsensResultValue reset(void)
Request a data message and wait for it to arrive.
bool m_logging
Indicates whether to write all received messages to the logfile or not, automatically set to true by ...
XsensResultValue setDataSource(bool readFromFile)
Set whether to read from comm port or file.
XsensResultValue setSyncInMode(const uint16_t mode)
Set the inbound synchronization mode of an MT device.
XsensResultValue setSyncOutPulseWidth(const uint32_t pulseWidth)
Set the outbound synchronization pulse width of an MT device.
XsensResultValue getLogFileSize(CmtFilePos &size)
Retrieve the size of the open log file in bytes.
XsensResultValue getXmOutputMode(uint8_t &mode)
Return the dual-output mode of the XM.
uint32_t getTimeoutMeasurement(void) const
Return the measurement mode timeout.
XsensResultValue getSyncOutMode(uint16_t &mode)
Retrieve the outbound synchronization mode of an MT device.
XsensResultValue setGravityMagnitude(const double magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used magnitude of the gravity vector.
XsensResultValue setXmPowerOff(void)
Switch the connected Xbus Master.
XsensResultValue setSyncOutMode(const uint16_t mode)
Set the outbound synchronization mode of an MT device.
XsensResultValue resetOrientation(const CmtResetMethod method, const CmtDeviceId deviceId=CMT_DID_MASTER)
Perform an orientation reset on a device.
uint8_t getBusIdInternal(const CmtDeviceId devId) const
Find a device Id in the list and return its busId.
XsensResultValue setDeviceMode(const CmtDeviceMode &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode of a device.
XsensResultValue setErrorMode(const uint16_t mode)
Set the error mode of the device.
XsensResultValue getSyncInMode(uint16_t &mode)
Retrieve the inbound synchronization mode of an MT device.
XsensResultValue getSyncInSkipFactor(uint16_t &skipFactor)
Retrieve the inbound synchronization skip factor of an MT device.
uint32_t m_rtcCount
The long sample counter (normal counter wraps at 64k).
XsensResultValue getLocationId(uint16_t &locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the location ID of a sensor.
Class for storing a single message.
void setDataLong(const uint32_t data, const uint16_t offset=0)
Write an uint32_t (32 bits) into the data buffer.
uint8_t getDataByte(const uint16_t offset=0) const
Return the current value of the data as an unsigned byte (8 bits).
uint32_t getDataLong(const uint16_t offset=0) const
Return the current value of the data as an uint32_t (32 bits).
uint8_t * getDataBuffer(const uint16_t offset=0)
Return a pointer to the data buffer.
uint16_t getDataSize(void) const
Return the length of the data part of the message.
uint16_t getDataShort(const uint16_t offset=0) const
Return the current value of the data as an uint16_t (16 bits).
void setDataFloat(const float data, const uint16_t offset=0)
Write a float (32 bits) into the data buffer.
uint8_t getMessageId(void) const
Return the current value of the m_messageId field.
void setDataBuffer(const uint8_t *data, const uint16_t offset=0, const uint16_t count=0)
Write a string of bytes into the data buffer.
void setDataByte(const uint8_t data, const uint16_t offset=0)
Write an unsigned byte (8 bits) into the data buffer.
void setDataShort(const uint16_t data, const uint16_t offset=0)
Write an uint16_t (16 bits) into the data buffer.
float getDataFloat(const uint16_t offset=0) const
Return the current value of the data as a float (32 bits).
void setBusId(const uint8_t busId)
Set the new value of the m_busId field and update the checksum.
void setMessageId(const uint8_t msgId)
Set the new value of the m_messageId field and update the checksum.
const uint8_t * getMessageStart(void) const
Return the start of the message buffer.
void recomputeChecksum(void)
Compute the checksum field and fill it.
void resizeData(const uint16_t newSize)
Resize the data area to the given size.
A structure containing MT data + timestamp and formatting information.
void setXbus(bool xbus, bool convert=false)
TimeStamp m_toa
Time of arrival.
uint16_t m_itemCount
The number of data items in the message.
Message m_msg
The message.
TimeStamp m_rtc
Sample time in ms, based on the sample counter.
bool setDataFormat(const CmtDataFormat &format, const uint16_t index=0)
uint16_t getSampleCounter(const uint16_t index=0) const
Return the Sample Counter component of the packet.
#define DO_DATA_REQUEST(req)
#define DO_DATA_SET(req, size, type, data)
#define DO_DATA_SET_BID(req, size, type, data, bid)
#define HANDLE_ERR_RESULT
#define DO_DATA_REQUEST_BID(req, bid)
#define CMT_MID_SETGRAVITYMAGNITUDE
#define CMT_MID_REQDATALENGTH
#define CMT_MID_SETMAGNETICDECLINATION
#define CMT_MID_SETGPSLEVERARM
#define CMT_PARAM_SYNCIN_MODE
#define CMT_MID_REQOUTPUTSKIPFACTORACK
#define CMT_MID_REQOPMODE
#define CMT_DID_TYPEH_MTI_MTX
#define CMT_MAX_DEVICES_PER_PORT
#define CMT_LEN_ERRORMODE
#define CMT_MID_REQUTCTIME
#define CMT_BAUD_RATE_921K6
#define CMT_LEN_GPSLEVERARM
#define CMT_MID_REQXMERRORMODE
#define CMT_MID_GOTOCONFIGACK
#define CMT_PARAM_SYNCOUT_MODE
uint32_t CmtDeviceId
The type of a Device Id.
#define CMT_OUTPUTSETTINGS_TIMESTAMP_MASK
#define CMT_MAX_SCENARIOS_IN_MT
#define CMT_MID_REQPRODUCTCODE
#define CMT_MID_REQSYNCINSETTINGSACK
#define CMT_PARAM_SYNCIN_SKIPFACTOR
#define CMT_BAUD_RATE_19K2
#define CMT_LEN_BTDISABLE
#define CMT_MID_REQBAUDRATE
#define CMT_BAUD_RATE_230K4
#define CMT_BAUDCODE_38K4
#define CMT_BAUDCODE_115K2
#define CMT_MID_REQOUTPUTSKIPFACTOR
#define CMT_MID_REQOUTPUTSETTINGSACK
#define CMT_MID_STOREXKFSTATE
#define CMT_LEN_RESETORIENTATION
#define CMT_MID_REQFILTERSETTINGSACK
#define CMT_LEN_LOCATIONID
#define CMT_BAUDCODE_460K8
#define CMT_MID_SETSCENARIO
#define CMT_MID_REQOUTPUTMODEACK
#define CMT_MID_GOTOMEASUREMENTACK
#define CMT_CONF_BLOCKLEN
#define CMT_MID_REQSYNCOUTSETTINGS
#define CMT_BAUDCODE_19K2
#define CMT_MID_REQGPSSTATUS
#define CMT_BID_BROADCAST
#define CMT_BAUD_RATE_115K2
#define CMT_MID_REQMAGNETICDECLINATION
#define CMT_MID_REQFILTERSETTINGS
#define CMT_SYNC_CLOCK_TICKS_TO_NS
#define CMT_MID_REQHEADING
#define CMT_PARAM_SYNCOUT_PULSEWIDTH
#define CMT_LEN_SCENARIOLABEL
#define CMT_MID_STOREXKFSTATEACK
#define CMT_MID_REQPERIODACK
#define CMT_LEN_GRAVITYMAGNITUDE
#define CMT3_DEFAULT_TIMEOUT_CONF
The default timeout value for L3 configuration settings.
#define CMT_DID_TYPEH_MASK
#define CMT_LEN_SETSCENARIO
#define CMT_BAUD_RATE_57K6
#define CMT_MID_RESETORIENTATION
#define CMT_MID_REQSYNCMODE
#define CMT_MID_REQERRORMODE
#define CMT_MID_GOTOCONFIG
#define CMT_BAUD_RATE_9600
#define CMT_BAUDCODE_921K6
#define CMT_MID_GOTOMEASUREMENT
#define CMT_BAUDCODE_57K6
#define CMT_MID_REQGRAVITYMAGNITUDE
#define CMT_MID_REQCONFIGURATION
#define CMT_GOTO_CONFIG_TRIES
#define CMT_MID_REQBATLEVEL
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
#define CMT3_CONFIG_TIMEOUT
The timeout value for "goto config"-message acknowledgement.
#define CMT_MID_RESTOREFACTORYDEF
#define CMT_SYNC_CLOCK_NS_TO_TICKS
#define CMT_MID_REQGPSLEVERARM
#define CMT_MID_REQAVAILABLESCENARIOS
#define CMT_BAUD_RATE_460K8
#define CMT_MID_REQSYNCINSETTINGS
#define CMT_DID_TYPEH_MTIG
#define CMT_PARAM_SYNCOUT_SKIPFACTOR
#define CMT_MID_REQSYNCOUTSETTINGSACK
#define CMT_MID_REQBTDISABLE
#define CMT_PARAM_SYNCOUT_OFFSET
#define CMT_DID_BROADCAST
#define CMT_MID_REQPERIOD
#define CMT_LEN_MAGNETICDECLINATION
#define CMT_LEN_STOREXKFSTATE
#define CMT_MID_SETGPSLEVERARMACK
#define CMT_MID_REQOUTPUTSETTINGS
#define CMT_PARAM_SYNCIN_OFFSET
#define CMT_MID_REQLOCATIONID
#define CMT_MID_REQOUTPUTMODE
#define CMT_BAUDCODE_230K4
#define CMT_MID_CONFIGURATION
#define CMT3_DEFAULT_TIMEOUT_MEAS
The default timeout value for L3 data reading.
#define CMT_DEFAULT_PERIOD
#define CMT_BAUD_RATE_38K4
#define CMT_MAX_FILENAME_LENGTH
#define CMT_MID_REQSCENARIO
GLuint GLsizei GLsizei * length
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
int BASE_IMPEXP _strnicmp(const char *str, const char *subStr, size_t count) MRPT_NO_THROWS
An OS-independent version of strnicmp.
The namespace of all Xsens software since 2006.
uint32_t getTimeOfDay(tm *date_, time_t *secs_)
A platform-independent clock.
TimeStamp timeStampNow(void)
void msleep(uint32_t ms)
A platform-independent sleep routine.
uint64_t TimeStamp
A real-time timestamp (ms)
unsigned __int16 uint16_t
unsigned __int32 uint32_t
uint32_t m_outputSettings
Structure containing a full device configuration as returned by the ReqConfig message.
uint16_t m_numberOfDevices
uint32_t m_masterDeviceId
struct CmtDeviceConfiguration::_devInfo m_deviceInfo[CMT_MAX_DEVICES_PER_PORT]
uint8_t m_reservedForHost[32]
uint16_t m_outputSkipFactor
void readFromMessage(const void *message)
uint16_t m_samplingPeriod
uint16_t m_syncinSkipFactor
uint8_t m_reservedForClient[32]
A structure for storing device modes using period and skip factor (new default)
uint16_t getSampleFrequency(void) const
Return the sample frequency in Hz.
CmtOutputSettings m_outputSettings
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
CmtOutputMode m_outputMode
bool operator==(const CmtDeviceMode2 &dev) const
Check if all fields of the two structures are equal.
void setSampleFrequency(uint16_t freq)
Compute the period and skip factor from a sample frequency.
A structure for storing device modes.
uint16_t m_sampleFrequency
void getPeriodAndSkipFactor(uint16_t &period, uint16_t &skip) const
Compute the period and skip factor.
CmtOutputSettings m_outputSettings
bool operator==(const CmtDeviceMode &dev) const
Check if all fields of the two structures are equal.
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
CmtOutputMode m_outputMode
void setPeriodAndSkipFactor(uint16_t period, uint16_t skip)
Compute the sample frequency from a period and skip factor.
A structure for storing scenario information.
uint8_t m_type
The type of the scenario. When set to 255 in an operation, the 'current' scenario is used.
char m_filterType
The type of filter this scenario is intended for '3': XKF-3, '6': XKF-6.
uint8_t m_version
The version of the scenario.
char m_label[CMT_LEN_SCENARIOLABEL+1]
The label of the scenario.
A structure for storing sync in settings.
uint32_t m_offset
Offset in ns.
A structure for storing sync out settings.
uint32_t m_pulseWidth
Pulse width in ns.
uint32_t m_offset
Offset in ns.
A structure for storing UTC Time values.
uint8_t m_valid
When set to 1, the time is valid, when set to 2, the time part is valid, but the date may not be vali...
A structure for storing the firmware version.
const char * xsensResultText(const XsensResultValue result)
XsensResultValue
Xsens return values.
@ XRV_CONFIGCHECKFAIL
The in-config check of the device failed.
@ XRV_ALREADYOPEN
An I/O device is already opened with this object.
@ XRV_NOPORTOPEN
No serial port opened for reading/writing.
@ XRV_NOFILEOPEN
No file opened for reading/writing.
@ XRV_NOFILEORPORTOPEN
No file or serial port opened for reading/writing.
@ XRV_NOTFOUND
The requested item was not found.
@ XRV_INVALIDOPERATION
Operation is invalid at this point.
@ XRV_OK
Operation was performed successfully.
@ XRV_INVALIDPARAM
An invalid parameter is supplied.
@ XRV_NULLPTR
Tried to supply a NULL value where it is not allowed.
@ XRV_OTHER
Something else was received than was requested.
@ XRV_BAUDRATEINVALID
Baud rate does not comply with valid range.
@ XRV_INVALIDID
Invalid id supplied.
@ XRV_TIMEOUTNODATA
Operation aborted because of no data read.
#define XSENS_MS_PER_DAY
The number of milliseconds in a normal day.