Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
XsControl Class Reference

High level Motion Tracker (MT) management class. More...

#include <xscontrol_def.h>

Inheritance diagram for XsControl:
Inheritance graph
[legend]

Public Member Functions

XsDevicebroadcast () const
 Returns the broadcast device. More...
 
void clearHardwareError ()
 Clear the last hardware error. More...
 
void close ()
 Close all ports and files. More...
 
void closeCustomPort (int channelId)
 Closes a custom communication channel. More...
 
void closePort (const XsDeviceId &deviceId)
 Close the port that is used for communication with the given deviceId. More...
 
void closePort (const XsPortInfo &portinfo)
 Close the serial port that matches portinfo. More...
 
void closePort (const XsString &portname)
 Close the serial port with the given portname. More...
 
void closePort (XsDevice *device)
 Close the device port with the given XsDevice. More...
 
XsPortInfo customPortInfo (int channelId) const
 Returns the port information for a custom communication channel. More...
 
XSNOEXPORT void destruct ()
 
XsDevicedevice (const XsDeviceId &deviceId) const
 Returns the XsDevice interface object associated with the supplied deviceId. More...
 
int deviceCount () const
 Get the number of connected devices. More...
 
virtual std::vector< XsDeviceIddeviceIds () const
 Get the device IDs of all the connected devices. More...
 
XsOption disabledOptions () const
 Return the currently explicitly disabled options. More...
 
XsDeviceId dockDeviceId (const XsDeviceId &deviceId) const
 Get the device ID of the dock device for the given deviceId. More...
 
XsOption enabledOptions () const
 Return the currently enabled options. More...
 
virtual bool XSNOEXPORT finalizeOpenPort (Communicator *communicator, XsPortInfo &portinfo, uint32_t timeout, bool detectRs485)
 
void flushInputBuffers ()
 Clear the inbound data buffers of all devices. More...
 
XsDevicegetDeviceFromLocationId (uint16_t locationId) const
 Get the device of the device on the given locationId. More...
 
void gotoConfig ()
 Place all sensors connected through a serial port into Configuration Mode. More...
 
void gotoMeasurement ()
 Place all sensors connected through a serial port into Measurement Mode. More...
 
virtual bool isDeviceDocked (const XsDeviceId &deviceId) const
 Test if the given deviceId is docked. More...
 
virtual bool isDeviceWireless (const XsDeviceId &deviceId) const
 Test if the given deviceId is an MTw and if it is wirelessly connected. More...
 
XsResultValue lastHardwareError () const
 Get the last hardware error code. More...
 
XsDeviceId lastHardwareErrorDeviceId () const
 
XsResultValue lastResult () const
 Get the result value of the last operation. More...
 
XsString lastResultText () const
 Get the accompanying error text for the value returned by lastResult() More...
 
virtual bool loadFilterProfiles (const XsString &filename)
 Load filter profile definitions from a settings file with the given filename. More...
 
int mainDeviceCount () const
 Get the number of main devices. More...
 
std::vector< XsDeviceIdmainDeviceIds () const
 Get the device IDs of the available main devices. More...
 
XsDevicePtrArray mainDevices () const
 Returns all main XsDevice interface objects. More...
 
virtual int mtCount () const
 Get the number of connected MTs. More...
 
virtual std::vector< XsDeviceIdmtDeviceIds () const
 Get the device IDs of the available MTs. More...
 
bool openCustomPort (int channelId, uint32_t channelLatency, bool detectRs485=false)
 Open a custom communication channel. More...
 
virtual bool openImarPort_internal (const XsString &portname, XsBaudRate baudrate, int imarType, uint32_t timeout=0)
 Open a communication channel on serial port with the given portname. More...
 
bool openLogFile (const XsString &filename)
 Open the log file with the given filename. More...
 
bool openPort (const XsString &portname, XsBaudRate baudrate, uint32_t timeout=0, bool detectRs485=false)
 Open a communication channel on serial port with the given portname. More...
 
bool openPort (XsPortInfo &portinfo, uint32_t timeout=0, bool detectRs485=false)
 Open a communication channel using the details in the supplied XsPortInfo structure. More...
 
bool openPortWithCredentials (XsPortInfo &portinfo, XsString const &id, XsString const &key, uint32_t timeout=0)
 Open a communication channel using the details in the supplied XsPortInfo structure using the supplied credentials. More...
 
bool setInitialPositionLLA (const XsVector &lla)
 Sets the current GNSS position of the system. More...
 
void setOptions (XsOption enable, XsOption disable)
 Peristently enable or disable options. More...
 
void setOptionsForce (XsOption enabled)
 Peristently enable or disable options. More...
 
XsResultValue startRestoreCommunication (const XsString &portName)
 Starts restore communication procedure. More...
 
void stopRestoreCommunication ()
 Stops restore communication procedure. More...
 
void transmissionReceived (int channelId, const XsByteArray &data)
 Feed data coming back from an Xsens device over a custom channel into XDA. More...
 
 XsControl ()
 Construct a new Xsens Device API control object. More...
 
 ~XsControl ()
 Destroy this XsControl object. More...
 
- Public Member Functions inherited from CallbackManagerXda
void addCallbackHandler (XsCallbackPlainC *cb, bool chain=true)
 Add a handler to the list. More...
 
void addChainedManager (CallbackManagerXda *cm)
 Add a chained manager to the list. More...
 
 CallbackManagerXda ()
 Constructor, initializes the callback list. More...
 
void clearCallbackHandlers (bool chain=true)
 Clear the callback list. More...
 
void clearChainedManagers ()
 Clear the chained manager list. More...
 
void copyCallbackHandlersFrom (CallbackManagerXda *cm, bool chain=true)
 Copy all handlers from cm into this manager. More...
 
void copyCallbackHandlersTo (CallbackManagerXda *cm, bool chain=true)
 Copy all handlers from this manager into cm. More...
 
void onAllBufferedDataAvailable (XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
 The XsCallback::onAllBufferedDataAvailable() callback forwarding function. More...
 
void onAllDataAvailable (XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
 The XsCallback::onAllDataAvailable() callback forwarding function. More...
 
void onAllLiveDataAvailable (XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
 The XsCallback::onAllLiveDataAvailable() callback forwarding function. More...
 
void onAllRecordedDataAvailable (XsDevicePtrArray *devs, const XsDataPacketPtrArray *packets) override
 The XsCallback::onAllRecordedDataAvailable() callback forwarding function. More...
 
void onBufferedDataAvailable (XsDevice *dev, const XsDataPacket *data) override
 The XsCallback::onBufferedDataAvailable() callback forwarding function. More...
 
void onConnectivityChanged (XsDevice *dev, XsConnectivityState newState) override
 The XsCallback::onConnectivityChanged() callback forwarding function. More...
 
void onDataAvailable (XsDevice *dev, const XsDataPacket *data) override
 The XsCallback::onDataAvailable() callback forwarding function. More...
 
void onDataUnavailable (XsDevice *dev, int64_t packetId) override
 The XsCallback::onDataUnavailable() callback forwarding function. More...
 
void onDeviceStateChanged (XsDevice *dev, XsDeviceState newState, XsDeviceState oldState) override
 The XsCallback::onDeviceStateChanged() callback forwarding function. More...
 
void onError (XsDevice *dev, XsResultValue error) override
 The Xscallback::onError() callback forwarding function. More...
 
void onInfoResponse (XsDevice *dev, XsInfoRequest request) override
 The XsCallback::onInfoResponse() callback forwarding function. More...
 
void onLiveDataAvailable (XsDevice *dev, const XsDataPacket *packet) override
 The XsCallback::onLiveDataAvailable() callback forwarding function. More...
 
void onMessageDetected (XsDevice *dev, XsProtocolType type, XsByteArray const *rawMessage) override
 The Xscallback::onMessageReceivedFromDevice() callback forwarding function. More...
 
void onMessageReceivedFromDevice (XsDevice *dev, XsMessage const *message) override
 The Xscallback::onMessageReceivedFromDevice() callback forwarding function. More...
 
void onMessageSentToDevice (XsDevice *dev, XsMessage const *message) override
 The Xscallback::onMessageSentToDevice() callback forwarding function. More...
 
void onMissedPackets (XsDevice *dev, int count, int first, int last) override
 The XsCallback::onMissedPackets() callback forwarding function. More...
 
void onNonDataMessage (XsDevice *dev, XsMessage const *message) override
 The Xscallback::onNonDataMessage() callback forwarding function. More...
 
void onProgressUpdated (XsDevice *dev, int current, int total, const XsString *identifier) override
 The XsCallback::onProgressUpdated() callback forwarding function. More...
 
void onRecordedDataAvailable (XsDevice *dev, const XsDataPacket *data) override
 The XsCallback::onRecordedDataAvailable() callback forwarding function. More...
 
void onRestoreCommunication (const XsString *portName, XsResultValue result) override
 The Xscallback::onRestoreCommunication callback forwarding function. More...
 
void onTransmissionRequest (int channelId, const XsByteArray *data) override
 
void onWakeupReceived (XsDevice *dev) override
 The XsCallback::onWakeupReceived() callback forwarding function. More...
 
int onWriteMessageToLogFile (XsDevice *dev, const XsMessage *message) override
 The XsCallback::onWriteMessageToLogFile() callback forwarding function. More...
 
void removeCallbackHandler (XsCallbackPlainC *cb, bool chain=true)
 Remove a handler from the list. More...
 
void removeChainedManager (CallbackManagerXda *cm)
 Remove achained manager from the list. More...
 
 ~CallbackManagerXda ()
 Destructor, clears the callback list. More...
 

Static Public Member Functions

static XSNOEXPORT XsControlconstruct ()
 
static XsString resultText (XsResultValue resultCode)
 Get a descriptive text for the given resultCode. More...
 

Protected Member Functions

virtual XsDevice *XSNOCOMEXPORT addMasterDevice (Communicator *communicator)
 
void closePortByIndex (uint32_t index)
 
XsDevicefindDevice (const XsDeviceId &deviceId) const
 
CommunicatorfindXbusInterface (const XsDeviceId &deviceId) const
 Find the xs3 info of the given id. More...
 
CommunicatorfindXbusInterface (const XsPortInfo &portInfo) const
 
CommunicatorfindXbusInterface (const XsString &portName) const
 
virtual void removeExistingDevice (XsDeviceId const &deviceId)
 
void setPersistentSettings (XsDevice *dev)
 
void updateRecordingState ()
 
XSNOEXPORT XsControl (const XsControl &)=delete
 

Protected Attributes

BroadcastDevicem_broadcaster
 The broadcast device object. More...
 
XdaCommunicatorFactorym_communicatorFactory
 The communicator factory object. More...
 
DeviceFactorym_deviceFactory
 The device factory object. More...
 
std::vector< XsDevice * > m_deviceList
 This list contains device-information and cached data per device. More...
 
XsResultValue m_lastHwError
 Contains the last serious error reported by CMT3. More...
 
XsDeviceId m_lastHwErrorDeviceId
 Contains the XsDevice ID of the device that caused the last hardware error. More...
 
LastResultManager m_lastResult
 The last result of an operation. More...
 
XsVector3 m_latLonAlt
 This vector contains the latitude, longitude and altitude. More...
 
XsOption m_optionsDisable
 Contsins all disabled options. More...
 
XsOption m_optionsEnable
 Contains all enable options. More...
 
xsens::MutexReadWrite m_portMutex
 Controls access to the serial ports, also used to suspend the thread. More...
 
std::map< int, ProxyCommunicator * > m_proxyChannels
 This map contains the proxy channels. More...
 
volatile std::atomic_bool m_recording
 AwindaStationIndication of threads started or not. More...
 
RestoreCommunicationm_restoreCommunication
 The restore communication object. More...
 
xsens::Mutex m_runMutex
 Always held by the thread when it is running. More...
 
bool m_useFakeMessages
 Boolean variable for enabling/disabling the use of fake messages. More...
 

Detailed Description

High level Motion Tracker (MT) management class.

CMT version 2 and higher do not use the explicit error codes that CMT version 1 used. Most functions return a boolean indicating success, a null-object, empty lists or nothing at all. In some cases more in-depth knowledge of the last error is required. For these occasions, use lastResult() or lastResultText() to find out what exactly went wrong.

Note
This object cannot be copied. The copy constructor has been disabled.
See also
C Interface For the C interface functions.

Definition at line 131 of file xscontrol_def.h.

Constructor & Destructor Documentation

◆ XsControl() [1/2]

XsControl::XsControl ( )

Construct a new Xsens Device API control object.

Construct a new Xsens Device API control object that can be used to open ports, files, etc.

Returns
The newly constructed XsControl object

Definition at line 140 of file xscontrol_def.cpp.

◆ ~XsControl()

XsControl::~XsControl ( )

Destroy this XsControl object.

All connected devices are put in config mode. All serial ports and files are subsequently closed.

See also
close()

Definition at line 165 of file xscontrol_def.cpp.

◆ XsControl() [2/2]

XSNOEXPORT XsControl::XsControl ( const XsControl )
protecteddelete

Member Function Documentation

◆ addMasterDevice()

virtual XsDevice* XSNOCOMEXPORT XsControl::addMasterDevice ( Communicator communicator)
protectedvirtual

◆ broadcast()

XsDevice * XsControl::broadcast ( ) const

Returns the broadcast device.

The broadcast device can be used to apply an operation to all connected devices at once (if they support it)

Returns
An XsDevice pointer representing the broadcast device

Definition at line 968 of file xscontrol_def.cpp.

◆ clearHardwareError()

void XsControl::clearHardwareError ( )

Clear the last hardware error.

See also
lastHardwareError();

Definition at line 381 of file xscontrol_def.cpp.

◆ close()

void XsControl::close ( )

Close all ports and files.

All devices are put in config mode before the serial port is closed.

Definition at line 194 of file xscontrol_def.cpp.

◆ closeCustomPort()

void XsControl::closeCustomPort ( int  channelId)

Closes a custom communication channel.

Note
When closing a custom channel the device will not be switched to config mode. This must be done manually
See also
XsDevice::gotoConfig
Parameters
channelIdThe user-provided identifier of the channel to close. This identifier must match with the one used to open the port
See also
openCustomPort

Definition at line 833 of file xscontrol_def.cpp.

◆ closePort() [1/4]

void XsControl::closePort ( const XsDeviceId deviceId)

Close the port that is used for communication with the given deviceId.

Parameters
deviceIdThe device ID to clos eth port for. When 0, the first available port is closed.
Note
When the port hosts multiple devices, this function will make all devices connected to the port invalid.

Definition at line 281 of file xscontrol_def.cpp.

◆ closePort() [2/4]

void XsControl::closePort ( const XsPortInfo portinfo)

Close the serial port that matches portinfo.

All connected devices are put in config mode before the port is closed.

Parameters
portinfoA port information structure that contains the name of the port to close
See also
closePort(const XsString&)

Definition at line 293 of file xscontrol_def.cpp.

◆ closePort() [3/4]

void XsControl::closePort ( const XsString portname)

Close the serial port with the given portname.

All connected devices are put in config mode before the port is closed.

Parameters
portnamethe name of the port to close (e.g. COM1 on Windows, /dev/ttyUSB0 on Linux)

Definition at line 260 of file xscontrol_def.cpp.

◆ closePort() [4/4]

void XsControl::closePort ( XsDevice device)

Close the device port with the given XsDevice.

All connected devices are put in config mode before the port is closed.

Parameters
devicethe XsDevice obtained with the device() function
See also
device()

Definition at line 239 of file xscontrol_def.cpp.

◆ closePortByIndex()

void XsControl::closePortByIndex ( uint32_t  index)
protected

◆ construct()

XsControl * XsControl::construct ( )
static

Definition at line 1183 of file xscontrol_def.cpp.

◆ customPortInfo()

XsPortInfo XsControl::customPortInfo ( int  channelId) const

Returns the port information for a custom communication channel.

Parameters
channelIdThe user-provided identifier of the channel
Returns
The port info for the given channel
See also
openCustomPort

Definition at line 820 of file xscontrol_def.cpp.

◆ destruct()

XSNOEXPORT void XsControl::destruct ( )
inline

Definition at line 205 of file xscontrol_def.h.

◆ device()

XsDevice * XsControl::device ( const XsDeviceId deviceId) const

Returns the XsDevice interface object associated with the supplied deviceId.

Parameters
deviceIdThe ID of the device to return, 0 to return the first available main device
Returns
The XsDevice attached to the deviceId or 0 if the device was not found
See also
broadcast()

Definition at line 947 of file xscontrol_def.cpp.

◆ deviceCount()

int XsControl::deviceCount ( ) const

Get the number of connected devices.

Returns
The number of connected devices

Definition at line 317 of file xscontrol_def.cpp.

◆ deviceIds()

std::vector< XsDeviceId > XsControl::deviceIds ( ) const
virtual

Get the device IDs of all the connected devices.

Returns
Vector containing the device IDs of all the connected devices.

Definition at line 333 of file xscontrol_def.cpp.

◆ disabledOptions()

XsOption XsControl::disabledOptions ( ) const

Return the currently explicitly disabled options.

Returns
The options that are set to be explicitly disabled
See also
setOptions
enabledOptions

Definition at line 1118 of file xscontrol_def.cpp.

◆ dockDeviceId()

XsDeviceId XsControl::dockDeviceId ( const XsDeviceId deviceId) const

Get the device ID of the dock device for the given deviceId.

This function returns the ID of the docking station that deviceId is plugged into. If the docking station itself is not an open port in this XsControl or the device is not plugged into a docking station, the function will return a 0 id.

Parameters
deviceIdthe ID of the device to find the dock parent for
Returns
the ID of the device that has deviceId docked
See also
isDeviceDocked

Definition at line 898 of file xscontrol_def.cpp.

◆ enabledOptions()

XsOption XsControl::enabledOptions ( ) const

Return the currently enabled options.

Returns
The options that are set to be enabled
See also
setOptions
disabledOptions

Definition at line 1109 of file xscontrol_def.cpp.

◆ finalizeOpenPort()

virtual bool XSNOEXPORT XsControl::finalizeOpenPort ( Communicator communicator,
XsPortInfo portinfo,
uint32_t  timeout,
bool  detectRs485 
)
virtual

◆ findDevice()

XsDevice* XsControl::findDevice ( const XsDeviceId deviceId) const
protected

◆ findXbusInterface() [1/3]

Communicator* XsControl::findXbusInterface ( const XsDeviceId deviceId) const
protected

Find the xs3 info of the given id.

◆ findXbusInterface() [2/3]

Communicator* XsControl::findXbusInterface ( const XsPortInfo portInfo) const
protected

◆ findXbusInterface() [3/3]

Communicator* XsControl::findXbusInterface ( const XsString portName) const
protected

◆ flushInputBuffers()

void XsControl::flushInputBuffers ( )

Clear the inbound data buffers of all devices.

Definition at line 302 of file xscontrol_def.cpp.

◆ getDeviceFromLocationId()

XsDevice * XsControl::getDeviceFromLocationId ( uint16_t  locationId) const

Get the device of the device on the given locationId.

If the location ID is not found, the lastResult value is set and the function returns a nullptr.

Parameters
locationIdthe location ID of the device we're looking for
Returns
a pointer to the device for locationId
See also
lastResult()

Definition at line 362 of file xscontrol_def.cpp.

◆ gotoConfig()

void XsControl::gotoConfig ( )

Place all sensors connected through a serial port into Configuration Mode.

This function is called before close() in the destructor of the class. /sa close()

Definition at line 510 of file xscontrol_def.cpp.

◆ gotoMeasurement()

void XsControl::gotoMeasurement ( )

Place all sensors connected through a serial port into Measurement Mode.

The function places the sensors in measurement mode in the appropriate order as they are sorted by sortBySync.

Definition at line 524 of file xscontrol_def.cpp.

◆ isDeviceDocked()

bool XsControl::isDeviceDocked ( const XsDeviceId deviceId) const
virtual

Test if the given deviceId is docked.

Only wireless devices can be regarded as docked.

\param deviceId the ID of the device to investigate

\returns true if the device is docked, false otherwise

Definition at line 558 of file xscontrol_def.cpp.

◆ isDeviceWireless()

bool XsControl::isDeviceWireless ( const XsDeviceId deviceId) const
virtual

Test if the given deviceId is an MTw and if it is wirelessly connected.

If the device ID is not found, the function returns false and the lastResult value is set.

Parameters
deviceIdthe ID of the device to investigate
Returns
true if the device is wirelessly connected, false otherwise

Definition at line 572 of file xscontrol_def.cpp.

◆ lastHardwareError()

XsResultValue XsControl::lastHardwareError ( ) const

Get the last hardware error code.

Returns
The last hardware error
See also
lastResult()
resultText()

Definition at line 392 of file xscontrol_def.cpp.

◆ lastHardwareErrorDeviceId()

XsDeviceId XsControl::lastHardwareErrorDeviceId ( ) const
Returns
The device ID that caused the last hardware error.

Definition at line 399 of file xscontrol_def.cpp.

◆ lastResult()

XsResultValue XsControl::lastResult ( ) const

Get the result value of the last operation.

The result values are codes that describe a failure in more detail.

Returns
the last known error code
See also
resultText(XsResultValue), lastResultText()

Definition at line 409 of file xscontrol_def.cpp.

◆ lastResultText()

XsString XsControl::lastResultText ( ) const

Get the accompanying error text for the value returned by lastResult()

This is more than a convenience function for

XsString lastResultText = XsControl::resultText(xscontrol->lastResult());

It may provide situation-specific information instead.

Returns
a human readable error description
See also
resultText(XsResultValue), lastResult()

Definition at line 423 of file xscontrol_def.cpp.

◆ loadFilterProfiles()

bool XsControl::loadFilterProfiles ( const XsString filename)
virtual

Load filter profile definitions from a settings file with the given filename.

To use the filtering properly, XDA requires filter settings usually stored in a scenarios.xsb file. XSB is the Xsens Settings Binary format. This function allows you to specify the full path + filename to use instead of the default filter profiles embedded in the dll.

Parameters
filenameThe full path+filename to use for loading the parameters. When empty, the default filter profiles are loaded. On Linux this is "./scenarios.xsb", on Windows it is read from the dll resource.
Returns
true on success, false on failure

Definition at line 1086 of file xscontrol_def.cpp.

◆ mainDeviceCount()

int XsControl::mainDeviceCount ( ) const

Get the number of main devices.

Returns
the number of main devices
See also
mainDeviceIds(), mainDeviceId(const XsDeviceId&)

Definition at line 432 of file xscontrol_def.cpp.

◆ mainDeviceIds()

std::vector< XsDeviceId > XsControl::mainDeviceIds ( ) const

Get the device IDs of the available main devices.

Main devices are the devices communicating with the serial port, typically Bodypacks, Awinda Stations and stand-alone MTis or MTxs.

Returns
a std::vector with the device IDs.

Definition at line 466 of file xscontrol_def.cpp.

◆ mainDevices()

XsDevicePtrArray XsControl::mainDevices ( ) const

Returns all main XsDevice interface objects.

Returns
A list containing pointers to the main device XsDevice objects

Definition at line 955 of file xscontrol_def.cpp.

◆ mtCount()

int XsControl::mtCount ( ) const
virtual

Get the number of connected MTs.

Returns
the number of MTs, including both main and child devices.
See also
mtDeviceIds()

Definition at line 446 of file xscontrol_def.cpp.

◆ mtDeviceIds()

std::vector< XsDeviceId > XsControl::mtDeviceIds ( ) const
virtual

Get the device IDs of the available MTs.

Returns
A std::vector with the device IDs.
See also
mtCount

Definition at line 485 of file xscontrol_def.cpp.

◆ openCustomPort()

bool XsControl::openCustomPort ( int  channelId,
uint32_t  channelLatency,
bool  detectRs485 = false 
)

Open a custom communication channel.

Parameters
channelIdUser-provided identifier for the custom channel. Supplying the same channel Id more than once gives a XV_ALREADYOPEN result (
See also
getLastResult)
Parameters
channelLatencyThe worst-case round-trip delay in milliseconds induced by the custom channel. XDA will add this latency to its communication timeout values
detectRs485Enable more extended scan to detect rs485 devices
Returns
true if the port was successfully opened.
See also
closeCustomPort
transmissionReceived

Definition at line 792 of file xscontrol_def.cpp.

◆ openImarPort_internal()

bool XsControl::openImarPort_internal ( const XsString portname,
XsBaudRate  baudrate,
int  imarType,
uint32_t  timeout = 0 
)
virtual

Open a communication channel on serial port with the given portname.

If opening the port is successful, the connected devices are available through the XsControl interface.

The expected value for portname on Microsoft Windows platforms is "COMx" where x is the port number.

Parameters
baudrateThe baudrate used on the port.
portnameThe name of the port.
imarTypeThe type of iMAR device that is used
timeoutThe maximum number of ms to try to put the device in config mode before giving up, if 0 the default value is used
Returns
true on success, false otherwise
See also
openPort(int, XsBaudRate, bool)

Definition at line 880 of file xscontrol_def.cpp.

◆ openLogFile()

bool XsControl::openLogFile ( const XsString filename)

Open the log file with the given filename.

Returns
True is the file was opened successfully. False if an error was encountered.
\param filename the name of the file to open

\returns true on success, false on failure
See also
lastResult(), loadLogFile(), logFileName()

Definition at line 609 of file xscontrol_def.cpp.

◆ openPort() [1/2]

bool XsControl::openPort ( const XsString portname,
XsBaudRate  baudrate,
uint32_t  timeout = 0,
bool  detectRs485 = false 
)

Open a communication channel on serial port with the given portname.

If opening the port is successful, the connected devices are available through the XsControl interface.

The expected value for portname on Microsoft Windows platforms is "COMx" where x is the port number.

Parameters
baudrateThe baudrate used on the port.
portnameThe name of the port.
timeoutThe maximum number of ms to try to put the device in config mode before giving up, if 0 the default value is used
[in]detectRs485Enable more extended scan to detect rs485 devices
Returns
true on success, false otherwise
See also
openPort(int, XsBaudRate, uint32_t, bool)

Definition at line 684 of file xscontrol_def.cpp.

◆ openPort() [2/2]

bool XsControl::openPort ( XsPortInfo portinfo,
uint32_t  timeout = 0,
bool  detectRs485 = false 
)

Open a communication channel using the details in the supplied XsPortInfo structure.

Parameters
portinfoContains the details of the port to open. The portinfo may be updated with a detected deviceid
timeoutThe maximum number of ms to try to put the device in config mode before giving up, if 0 the default value is used
[in]detectRs485Enable more extended scan to detect rs485 devices. Only necessary if portInfo does not contain a device ID of an RS485 device
Returns
true on success, false otherwise
See also
openPort(const XsString &, XsBaudRate, uint32_t)

Definition at line 739 of file xscontrol_def.cpp.

◆ openPortWithCredentials()

bool XsControl::openPortWithCredentials ( XsPortInfo portinfo,
XsString const &  id,
XsString const &  key,
uint32_t  timeout = 0 
)

Open a communication channel using the details in the supplied XsPortInfo structure using the supplied credentials.

Parameters
portinfoContains the details of the connection to open. The device ID in the structure may be updated by this function.
idThe user ID to be supplied for the authentication
keyThe key to be supplied for the authentication
timeoutThe maximum number of ms to try to put the device in config mode before giving up, if 0 the default value is used
Returns
true on success, false otherwise
See also
openPort(const XsPortInfo &, uint32_t, bool)
openPort(const XsString &, XsBaudRate, uint32_t)

Definition at line 765 of file xscontrol_def.cpp.

◆ removeExistingDevice()

virtual void XsControl::removeExistingDevice ( XsDeviceId const &  deviceId)
protectedvirtual

◆ resultText()

XsString XsControl::resultText ( XsResultValue  resultCode)
static

Get a descriptive text for the given resultCode.

Parameters
resultCodeThe result code to translate
Returns
The resultCode translated into an XsString

Definition at line 186 of file xscontrol_def.cpp.

◆ setInitialPositionLLA()

bool XsControl::setInitialPositionLLA ( const XsVector lla)

Sets the current GNSS position of the system.

This function will update the Latitude, Longitude and Altitude of the system and all connected devices. This differs from broadcast()->setInitialPositionLLA() in that the setting is persistent for the XsControl and will be applied to devices connected after the setting has been made. Note: this XDA data type is the setting initialPositionLLA, which is set by setInitialPositionLLA. It's value is therefore static. Use LatitudeLongitude to retrieve the live position data from the MTi.

Parameters
llaA vector containing the desired Latitude, Longitude and Altitude
Returns
true since the function always succeeds, the boolean return value is for consistency in the interface.

Definition at line 935 of file xscontrol_def.cpp.

◆ setOptions()

void XsControl::setOptions ( XsOption  enable,
XsOption  disable 
)

Peristently enable or disable options.

These options are used to specify whether XDA should compute certain kinds of data from available other data and what data-retention policy to use. On a system with limited resources it may be useful to limit the processing and data retention done by XDA. By default XDA will do all processing it can do, but retain as little data as possible. This function remembers the setting and applies it to new devices when they are created as well as broadcasting it to existing devices. In case of conflict, enable supersedes disable.

Parameters
enableA logically OR'ed combination of XsOptions to enable
disableA logically OR'ed combination of XsOptions to disable
Note
While XsDevice uses these options in an additional manner, remembering whatever was enabled/disabled before, calling the XsControl version replaces all its remembered enable/disable values.
See also
setOptionsForce

Definition at line 1137 of file xscontrol_def.cpp.

◆ setOptionsForce()

void XsControl::setOptionsForce ( XsOption  enabled)

Peristently enable or disable options.

These options are used to specify whether XDA should compute certain kinds of data from available other data and what data-retention policy to use. On a system with limited resources it may be useful to limit the processing and data retention done by XDA. By default XDA will do all processing it can do, but retain as little data as possible. This function remembers the setting and applies it to new devices when they are created as well as broadcasting it to existing devices. Any non-enabled options are explicitly disabled.

Parameters
enabledA logically OR'ed combination of the desired enabled XsOptions
Note
Contrary to setOptions this function will do a hard override of all options of the child devices as it will assume that any non-enabled option should be specifically disabled.
See also
setOptions

Definition at line 1157 of file xscontrol_def.cpp.

◆ setPersistentSettings()

void XsControl::setPersistentSettings ( XsDevice dev)
protected

◆ startRestoreCommunication()

XsResultValue XsControl::startRestoreCommunication ( const XsString portName)

Starts restore communication procedure.

Restores the communication settings to the default factory settings.

Note
Works with RS422 and legacy products only.
Parameters
portNamethe name of port to which device is connected.
Returns
XRV_OK if restore communication procedure was successful.

Definition at line 538 of file xscontrol_def.cpp.

◆ stopRestoreCommunication()

void XsControl::stopRestoreCommunication ( )

Stops restore communication procedure.

Definition at line 545 of file xscontrol_def.cpp.

◆ transmissionReceived()

void XsControl::transmissionReceived ( int  channelId,
const XsByteArray data 
)

Feed data coming back from an Xsens device over a custom channel into XDA.

Note
For correct operation of XDA it is key that the transmissionReceived function is called from a separate thread
Parameters
channelIdThe user-provided identifier of the custom channel
dataThe data to feed back into XDA

Definition at line 857 of file xscontrol_def.cpp.

◆ updateRecordingState()

void XsControl::updateRecordingState ( )
protected

Member Data Documentation

◆ m_broadcaster

BroadcastDevice* XsControl::m_broadcaster
protected

The broadcast device object.

Definition at line 268 of file xscontrol_def.h.

◆ m_communicatorFactory

XdaCommunicatorFactory* XsControl::m_communicatorFactory
protected

The communicator factory object.

Definition at line 285 of file xscontrol_def.h.

◆ m_deviceFactory

DeviceFactory* XsControl::m_deviceFactory
protected

The device factory object.

Definition at line 282 of file xscontrol_def.h.

◆ m_deviceList

std::vector<XsDevice*> XsControl::m_deviceList
protected

This list contains device-information and cached data per device.

Definition at line 230 of file xscontrol_def.h.

◆ m_lastHwError

XsResultValue XsControl::m_lastHwError
protected

Contains the last serious error reported by CMT3.

Definition at line 239 of file xscontrol_def.h.

◆ m_lastHwErrorDeviceId

XsDeviceId XsControl::m_lastHwErrorDeviceId
protected

Contains the XsDevice ID of the device that caused the last hardware error.

Definition at line 242 of file xscontrol_def.h.

◆ m_lastResult

LastResultManager XsControl::m_lastResult
mutableprotected

The last result of an operation.

Definition at line 236 of file xscontrol_def.h.

◆ m_latLonAlt

XsVector3 XsControl::m_latLonAlt
protected

This vector contains the latitude, longitude and altitude.

Definition at line 277 of file xscontrol_def.h.

◆ m_optionsDisable

XsOption XsControl::m_optionsDisable
protected

Contsins all disabled options.

Definition at line 274 of file xscontrol_def.h.

◆ m_optionsEnable

XsOption XsControl::m_optionsEnable
protected

Contains all enable options.

Definition at line 271 of file xscontrol_def.h.

◆ m_portMutex

xsens::MutexReadWrite XsControl::m_portMutex
mutableprotected

Controls access to the serial ports, also used to suspend the thread.

Definition at line 247 of file xscontrol_def.h.

◆ m_proxyChannels

std::map<int, ProxyCommunicator*> XsControl::m_proxyChannels
protected

This map contains the proxy channels.

Definition at line 233 of file xscontrol_def.h.

◆ m_recording

volatile std::atomic_bool XsControl::m_recording
protected

AwindaStationIndication of threads started or not.

Definition at line 252 of file xscontrol_def.h.

◆ m_restoreCommunication

RestoreCommunication* XsControl::m_restoreCommunication
protected

The restore communication object.

Definition at line 288 of file xscontrol_def.h.

◆ m_runMutex

xsens::Mutex XsControl::m_runMutex
mutableprotected

Always held by the thread when it is running.

Definition at line 249 of file xscontrol_def.h.

◆ m_useFakeMessages

bool XsControl::m_useFakeMessages
protected

Boolean variable for enabling/disabling the use of fake messages.

Definition at line 227 of file xscontrol_def.h.


The documentation for this class was generated from the following files:
XsControl::lastResultText
XsString lastResultText() const
Get the accompanying error text for the value returned by lastResult()
Definition: xscontrol_def.cpp:423
XsControl::resultText
static XsString resultText(XsResultValue resultCode)
Get a descriptive text for the given resultCode.
Definition: xscontrol_def.cpp:186
XsString
A 0-terminated managed string of characters.


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:22