Go to the documentation of this file.
79 using namespace xsens;
85 : m_preparedForDestruction(false)
86 , m_masterInfo(nullptr)
91 , m_defaultTimeout(500)
100 JLDEBUGG(
"Created " << (
void*)
this);
107 JLDEBUGG(
"Destroyed " << (
void*)
this);
200 XsSize sz = message.getTotalMessageSize();
201 const uint8_t* m = message.getMessageStart();
202 for (
XsSize i = 0; i < sz; ++i)
203 sprintf(buffer + 2 * i,
"%02X", (
unsigned int) m[i]);
205 JLALERTG(
"Error message received: " << buffer);
305 assert(handler != 0);
void removeProtocolHandler(XsProtocolType type)
Removes a protocol handler.
Abstract reply object. Blocks on a semaphore when requesting the message until the message has been s...
bool hasProtocol(XsProtocolType type) const
XsString lastResultText() const
Get the accompanying error text for the value returned by lastResult() It may provide situation-speci...
virtual XSNOEXPORT void handleMessage(const XsMessage &msg)
virtual bool allowReprocessing() const
Message protocol handling class.
uint32_t defaultTimeout() const
bool sanityCheck(XsMessage const &msg) const
Do a sanity check on a potential message.
void setMasterDevice(XsDevice *masterDevice)
Sets a master device.
XsDeviceId m_masterDeviceId
A master device ID.
std::shared_ptr< ProtocolManager > protocolManager() const
void setMasterDeviceId(const XsDeviceId &deviceId)
Sets a master device ID.
XsDeviceId masterDeviceId() const
virtual void handleMessage(const XsMessage &message)
Handles a message.
bool m_preparedForDestruction
Prepared for destruction boolean variable.
A monitor class for receiving replies messages in a thread.
std::shared_ptr< ReplyObject > addReplyObject(uint8_t mid)
Add a MidReplyObject.
XsResultValue m_lastResult
A last result variable.
Communicator(void)
Constructor, creates some management objects and clears the rest by calling initialize()
@ JLL_Alert
only log fatal, error and alert messages
@ XRV_OK
0: Operation was performed successfully
virtual void addProtocolHandler(IProtocolHandler *handler)
Adds a protocol handler.
XsResultValue
Xsens result values.
XsResultValue lastResult() const
Get the result value of the last operation.
#define JLIF(journal, level, todo)
std::unique_ptr< xsens::ReplyMonitor > m_replyMonitor
An unique pointer to a reply monitor.
xsens::Mutex m_handleMux
A handle mutex.
bool doTransaction(const XsMessage &message)
Write a message and await the reply.
Namespace for time and date constants and operations.
virtual XsDeviceConfiguration const &XSNOEXPORT deviceConfigurationConst() const
virtual void setCredentials(XsString const &id, XsString const &key)
Set the credentials required for using the device.
virtual bool isLoadLogFileInProgress() const
virtual XSNOEXPORT bool messageLooksSane(const XsMessage &msg) const
Interface class for protocol handlers.
XsDevice * masterDevice() const
size_t XsSize
XsSize must be unsigned number!
XsDevice * m_masterInfo
A master device object.
Structure for storing a single message.
Contains an Xsens device ID and provides operations for determining the type of device.
Reply object that checks the message identifier and data in the data field.
std::shared_ptr< IProtocolHandler > value_type
A typedef for a value type.
Reply object that only checks the message identifier.
virtual void prepareForDestruction()
Prepares communicator for destruction.
std::shared_ptr< ProtocolManager > m_protocolManager
A shared pointer to protocl manager.
virtual ~Communicator()
Destructor, waits for the last scheduled task to complete and then cleans up the object by calling cl...
XsString m_lastResultText
A last result string.
XsSize childDeviceCount() const
XsProtocolType
Protocol types (XsDevice::enableProtocol())
void setLastResult(XsResultValue lastResult, XsString const &text=XsString()) const
Sets the last result.
void destroy()
Destroys the communicator.
XsResultValue setAndReturnLastResult(XsResultValue lastResult, XsString const &text=XsString()) const
Sets the last result and returns it.
A 0-terminated managed string of characters.
Supplies multi-protocol data stream parsing.