10 #ifndef _CMT3_H_2006_04_14
11 #define _CMT3_H_2006_04_14
13 #ifndef _CMT_MONOLITHIC
144 bool isXm(
void)
const;
The mid-level file communication class.
Mid-level serial communication class.
bool isOpen(void) const
Return whether the communication port is open or not.
XsensResultValue setTimeout(const uint32_t ms=CMT2_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
High-level communication class.
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.
bool isPortOpen(void) const
<
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.
bool m_detailedScan
Automatically scan for device details during open. Default is true (recommended).
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.
Cmt3(const Cmt3 &ref)
This object cannot be copied, so this function is not implemented.
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.
uint16_t m_firstItem
The index of the first formatting item.
bool isLogging(void) const
<
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 setTimeout(const uint32_t ms)
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 getHwError(CmtDeviceId &did) const
<
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 getLastResult(void) const
<
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.
A structure containing MT data + timestamp and formatting information.
#define CMT_MAX_DEVICES_PER_PORT
uint32_t CmtDeviceId
The type of a Device Id.
#define CMT_DEFAULT_BAUD_RATE
The default baud rate of the Cmt1s serial communication.
#define CMT3_DEFAULT_TIMEOUT_CONF
The default timeout value for L3 configuration settings.
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
#define CMT3_DEFAULT_TIMEOUT_MEAS
The default timeout value for L3 data reading.
GLuint GLsizei GLsizei * length
The namespace of all Xsens software since 2006.
uint64_t TimeStamp
A real-time timestamp (ms)
unsigned __int16 uint16_t
unsigned __int32 uint32_t
Structure containing a full device configuration as returned by the ReqConfig message.
A structure for storing device modes using period and skip factor (new default)
A structure for storing device modes.
A structure for storing scenario information.
A structure for storing sync in settings.
A structure for storing sync out settings.
A structure for storing UTC Time values.
A structure for storing the firmware version.
XsensResultValue
Xsens return values.
@ XRV_OK
Operation was performed successfully.