Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
RestoreCommunication Class Reference

Performs restore communication procedure with a provided COM port. More...

#include <restorecommunication.h>

Inheritance diagram for RestoreCommunication:
Inheritance graph
[legend]

Public Member Functions

 RestoreCommunication (XsControl *control)
 Constructor. More...
 
XsResultValue start (const XsString &portName)
 Starts the restore communication procedure. More...
 
void stop ()
 Stops the restore communication procedure. More...
 
 ~RestoreCommunication ()
 Destructor. 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...
 

Protected Member Functions

int32_t innerFunction (void) override
 Inner function for an execution on a thread. More...
 
- Protected Member Functions inherited from xsens::StandardThread
virtual void exitFunction (void)
 Virtual exit function. More...
 
virtual void initFunction (void)
 Virtual initialization function. More...
 
XsThread threadHandle () const
 Return the thread handle. More...
 
XsThreadId getThreadId (void) const
 
bool isAlive (void) volatile const noexcept
 
bool isRunning (void) volatile const noexcept
 Returns whether the thread is currently running. More...
 
bool isTerminating () volatile const noexcept
 Returns whether the thread should (have) terminate(d) More...
 
bool setPriority (XsThreadPriority pri)
 Sets the priority of the thread. More...
 
virtual void signalStopThread (void)
 Tells the thread to stop but does not wait for it to end. More...
 
 StandardThread ()
 
bool startThread (const char *name=NULL)
 Starts the thread. More...
 
void stopThread (void) noexcept
 Tells the thread to stop and waits for it to end. More...
 
virtual ~StandardThread ()
 

Private Member Functions

XsResultValue openComPort (const XsPortInfo &portInfo)
 Tries to open COM port. More...
 

Private Attributes

XsControlm_control
 
volatile std::atomic< bool > m_isRestoring
 
XsString m_portName
 
SerialInterfacem_serialInterface
 

Additional Inherited Members

- Protected Attributes inherited from xsens::StandardThread
pthread_attr_t m_attr
 Duplicates m_stop functionality for external dependent classes such as Semaphore. More...
 
bool m_running
 Indicates that the thread is running. More...
 
volatile std::atomic_bool m_stop
 Indicates that the thread should stop. Derived classes should check isTerminating() instead of directly polling this value when checking if the thread should stop. However, there are some cases (tests, SignallingThread) where direct access from within the class is desired, which is why the vlaue is protected instead of private. More...
 
volatile std::atomic_bool m_yieldOnZeroSleep
 When true, a sleep value of 0 returned by innerFunction will trigger a thread yield operation. When false, the next cycle is started immediately. More...
 

Detailed Description

Performs restore communication procedure with a provided COM port.

When started it will repeatedly send the reset byte (0xDE) at 115k2 until a specific answer is received.

Note
The procedure is executed on a separate thread and call a callback on completion/error.

Definition at line 75 of file restorecommunication.h.

Constructor & Destructor Documentation

◆ RestoreCommunication()

RestoreCommunication::RestoreCommunication ( XsControl control)

Constructor.

Uses XsControl object to call a callback and creates a serial interface.

Parameters
controlA pointer to XsControl object.

Definition at line 81 of file restorecommunication.cpp.

◆ ~RestoreCommunication()

RestoreCommunication::~RestoreCommunication ( )

Destructor.

Stops restoring the communication before destruction.

Definition at line 91 of file restorecommunication.cpp.

Member Function Documentation

◆ innerFunction()

int32_t RestoreCommunication::innerFunction ( void  )
overrideprotectedvirtual

Inner function for an execution on a thread.

Returns
0.

Reimplemented from xsens::StandardThread.

Definition at line 144 of file restorecommunication.cpp.

◆ openComPort()

XsResultValue RestoreCommunication::openComPort ( const XsPortInfo portInfo)
private

Tries to open COM port.

If the port was open it will retry.

Parameters
portInfoA port info to open.
Returns
XRV_OK if was successful.

Definition at line 197 of file restorecommunication.cpp.

◆ start()

XsResultValue RestoreCommunication::start ( const XsString portName)

Starts the restore communication procedure.

Tries to open COM port and starts a thread for the execution.

Parameters
portNameA string with a port name.
Returns
XRV_OK if the procedure started successfully

Definition at line 108 of file restorecommunication.cpp.

◆ stop()

void RestoreCommunication::stop ( )

Stops the restore communication procedure.

Stops the thread and closes a serial interface.

Definition at line 135 of file restorecommunication.cpp.

Member Data Documentation

◆ m_control

XsControl* RestoreCommunication::m_control
private

Definition at line 90 of file restorecommunication.h.

◆ m_isRestoring

volatile std::atomic<bool> RestoreCommunication::m_isRestoring
private

Definition at line 94 of file restorecommunication.h.

◆ m_portName

XsString RestoreCommunication::m_portName
private

Definition at line 92 of file restorecommunication.h.

◆ m_serialInterface

SerialInterface* RestoreCommunication::m_serialInterface
private

Definition at line 91 of file restorecommunication.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:22