Performs restore communication procedure with a provided COM port. More...
#include <restorecommunication.h>
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... | |
![]() | |
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... | |
![]() | |
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 | |
XsControl * | m_control |
volatile std::atomic< bool > | m_isRestoring |
XsString | m_portName |
SerialInterface * | m_serialInterface |
Additional Inherited Members | |
![]() | |
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... | |
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.
Definition at line 75 of file restorecommunication.h.
RestoreCommunication::RestoreCommunication | ( | XsControl * | control | ) |
Constructor.
Uses XsControl object to call a callback and creates a serial interface.
control | A pointer to XsControl object. |
Definition at line 81 of file restorecommunication.cpp.
RestoreCommunication::~RestoreCommunication | ( | ) |
Destructor.
Stops restoring the communication before destruction.
Definition at line 91 of file restorecommunication.cpp.
|
overrideprotectedvirtual |
Inner function for an execution on a thread.
Reimplemented from xsens::StandardThread.
Definition at line 144 of file restorecommunication.cpp.
|
private |
Tries to open COM port.
If the port was open it will retry.
portInfo | A port info to open. |
Definition at line 197 of file restorecommunication.cpp.
XsResultValue RestoreCommunication::start | ( | const XsString & | portName | ) |
Starts the restore communication procedure.
Tries to open COM port and starts a thread for the execution.
portName | A string with a port name. |
Definition at line 108 of file restorecommunication.cpp.
void RestoreCommunication::stop | ( | ) |
Stops the restore communication procedure.
Stops the thread and closes a serial interface.
Definition at line 135 of file restorecommunication.cpp.
|
private |
Definition at line 90 of file restorecommunication.h.
|
private |
Definition at line 94 of file restorecommunication.h.
|
private |
Definition at line 92 of file restorecommunication.h.
|
private |
Definition at line 91 of file restorecommunication.h.