Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Communicator Class Referenceabstract

A base struct for a communication interface. More...

#include <communicator.h>

Inheritance diagram for Communicator:
Inheritance graph
[legend]

Classes

struct  Deleter
 The communicator deleter. More...
 

Public Types

template<typename T >
using UniquePtr = std::unique_ptr< T, Deleter >
 Initializes of UniquePtr<T> More...
 

Public Member Functions

virtual void abortLoadLogFile ()=0
 Aborts loading a logfile. More...
 
virtual void addProtocolHandler (IProtocolHandler *handler)
 Adds a protocol handler. More...
 
std::shared_ptr< ReplyObjectaddReplyObject (ReplyObject *obj)
 Add a custom ReplyObject. More...
 
std::shared_ptr< ReplyObjectaddReplyObject (uint8_t mid)
 Add a MidReplyObject. More...
 
std::shared_ptr< ReplyObjectaddReplyObject (uint8_t mid, XsSize offset, XsSize size, uint8_t const *data)
 Add a MidAndDataReplyObject. More...
 
virtual bool allowReprocessing () const
 
XsSize childDeviceCount () const
 
virtual void closeLogFile ()=0
 Close the log file. More...
 
virtual void closePort ()=0
 Closes the open port. More...
 
 Communicator (void)
 Constructor, creates some management objects and clears the rest by calling initialize() More...
 
uint32_t defaultTimeout () const
 
void destroy ()
 Destroys the communicator. More...
 
bool doTransaction (const XsMessage &message)
 Write a message and await the reply. More...
 
bool doTransaction (const XsMessage &message, uint32_t timeout)
 Write a message and await the reply. More...
 
bool doTransaction (const XsMessage &message, XsMessage &rcv)
 Write a message and await the reply. More...
 
virtual bool doTransaction (const XsMessage &message, XsMessage &rcv, uint32_t timeout)=0
 Write a message and await the reply. More...
 
virtual void flushPort ()=0
 Flushes all remaining data on the open port. More...
 
virtual XsResultValue getDeviceId ()=0
 Request a device to get device ID. More...
 
virtual XsResultValue gotoConfig (bool detectRs485=false)=0
 Request a device to go to config mode. More...
 
virtual XsResultValue gotoMeasurement ()=0
 Request a device to go to measurement mode. More...
 
virtual void handleMessage (const XsMessage &message)
 Handles a message. More...
 
bool hasProtocol (XsProtocolType type) const
 
virtual bool isDockedAt (Communicator *other) const =0
 Returns true if the other device is docked at this device. More...
 
virtual bool isLoadLogFileInProgress () const
 
virtual bool isPortOpen () const =0
 
virtual bool isReadingFromFile () const =0
 
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() It may provide situation-specific information instead. More...
 
virtual void loadLogFile (XsDevice *device)=0
 Load a complete logfile. More...
 
virtual XsTimeStamp logFileDate () const =0
 
virtual XsString logFileName () const =0
 
virtual XsFilePos logFileReadPosition () const =0
 
virtual XsFilePos logFileSize () const =0
 
XsDeviceId masterDeviceId () const
 
virtual bool openLogFile (const XsString &filename)=0
 Open the log file `. More...
 
virtual bool openPort (const XsPortInfo &portInfo, OpenPortStage stage=OPS_Full, bool detectRs485=false)=0
 Opens a port. More...
 
virtual XsPortInfo portInfo () const =0
 
virtual XsMessage readMessage (uint8_t msgId=0)=0
 Read a message from the open file. More...
 
virtual XsMessage readMessageFromStartOfFile (uint8_t msgId, int maxMsgs=0)=0
 Read a message from the start of the open file. More...
 
virtual std::deque< XsMessagereadMessagesFromStartOfFile (uint8_t msgId, int maxMsgs=0)=0
 Read multiple similar messages from the start of the open file. More...
 
void removeProtocolHandler (XsProtocolType type)
 Removes a protocol handler. More...
 
virtual bool reopenPort (OpenPortStage stage=OPS_Full, bool skipDeviceIdCheck=false)=0
 Reopens the port. More...
 
virtual void resetLogFileReadPosition (void)=0
 Resets the logfile read position. More...
 
bool sanityCheck (XsMessage const &msg) const
 Do a sanity check on a potential message. More...
 
virtual void scheduleClosePort ()
 Schedules to close the open port. More...
 
virtual void setCredentials (XsString const &id, XsString const &key)
 Set the credentials required for using the device. More...
 
void setDefaultTimeout (uint32_t timeout)
 Sets a default timeout. More...
 
virtual void setGotoConfigTimeout (uint32_t timeout)=0
 Set the timeout for the gotoConfig function. More...
 
virtual void setKeepAlive (bool enable)=0
 Either disable or enable (default) the keep alive mechanism (if supported by the device) More...
 
void setMasterDevice (XsDevice *masterDevice)
 Sets a master device. More...
 
virtual void waitForLastTaskCompletion ()=0
 Wait for the last processing task to complete in the threadpool. More...
 
virtual bool writeMessage (const XsMessage &message)=0
 Write message to the device. 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 int configurationMessageSearchLimit ()
 
template<typename T >
static UniquePtr< T > createUniquePtr ()
 Constructs a new Communicator of type T and returns it as a UniquePtr<T> More...
 
template<typename T >
static UniquePtr< T > createUniquePtr (T *communicator)
 Creates a UniquePtr<T> from a Communicator*. More...
 

Protected Member Functions

XsDevicemasterDevice () const
 
virtual void prepareForDestruction ()
 Prepares communicator for destruction. More...
 
std::shared_ptr< ProtocolManagerprotocolManager () const
 
XsResultValue setAndReturnLastResult (XsResultValue lastResult, XsString const &text=XsString()) const
 Sets the last result and returns it. More...
 
void setLastResult (XsResultValue lastResult, XsString const &text=XsString()) const
 Sets the last result. More...
 
void setMasterDeviceId (const XsDeviceId &deviceId)
 Sets a master device ID. More...
 
virtual ~Communicator ()
 Destructor, waits for the last scheduled task to complete and then cleans up the object by calling clear() More...
 

Protected Attributes

uint32_t m_defaultTimeout
 A default timeout variable. More...
 
xsens::Mutex m_handleMux
 A handle mutex. More...
 
XsResultValue m_lastResult
 A last result variable. More...
 
XsString m_lastResultText
 A last result string. More...
 
XsDeviceId m_masterDeviceId
 A master device ID. More...
 
XsDevicem_masterInfo
 A master device object. More...
 
bool m_preparedForDestruction
 Prepared for destruction boolean variable. More...
 
std::shared_ptr< ProtocolManagerm_protocolManager
 A shared pointer to protocl manager. More...
 
std::unique_ptr< xsens::ReplyMonitorm_replyMonitor
 An unique pointer to a reply monitor. More...
 

Detailed Description

A base struct for a communication interface.

Definition at line 95 of file communicator.h.

Member Typedef Documentation

◆ UniquePtr

template<typename T >
using Communicator::UniquePtr = std::unique_ptr<T, Deleter>

Initializes of UniquePtr<T>

Definition at line 113 of file communicator.h.

Constructor & Destructor Documentation

◆ Communicator()

Communicator::Communicator ( void  )

Constructor, creates some management objects and clears the rest by calling initialize()

Definition at line 84 of file communicator.cpp.

◆ ~Communicator()

Communicator::~Communicator ( )
protectedvirtual

Destructor, waits for the last scheduled task to complete and then cleans up the object by calling clear()

Definition at line 105 of file communicator.cpp.

Member Function Documentation

◆ abortLoadLogFile()

virtual void Communicator::abortLoadLogFile ( )
pure virtual

Aborts loading a logfile.

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ addProtocolHandler()

void Communicator::addProtocolHandler ( IProtocolHandler handler)
virtual

Adds a protocol handler.

Parameters
handleran IProtocolHandler

Reimplemented in MtbFileCommunicator.

Definition at line 303 of file communicator.cpp.

◆ addReplyObject() [1/3]

std::shared_ptr< ReplyObject > Communicator::addReplyObject ( ReplyObject obj)

Add a custom ReplyObject.

Parameters
[in]objThe reply object to add
Returns
a shared pointer to the supplied reply object

Definition at line 297 of file communicator.cpp.

◆ addReplyObject() [2/3]

std::shared_ptr< ReplyObject > Communicator::addReplyObject ( uint8_t  mid)

Add a MidReplyObject.

Parameters
[in]midthe id of the message to wait for
Returns
a shared pointer to a reply object

Definition at line 274 of file communicator.cpp.

◆ addReplyObject() [3/3]

std::shared_ptr< ReplyObject > Communicator::addReplyObject ( uint8_t  mid,
XsSize  offset,
XsSize  size,
uint8_t const *  data 
)

Add a MidAndDataReplyObject.

Parameters
[in]midthe message id of the message to wait for
[in]offsetthe offset in the data part of the message
[in]sizethe size of the data in the data part of the message
[in]datapointer to data to wait for (this object does not take ownership of the data)
Returns
a shared pointer to a reply object

Definition at line 287 of file communicator.cpp.

◆ allowReprocessing()

bool Communicator::allowReprocessing ( ) const
virtual
Returns
true if reprocessing is allowed

Reimplemented in ProxyCommunicator.

Definition at line 355 of file communicator.cpp.

◆ childDeviceCount()

XsSize Communicator::childDeviceCount ( ) const
Returns
a child device count

Definition at line 184 of file communicator.cpp.

◆ closeLogFile()

virtual void Communicator::closeLogFile ( )
pure virtual

Close the log file.

Returns
true if the log file was successfully closed or never open

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ closePort()

virtual void Communicator::closePort ( )
pure virtual

Closes the open port.

Implemented in MtbFileCommunicator, SerialCommunicator, and ProxyCommunicator.

◆ configurationMessageSearchLimit()

static int Communicator::configurationMessageSearchLimit ( )
inlinestatic
Returns
The maximum set of messages, from the beginning of a file, which must contain a Configuration message
Note
SerialCommunicator & MTi: 5 (GotoConfig, ReqDeviceId, GotoConfig, Initbus, ReqConfiguration)
BodyPack requires more because we also may have some other meta-data in the file, but base is: 7 (ReqDeviceId, RequestControl, SetDataPort, GotoConfig [Communicator & XsDevice], Initbus, ReqConfiguration)

Definition at line 316 of file communicator.h.

◆ createUniquePtr() [1/2]

template<typename T >
static UniquePtr<T> Communicator::createUniquePtr ( )
inlinestatic

Constructs a new Communicator of type T and returns it as a UniquePtr<T>

Definition at line 117 of file communicator.h.

◆ createUniquePtr() [2/2]

template<typename T >
static UniquePtr<T> Communicator::createUniquePtr ( T *  communicator)
inlinestatic

Creates a UniquePtr<T> from a Communicator*.

Definition at line 124 of file communicator.h.

◆ defaultTimeout()

uint32_t Communicator::defaultTimeout ( ) const
inline
Returns
a default timeout

Definition at line 145 of file communicator.h.

◆ destroy()

void Communicator::destroy ( )

Destroys the communicator.

Definition at line 344 of file communicator.cpp.

◆ doTransaction() [1/4]

bool Communicator::doTransaction ( const XsMessage message)

Write a message and await the reply.

Definition at line 222 of file communicator.cpp.

◆ doTransaction() [2/4]

bool Communicator::doTransaction ( const XsMessage message,
uint32_t  timeout 
)

Write a message and await the reply.

Definition at line 214 of file communicator.cpp.

◆ doTransaction() [3/4]

bool Communicator::doTransaction ( const XsMessage message,
XsMessage rcv 
)

Write a message and await the reply.

Definition at line 229 of file communicator.cpp.

◆ doTransaction() [4/4]

virtual bool Communicator::doTransaction ( const XsMessage message,
XsMessage rcv,
uint32_t  timeout 
)
pure virtual

Write a message and await the reply.

Implemented in DeviceCommunicator, MtbFileCommunicator, and ProxyCommunicator.

◆ flushPort()

virtual void Communicator::flushPort ( )
pure virtual

Flushes all remaining data on the open port.

Implemented in MtbFileCommunicator, SerialCommunicator, and ProxyCommunicator.

◆ getDeviceId()

virtual XsResultValue Communicator::getDeviceId ( )
pure virtual

Request a device to get device ID.

Returns
XRV_OK if succeeded

Implemented in MtbFileCommunicator, and DeviceCommunicator.

◆ gotoConfig()

virtual XsResultValue Communicator::gotoConfig ( bool  detectRs485 = false)
pure virtual

Request a device to go to config mode.

Parameters
detectRs485when set to true it will try to detect and use an RS485 interface
Returns
XRV_OK if succeeded

Implemented in DeviceCommunicator, MtbFileCommunicator, SerialCommunicator, and UsbCommunicator.

◆ gotoMeasurement()

virtual XsResultValue Communicator::gotoMeasurement ( )
pure virtual

Request a device to go to measurement mode.

Returns
XRV_OK if succeeded

Implemented in MtbFileCommunicator, DeviceCommunicator, SerialCommunicator, and UsbCommunicator.

◆ handleMessage()

void Communicator::handleMessage ( const XsMessage message)
virtual

Handles a message.

Reimplemented in SerialCommunicator, DeviceCommunicator, and ProxyCommunicator.

Definition at line 191 of file communicator.cpp.

◆ hasProtocol()

bool Communicator::hasProtocol ( XsProtocolType  type) const
Returns
true when a protocol with type type has been added
Parameters
[in]typeThe protocol type to check

Definition at line 327 of file communicator.cpp.

◆ isDockedAt()

virtual bool Communicator::isDockedAt ( Communicator other) const
pure virtual

Returns true if the other device is docked at this device.

Implemented in MtbFileCommunicator, SerialCommunicator, and ProxyCommunicator.

◆ isLoadLogFileInProgress()

bool Communicator::isLoadLogFileInProgress ( ) const
virtual
Returns
true if the file operation started by loadLogFile is still in progress

Reimplemented in MtbFileCommunicator.

Definition at line 350 of file communicator.cpp.

◆ isPortOpen()

virtual bool Communicator::isPortOpen ( ) const
pure virtual
Returns
true if the port is open

Implemented in MtbFileCommunicator, SerialCommunicator, and ProxyCommunicator.

◆ isReadingFromFile()

virtual bool Communicator::isReadingFromFile ( ) const
pure virtual
Returns
true if we are reading from the file

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ lastResult()

XsResultValue Communicator::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 167 of file communicator.cpp.

◆ lastResultText()

XsString Communicator::lastResultText ( ) const

Get the accompanying error text for the value returned by lastResult() It may provide situation-specific information instead.

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

Definition at line 177 of file communicator.cpp.

◆ loadLogFile()

virtual void Communicator::loadLogFile ( XsDevice device)
pure virtual

Load a complete logfile.

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ logFileDate()

virtual XsTimeStamp Communicator::logFileDate ( ) const
pure virtual
Returns
The date of the logfile

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ logFileName()

virtual XsString Communicator::logFileName ( ) const
pure virtual
Returns
The name of the logfile

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ logFileReadPosition()

virtual XsFilePos Communicator::logFileReadPosition ( ) const
pure virtual
Returns
The read position of the logfile

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ logFileSize()

virtual XsFilePos Communicator::logFileSize ( ) const
pure virtual
Returns
The size of the logfile

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ masterDevice()

XsDevice * Communicator::masterDevice ( ) const
protected
Returns
a master device

Definition at line 135 of file communicator.cpp.

◆ masterDeviceId()

XsDeviceId Communicator::masterDeviceId ( ) const
Returns
a master device ID

Definition at line 157 of file communicator.cpp.

◆ openLogFile()

virtual bool Communicator::openLogFile ( const XsString filename)
pure virtual

Open the log file `.

Parameters
filenamea name of file to open
Returns
true if the file was opened successfully

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ openPort()

virtual bool Communicator::openPort ( const XsPortInfo portInfo,
OpenPortStage  stage = OPS_Full,
bool  detectRs485 = false 
)
pure virtual

Opens a port.

Parameters
portInfoA port information that you want to open
stageA openning stage of a communication port
detectRs485When set to true it will try to detect and use an RS485 interface
Returns
true if port is successfully open

Implemented in MtbFileCommunicator, SerialCommunicator, and ProxyCommunicator.

◆ portInfo()

virtual XsPortInfo Communicator::portInfo ( ) const
pure virtual
Returns
XsPortInfo of the current port

Implemented in MtbFileCommunicator, and SerialCommunicator.

◆ prepareForDestruction()

void Communicator::prepareForDestruction ( )
protectedvirtual

Prepares communicator for destruction.

Reimplemented in MtbFileCommunicator, and SerialCommunicator.

Definition at line 114 of file communicator.cpp.

◆ protocolManager()

std::shared_ptr< ProtocolManager > Communicator::protocolManager ( ) const
protected
Returns
a protocol manager

Definition at line 142 of file communicator.cpp.

◆ readMessage()

virtual XsMessage Communicator::readMessage ( uint8_t  msgId = 0)
pure virtual

Read a message from the open file.

Parameters
msgIdan ID of message
Returns
The message that was read or if no matching message was found a cleared message

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ readMessageFromStartOfFile()

virtual XsMessage Communicator::readMessageFromStartOfFile ( uint8_t  msgId,
int  maxMsgs = 0 
)
pure virtual

Read a message from the start of the open file.

Parameters
msgIdan ID of message
maxMsgsa maximum of messages to read
Returns
The message that was read or if no matching message was found a cleared message

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ readMessagesFromStartOfFile()

virtual std::deque<XsMessage> Communicator::readMessagesFromStartOfFile ( uint8_t  msgId,
int  maxMsgs = 0 
)
pure virtual

Read multiple similar messages from the start of the open file.

Parameters
msgIdan ID of message
maxMsgsa maximum of messages to read
Returns
The message that was read or if no matching message was found a cleared message

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ removeProtocolHandler()

void Communicator::removeProtocolHandler ( XsProtocolType  type)

Removes a protocol handler.

Parameters
typea XsProtocolType

Definition at line 317 of file communicator.cpp.

◆ reopenPort()

virtual bool Communicator::reopenPort ( OpenPortStage  stage = OPS_Full,
bool  skipDeviceIdCheck = false 
)
pure virtual

Reopens the port.

Parameters
stageA openning stage of a communication port
skipDeviceIdCheckWhen set to true it will skip device ID check
Returns
true if port is successfully reopened

Implemented in MtbFileCommunicator, SerialCommunicator, and ProxyCommunicator.

◆ resetLogFileReadPosition()

virtual void Communicator::resetLogFileReadPosition ( void  )
pure virtual

Resets the logfile read position.

Implemented in DeviceCommunicator, and MtbFileCommunicator.

◆ sanityCheck()

bool Communicator::sanityCheck ( XsMessage const &  msg) const

Do a sanity check on a potential message.

Parameters
msga message

This check is done to prevent message loss due to a 'valid' message in a message Check if the busId can be valid. It can be XS_BID_MASTER and is must be below the number of devices The XS_BID_BROADCAST cannot be checked due to a bug in AwindaStation firmware 1.0.9 which sends flushing indications with BID 0 Later more checks like odd message ID checks may be added here

Returns
true if check is successful

Definition at line 262 of file communicator.cpp.

◆ scheduleClosePort()

virtual void Communicator::scheduleClosePort ( )
inlinevirtual

Schedules to close the open port.

Definition at line 199 of file communicator.h.

◆ setAndReturnLastResult()

XsResultValue Communicator::setAndReturnLastResult ( XsResultValue  res,
XsString const &  text = XsString() 
) const
protected

Sets the last result and returns it.

Parameters
resa result value
texta text string
Returns
XRV_OK if successful

Definition at line 248 of file communicator.cpp.

◆ setCredentials()

void Communicator::setCredentials ( XsString const &  id,
XsString const &  key 
)
virtual

Set the credentials required for using the device.

Mostly used for network access

Parameters
idThe username or system ID or similar
keyThe authentication key or password or similar

Definition at line 337 of file communicator.cpp.

◆ setDefaultTimeout()

void Communicator::setDefaultTimeout ( uint32_t  timeout)
inline

Sets a default timeout.

Definition at line 139 of file communicator.h.

◆ setGotoConfigTimeout()

virtual void Communicator::setGotoConfigTimeout ( uint32_t  timeout)
pure virtual

Set the timeout for the gotoConfig function.

Parameters
timeoutThe desired timeout value in ms, if 0 the default value is used

Implemented in MtbFileCommunicator, and DeviceCommunicator.

◆ setKeepAlive()

virtual void Communicator::setKeepAlive ( bool  enable)
pure virtual

Either disable or enable (default) the keep alive mechanism (if supported by the device)

Implemented in MtbFileCommunicator, and DeviceCommunicator.

◆ setLastResult()

void Communicator::setLastResult ( XsResultValue  res,
XsString const &  text = XsString() 
) const
protected

Sets the last result.

Parameters
resa result value
texta text string

Definition at line 238 of file communicator.cpp.

◆ setMasterDevice()

void Communicator::setMasterDevice ( XsDevice masterDevice)

Sets a master device.

Parameters
masterDevicea master device.

Definition at line 126 of file communicator.cpp.

◆ setMasterDeviceId()

void Communicator::setMasterDeviceId ( const XsDeviceId id)
protected

Sets a master device ID.

Parameters
iddevice ID.

Definition at line 150 of file communicator.cpp.

◆ waitForLastTaskCompletion()

virtual void Communicator::waitForLastTaskCompletion ( )
pure virtual

Wait for the last processing task to complete in the threadpool.

Implemented in MtbFileCommunicator, and DeviceCommunicator.

◆ writeMessage()

virtual bool Communicator::writeMessage ( const XsMessage message)
pure virtual

Write message to the device.

Parameters
messagea message
Returns
true on successful write, false otherwise. This doesn't guarantee proper delivery of the message. Use doTransaction for that

Implemented in MtbFileCommunicator, and DeviceCommunicator.

Member Data Documentation

◆ m_defaultTimeout

uint32_t Communicator::m_defaultTimeout
protected

A default timeout variable.

Definition at line 372 of file communicator.h.

◆ m_handleMux

xsens::Mutex Communicator::m_handleMux
mutableprotected

A handle mutex.

Definition at line 369 of file communicator.h.

◆ m_lastResult

XsResultValue Communicator::m_lastResult
mutableprotected

A last result variable.

Definition at line 363 of file communicator.h.

◆ m_lastResultText

XsString Communicator::m_lastResultText
mutableprotected

A last result string.

Definition at line 366 of file communicator.h.

◆ m_masterDeviceId

XsDeviceId Communicator::m_masterDeviceId
protected

A master device ID.

Definition at line 357 of file communicator.h.

◆ m_masterInfo

XsDevice* Communicator::m_masterInfo
protected

A master device object.

Definition at line 351 of file communicator.h.

◆ m_preparedForDestruction

bool Communicator::m_preparedForDestruction
protected

Prepared for destruction boolean variable.

Definition at line 348 of file communicator.h.

◆ m_protocolManager

std::shared_ptr<ProtocolManager> Communicator::m_protocolManager
protected

A shared pointer to protocl manager.

Definition at line 354 of file communicator.h.

◆ m_replyMonitor

std::unique_ptr<xsens::ReplyMonitor> Communicator::m_replyMonitor
protected

An unique pointer to a reply monitor.

Definition at line 360 of file communicator.h.


The documentation for this class was generated from the following files:


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