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");
#define CMT_MID_REQAVAILABLESCENARIOS
void fillRtc(Packet *pack)
Internal function to compute the RTC value.
#define CMT_MID_REQBTDISABLE
XsensResultValue initBus(void)
Perform an initBus request.
void readFromMessage(const void *message)
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".
#define CMT_MID_REQGPSLEVERARM
uint32_t getDataLong(const uint16_t offset=0) const
Return the current value of the data as an uint32_t (32 bits).
A structure for storing the firmware version.
Operation was performed successfully.
char m_filterType
The type of filter this scenario is intended for '3': XKF-3, '6': XKF-6.
CmtDeviceId getMasterId(void)
XsensResultValue getSyncOutSkipFactor(uint16_t &skipFactor)
Retrieve the outbound synchronization skip factor of an MT device.
XsensResultValue getSyncMode(uint8_t &mode)
Retrieve the sync mode of the Xbus Master.
XsensResultValue getMagneticDeclination(double &declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the stored magnetic declination.
#define CMT_GOTO_CONFIG_TRIES
#define CMT_MID_REQSYNCOUTSETTINGSACK
XsensResultValue getPortNr(uint8_t &port) const
Return the device Id of an MT device.
#define DO_DATA_REQUEST_BID(req, bid)
double m_rtcMsPerSample
ms per sample = 1000 / sample frequency.
uint8_t m_type
The type of the scenario. When set to 255 in an operation, the 'current' scenario is used...
XsensResultValue setSyncOutSkipFactor(const uint16_t skipFactor)
Set the outbound synchronization skip factor of an MT device.
#define CMT_PARAM_SYNCOUT_SKIPFACTOR
uint16_t m_skip
The skip factor of the port.
TimeStamp m_toa
Time of arrival.
TimeStamp m_rtcStart
The start of the RTC counter, the time of arrival of sample 0.
unsigned __int16 uint16_t
Mid-level serial communication class.
XsensResultValue setBusPowerState(const bool enabled)
Switch the Xbus Master bus power on or off.
uint32_t getDeviceCount(void) const
Retrieve total device count.
XsensResultValue getGpsLeverArm(CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently used GPS lever arm.
XsensResultValue openPort(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
XsensResultValue setSyncOutPulseWidth(const uint32_t pulseWidth)
Set the outbound synchronization pulse width of an MT device.
#define CMT_MID_CONFIGURATION
XsensResultValue open(const char *filename, const bool readOnly=false)
Open a file and read the header.
#define CMT_MID_SETGPSLEVERARM
#define CMT_MID_REQBATLEVEL
XsensResultValue getGpsStatus(CmtGpsStatus &status, const CmtDeviceId deviceId=CMT_DID_MASTER)
Request the status of the GPS satellites in orbit.
uint8_t m_version
The version of the scenario.
bool m_readFromFile
Indicates whether to read from the log file or from the serial port.
#define XSENS_MS_PER_DAY
The number of milliseconds in a normal day.
#define CMT_MID_REQOUTPUTMODE
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...
#define CMT_MID_REQPERIODACK
XsensResultValue refreshCache(const bool file=false)
Update device information stored on host PC.
void resizeData(const uint16_t newSize)
Resize the data area to the given size.
#define CMT_MID_GOTOMEASUREMENT
#define CMT_LEN_RESETORIENTATION
XsensResultValue getSyncOutPulseWidth(uint32_t &pulseWidth)
Retrieve the outbound synchronization pulse width of an MT device.
Operation aborted because of no data read.
XsensResultValue getBatteryLevel(uint8_t &level)
Get an Xbus Master's battery level.
#define CMT_MID_REQSYNCOUTSETTINGS
Cmt2f * getCmt2f(void)
Return a reference to the embedded Cmt2f (logfile) object.
#define CMT_BAUD_RATE_230K4
XsensResultValue getLogFileReadPosition(CmtFilePos &pos)
Retrieve the read position of the log file.
XsensResultValue getDeviceId(const uint8_t busId, CmtDeviceId &deviceId) const
Retrieve the DeviceId of a device given its Bus ID.
#define CMT_MID_REQOUTPUTSKIPFACTORACK
XsensResultValue getPortNr(uint8_t &port) const
Retrieve the port that the object is connected to.
#define CMT_MAX_FILENAME_LENGTH
uint32_t m_offset
Offset in ns.
XsensResultValue setDeviceMode(const CmtDeviceMode &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode of a device.
XsensResultValue readDataPacket(Packet *pack, bool acceptOther=false)
Retrieve a data message.
bool m_logging
Indicates whether to write all received messages to the logfile or not, automatically set to true by ...
A structure for storing sync out settings.
XsensResultValue getDeviceMode(CmtDeviceMode &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode.
#define CMT_BAUD_RATE_9600
uint8_t m_reservedForClient[32]
uint32_t m_rtcCount
The long sample counter (normal counter wraps at 64k).
XsensResultValue restoreFactoryDefaults(const CmtDeviceId deviceId=CMT_DID_MASTER)
Restore the device to factory default settings.
#define CMT_MID_REQSYNCMODE
XsensResultValue resetLogFileReadPos(void)
Restart reading from the start of the open log file.
XsensResultValue getLastResult(void) const
Return the error code of the last operation.
XsensResultValue setSyncInMode(const uint16_t mode)
Set the inbound synchronization mode of an MT device.
XsensResultValue getLocationId(uint16_t &locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the location ID of a sensor.
#define CMT_DID_TYPEH_MASK
bool m_rtcInitialized
Indicates if the rtc is initialised or not.
bool isLogFileOpen(const char *filename) const
Return whether or not(true or false) the supplied file is open.
uint16_t m_gotoConfigTries
The number of times a goto config is attempted before the function fails.
#define DO_DATA_SET(req, size, type, data)
#define CMT_DID_TYPEH_MTI_MTX
#define CMT_MID_STOREXKFSTATE
XsensResultValue gotoMeasurement(void)
Place all connected devices into Measurement Mode.
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
uint16_t getDataSize(void) const
Return the length of the data part of the message.
A structure for storing UTC Time values.
XsensResultValue reset(void)
Request a data message and wait for it to arrive.
uint16_t m_itemCount
The number of data items in the message.
XsensResultValue getSyncInOffset(uint32_t &offset)
Retrieve the inbound synchronization offset of an MT device.
#define CMT_MID_REQUTCTIME
XsensResultValue getMtDeviceId(const uint8_t index, CmtDeviceId &deviceId) const
#define CMT_DID_BROADCAST
A structure for storing sync in settings.
uint16_t getSampleCounter(const uint16_t index=0) const
Return the Sample Counter component of the packet.
#define CMT_MID_REQGPSSTATUS
uint32_t m_pulseWidth
Pulse width in ns.
XsensResultValue getSyncInSettings(CmtSyncInSettings &settings)
Retrieve the inbound synchronization settings of the master MT device.
TimeStamp timeStampNow(void)
#define CMT_MID_REQSYNCINSETTINGSACK
uint32_t m_offset
Offset in ns.
XsensResultValue writeMessageToLogFile(const Message &msg)
XsensResultValue setErrorMode(const uint16_t mode)
Set the error mode of the device.
uint16_t getMtCount(void) const
Return the device Id of the first device (master).
XsensResultValue getName(char *filename) const
Retrieve the filename that was last successfully opened.
#define CMT_MID_SETGPSLEVERARMACK
#define CMT_MID_REQBAUDRATE
XsensResultValue setXmPowerOff(void)
Switch the connected Xbus Master.
uint16_t getDataShort(const uint16_t offset=0) const
Return the current value of the data as an uint16_t (16 bits).
#define CMT_BAUD_RATE_57K6
XsensResultValue setDeviceMode2(const CmtDeviceMode2 &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode2 of a device.
void getPeriodAndSkipFactor(uint16_t &period, uint16_t &skip) const
Compute the period and skip factor.
Operation is invalid at this point.
#define CMT_MID_GOTOMEASUREMENTACK
XsensResultValue getConfiguration(CmtDeviceConfiguration &configuration)
Get device configuration.
uint32_t getTimeOfDay(tm *date_, time_t *secs_)
A platform-independent clock.
void recomputeChecksum(void)
Compute the checksum field and fill it.
XsensResultValue getSyncOutSettings(CmtSyncOutSettings &settings)
Retrieve the outbound synchronization settings of the master MT device.
#define HANDLE_ERR_RESULT
XsensResultValue getHeading(double &heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the heading offset.
XsensResultValue getPortName(char *portname) const
bool isXm(void) const
Return whether the main device is an Xbus Master or not.
A structure containing MT data + timestamp and formatting information.
XsensResultValue closeLogFile(bool del=false)
Close an open log file.
bool operator==(const CmtDeviceMode &dev) const
Check if all fields of the two structures are equal.
Cmt2s * getCmt2s(void)
Return a reference to the embedded Cmt2s (comm port) object.
XsensResultValue setBaudrate(const uint32_t baudrate, bool reconnect=true)
Set the baudrate and possibly reconnect.
XsensResultValue getAvailableScenarios(CmtScenario *scenarios, const CmtDeviceId deviceId=CMT_DID_MASTER)
Write the specified message to the open log file.
XsensResultValue getBusId(uint8_t &busId, const CmtDeviceId deviceId=CMT_DID_MASTER) const
Retrieve the BusId of a device.
Cmt3()
Default constructor, initializes all members to their default values.
XsensResultValue setDataSource(bool readFromFile)
Set whether to read from comm port or file.
XsensResultValue setSyncOutSettings(const CmtSyncOutSettings &settings)
Set the outbound synchronization settings of an MT device.
XsensResultValue setMagneticDeclination(const double declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the stored magnetic declination.
#define CMT_MID_REQMAGNETICDECLINATION
uint8_t getBusIdInternal(const CmtDeviceId devId) const
Find a device Id in the list and return its busId.
TimeStamp m_rtc
Sample time in ms, based on the sample counter.
Structure containing a full device configuration as returned by the ReqConfig message.
XsensResultValue setGpsLeverArm(const CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used GPS lever arm.
XsensResultValue setXmOutputMode(const uint8_t mode)
Set the dual-output mode of the XM.
XsensResultValue requestData(Packet *pack)
#define CMT_MID_REQXMERRORMODE
The mid-level file communication class.
#define CMT_DEFAULT_PERIOD
CmtOutputMode m_outputMode
void msleep(uint32_t ms)
A platform-independent sleep routine.
float getDataFloat(const uint16_t offset=0) const
Return the current value of the data as a float (32 bits).
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
#define CMT_MID_REQERRORMODE
#define CMT_LEN_STOREXKFSTATE
uint16_t m_samplingPeriod
XsensResultValue getLogFileName(char *filename)
Retrieve the name of the open log file or an empty string if no logfile is open.
XsensResultValue openLogFile(const char *filename)
Open a log file for input.
bool operator==(const CmtDeviceMode2 &dev) const
Check if all fields of the two structures are equal.
XsensResultValue close(void)
Close the file.
#define DO_DATA_SET_BID(req, size, type, data, bid)
No serial port opened for reading/writing.
Baud rate does not comply with valid range.
#define CMT_DID_TYPEH_MTIG
Cmt1s * getCmt1s(void)
Return a reference to the embedded Cmt1s object.
#define CMT_MID_REQPRODUCTCODE
#define CMT_LEN_ERRORMODE
#define CMT_LEN_GRAVITYMAGNITUDE
XsensResultValue getErrorMode(uint16_t &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the error mode of the device.
XsensResultValue setGravityMagnitude(const double magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used magnitude of the gravity vector.
#define CMT_MID_REQOUTPUTMODEACK
struct CmtDeviceConfiguration::_devInfo m_deviceInfo[CMT_MAX_DEVICES_PER_PORT]
uint16_t m_numberOfDevices
XsensResultValue getScenario(uint8_t &scenarioType, uint8_t &scenarioVersion, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently active scenario from a Motion Tracker.
XsensResultValue
Xsens return values.
#define CMT_OUTPUTSETTINGS_TIMESTAMP_MASK
#define CMT_BAUDCODE_115K2
#define CMT_MID_REQFILTERSETTINGSACK
XsensResultValue createLogFile(const char *filename, bool startLogging=false)
Create a log file for incoming messages.
CmtDeviceId m_lastHwErrorDeviceId
Contains the Device ID of the device that caused the last hardware error.
#define CMT_MID_REQHEADING
#define CMT_MAX_SCENARIOS_IN_MT
#define CMT_MID_REQSYNCINSETTINGS
XsensResultValue closeAndDelete(void)
Close the file and delete it.
uint32_t m_timeoutMeas
The measurement mode timeout.
CmtFilePos getReadPosition(void)
Get the current read position.
Cmt2s m_serial
The (optional) CMT level 2 serial object that this class operates on.
XsensResultValue getUtcTime(CmtUtcTime &utc, const CmtDeviceId deviceId)
Return the UTC time of the last received sample.
void setSampleFrequency(uint16_t freq)
Compute the period and skip factor from a sample frequency.
XsensResultValue getSyncInMode(uint16_t &mode)
Retrieve the inbound synchronization mode of an MT device.
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
uint32_t m_outputSettings
#define CMT_PARAM_SYNCOUT_OFFSET
#define CMT_MID_REQSCENARIO
uint64_t TimeStamp
A real-time timestamp (ms)
#define CMT_MID_REQCONFIGURATION
XsensResultValue open(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
Open a communication channel to the given serial port name.
#define CMT_BAUD_RATE_38K4
#define CMT_MID_RESTOREFACTORYDEF
#define CMT_BAUD_RATE_460K8
XsensResultValue waitForMessage(Message *rcv, const uint8_t msgId, uint32_t timeoutOverride, bool acceptErrorMessage)
Wait for a message to arrive.
The requested item was not found.
#define CMT_MID_SETMAGNETICDECLINATION
void setDataFloat(const float data, const uint16_t offset=0)
Write a float (32 bits) into the data buffer.
#define CMT_MID_SETGRAVITYMAGNITUDE
#define CMT_BAUDCODE_230K4
XsensResultValue setSyncOutOffset(const uint32_t offset)
Set the outbound synchronization offset of an MT device.
The in-config check of the device failed.
#define CMT_LEN_SCENARIOLABEL
XsensResultValue getSerialBaudrate(uint32_t &baudrate)
Return the baud rate used for serial communication.
#define CMT_MID_REQOUTPUTSKIPFACTOR
#define CMT_BAUDCODE_57K6
XsensResultValue storeXkfState(const CmtDeviceId deviceId=CMT_DID_MASTER)
Store important components of the XKF filter state to non-volatile memory.
uint32_t getTimeoutConfig(void) const
Return the configuration mode timeout.
#define CMT_LEN_LOCATIONID
~Cmt3()
Destructor, de-initializes, frees memory allocated for buffers, etc.
void setDataLong(const uint32_t data, const uint16_t offset=0)
Write an uint32_t (32 bits) into the data buffer.
#define CMT_BID_BROADCAST
XsensResultValue getProductCode(char *productCode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return product code.
XsensResultValue getDataLength(uint32_t &length, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve data size.
#define CMT_PARAM_SYNCIN_OFFSET
#define CMT_CONF_BLOCKLEN
#define CMT_LEN_BTDISABLE
XsensResultValue setTimeoutMeasurement(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_MEAS)
Set the measurement mode timeout.
#define CMT_PARAM_SYNCIN_SKIPFACTOR
CmtOutputSettings m_outputSettings
#define CMT_PARAM_SYNCIN_MODE
CmtFilePos getFileSize(void)
Get the current file size.
uint32_t m_timeoutConf
The config mode timeout.
XsensResultValue setReadPosition(CmtFilePos pos)
Set the read position to the given position.
uint8_t * getDataBuffer(const uint16_t offset=0)
Return a pointer to the data buffer.
char m_label[CMT_LEN_SCENARIOLABEL+1]
The label of the scenario.
XsensResultValue getSyncOutMode(uint16_t &mode)
Retrieve the outbound synchronization mode of an MT device.
#define CMT_LEN_SETSCENARIO
A structure for storing device modes using period and skip factor (new default)
uint16_t m_sampleFrequency
#define CMT_BAUDCODE_460K8
#define CMT3_DEFAULT_TIMEOUT_MEAS
The default timeout value for L3 data reading.
uint8_t getMessageId(void) const
Return the current value of the m_messageId field.
void setPeriodAndSkipFactor(uint16_t period, uint16_t skip)
Compute the sample frequency from a period and skip factor.
XsensResultValue getEMtsData(void *buffer, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the eMts data of the specified sensor(s).
XsensResultValue setLocationId(uint16_t locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the location ID of a sensor.
bool m_measuring
Keeps track of whether the connected device is measuring or being configured.
XsensResultValue close(void)
Close the serial communication port.
XsensResultValue setTimeoutConfig(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_CONF)
Set the configuration mode timeout.
const uint8_t * getMessageStart(void) const
Return the start of the message buffer.
bool setDataFormat(const CmtDataFormat &format, const uint16_t index=0)
XsensResultValue setSyncInSettings(const CmtSyncInSettings &settings)
Set the inbound synchronization settings of an MT device.
uint8_t getPortNr(void) const
Retrieve the port number that was last successfully opened.
#define CMT_MID_GOTOCONFIGACK
#define CMT_BAUDCODE_38K4
CmtMtTimeStamp m_rtcLastSc
The last received sample counter, used to determine wrap-around.
XsensResultValue setTimeout(const uint32_t ms=CMT2_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
XsensResultValue m_lastResult
The last result of an operation.
bool isOpen(void) const
Return whether the communication port is open or not.
#define DO_DATA_REQUEST(req)
bool m_useRtc
Indicates if the RTC should be computed or not (to save CPU time).
#define CMT3_CONFIG_TIMEOUT
The timeout value for "goto config"-message acknowledgement.
#define CMT_MID_REQGRAVITYMAGNITUDE
XsensResultValue writeMessage(Message *msg)
Send a message over the COM port.
XsensResultValue m_lastHwError
Contains the last error reported by hardware.
XsensResultValue create(const char *filename)
Create a new file with level 2 header.
XsensResultValue setSyncInSkipFactor(const uint16_t skipFactor)
Set the inbound synchronization skip factor of an MT device.
GLuint GLsizei GLsizei * length
#define CMT_MID_REQDATALENGTH
#define CMT_BAUD_RATE_115K2
An invalid parameter is supplied.
XsensResultValue setSyncMode(const uint8_t mode)
Set the sync mode of the Xbus Master.
uint32_t getTimeoutMeasurement(void) const
Return the measurement mode timeout.
uint16_t getSampleFrequency(void)
Return current sample frequency.
#define CMT_MID_REQLOCATIONID
XsensResultValue setBluetoothState(const bool enabled)
Set the Bluetooth state of the Xbus Master.
#define CMT_MID_STOREXKFSTATEACK
Tried to supply a NULL value where it is not allowed.
#define CMT_LEN_MAGNETICDECLINATION
const char * xsensResultText(const XsensResultValue result)
#define CMT_BAUDCODE_921K6
uint8_t getDataByte(const uint16_t offset=0) const
Return the current value of the data as an unsigned byte (8 bits).
Something else was received than was requested.
XsensResultValue waitForDataMessage(Packet *pack)
Wait for a data message to arrive.
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...
bool isOpen(void) const
Return whether the file is open or not.
#define CMT_LEN_GPSLEVERARM
void setXbus(bool xbus, bool convert=false)
#define CMT_MID_RESETORIENTATION
XsensResultValue getDeviceMode2(CmtDeviceMode2 &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode2.
XsensResultValue setLogMode(bool active)
Set the logging mode.
The namespace of all Xsens software since 2006.
XsensResultValue peekLogMessageId(uint8_t &messageId)
Open a communication channel to the given COM port number.
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.
CmtDeviceConfiguration m_config
The configuration of the connected devices.
XsensResultValue resetOrientation(const CmtResetMethod method, const CmtDeviceId deviceId=CMT_DID_MASTER)
Perform an orientation reset on a device.
XsensResultValue getFirmwareRevision(CmtVersion &revision, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return Firmware revision.
XsensResultValue getSyncInSkipFactor(uint16_t &skipFactor)
Retrieve the inbound synchronization skip factor of an MT device.
CmtOutputSettings m_outputSettings
#define CMT_SYNC_CLOCK_TICKS_TO_NS
XsensResultValue getLogFileSize(CmtFilePos &size)
Retrieve the size of the open log file in bytes.
XsensResultValue getBluetoothState(bool &enabled)
Get the state of the bluetooth communication.
XsensResultValue closePort(bool gotoConfigFirst=true)
Close the communication port.
void setMessageId(const uint8_t msgId)
Set the new value of the m_messageId field and update the checksum.
XsensResultValue setScenario(const uint8_t scenarioType, const CmtDeviceId deviceId=CMT_DID_MASTER)
Specify the scenario to use in the sensor.
void setBusId(const uint8_t busId)
Set the new value of the m_busId field and update the checksum.
#define CMT_PARAM_SYNCOUT_PULSEWIDTH
#define CMT_MID_REQOUTPUTSETTINGS
#define CMT_PARAM_SYNCOUT_MODE
#define CMT_MID_REQOUTPUTSETTINGSACK
#define CMT_BAUD_RATE_921K6
#define CMT_SYNC_CLOCK_NS_TO_TICKS
void * m_eMtsData[CMT_MAX_DEVICES_PER_PORT]
Cached eMTS data.
XsensResultValue getBusPowerState(bool &enabled)
Get the state of the Xbus power.
uint16_t getSampleFrequency(void) const
Return the sample frequency in Hz.
A structure for storing device modes.
uint32_t m_masterDeviceId
CmtOutputMode m_outputMode
#define CMT_BAUD_RATE_19K2
XsensResultValue writeMessage(const Message *msg)
Write a message to the end of the file.
unsigned __int32 uint32_t
#define CMT_MID_GOTOCONFIG
XsensResultValue setSyncInOffset(const uint32_t offset)
Set the inbound synchronization offset of an MT device.
XsensResultValue getBaudrate(uint32_t &baudrate)
Get the baudrate used by a port.
#define CMT_MAX_DEVICES_PER_PORT
int BASE_IMPEXP _strnicmp(const char *str, const char *subStr, size_t count) MRPT_NO_THROWS
An OS-independent version of strnicmp.
uint32_t CmtDeviceId
The type of a Device Id.
#define CMT_BAUDCODE_19K2
XsensResultValue setHeading(const double heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the heading offset.
XsensResultValue setSyncOutMode(const uint16_t mode)
Set the outbound synchronization mode of an MT device.
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
An I/O device is already opened with this object.
A structure for storing scenario information.
uint8_t m_reservedForHost[32]
#define CMT_MID_REQPERIOD
uint16_t m_syncinSkipFactor
XsensResultValue getXmOutputMode(uint8_t &mode)
Return the dual-output mode of the XM.
void setDataByte(const uint8_t data, const uint16_t offset=0)
Write an unsigned byte (8 bits) into the data buffer.
XsensResultValue gotoConfig(void)
Place all connected devices into Configuration Mode.
Class for storing a single message.
uint16_t m_period
The sample period of the port.
#define CMT3_DEFAULT_TIMEOUT_CONF
The default timeout value for L3 configuration settings.
#define CMT_MID_SETSCENARIO
XsensResultValue setGotoConfigTries(const uint16_t tries)
Set the number of times the gotoConfig function will attempt a gotoConfig before failing.
#define CMT_MID_REQOPMODE
No file opened for reading/writing.
Cmt2f m_logFile
The (optional) CMT level 2 logfile object that this class operates on.
XsensResultValue flushData(void)
Flush all data to be transmitted / received.
XsensResultValue getGravityMagnitude(double &magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the currently used magnitude of the gravity vector.
void setDataShort(const uint16_t data, const uint16_t offset=0)
Write an uint16_t (16 bits) into the data buffer.
XsensResultValue getSyncOutOffset(uint32_t &offset)
Retrieve the outbound synchronization offset of an MT device.
XsensResultValue readMessage(Message *rcv)
Read a message from the COM port.
#define CMT_MID_REQFILTERSETTINGS
Message m_msg
The message.
No file or serial port opened for reading/writing.
uint16_t m_outputSkipFactor