Go to the documentation of this file.
84 : m_communicator(communicator)
119 assert((*i).operator->() != 0);
122 MessageLocation currentMessageLocation = handler.findMessage(type, raw);
125 if (currentPosition < 0)
129 if ( (bestPosition < 0)
130 || (currentPosition < bestPosition)
135 bestMessageLocation = currentMessageLocation;
136 bestProtocolType = currentProtocolType;
150 cont.erase(bestHandlerIter);
151 cont.push_front(bestHandler);
153 type = bestProtocolType;
154 return bestMessageLocation;
166 if (handler->type() == type)
167 return handler->convertToMessage(location, raw);
182 if ((*i)->type() == type)
186 container_type::iterator toErase = i;
206 if (i->type() == type)
221 if ((*i)->type() == type)
230 assert(handler != 0);
233 if (handler->
type() == (*i)->type())
virtual void clear()
Clears the protocol handlers list.
struct XsMessage XsMessage
A list of uint8_t values.
Communicator const & m_communicator
const_iterator begin() const
bool sanityCheck(XsMessage const &msg) const
Do a sanity check on a potential message.
virtual int type() const =0
Returns the type of the protocol handler.
std::list< value_type > container_type
A typedef for a container type.
A base struct for a communication interface.
virtual value_type add(IProtocolHandler *handler)
Adds the protocol handler.
MessageLocation findMessage(XsProtocolType &type, const XsByteArray &raw) override
Searches for a raw message in a raw data.
container_type::const_iterator const_iterator
A typedef for a const iterator.
virtual value_type find(XsProtocolType type)
Searches the registered protocol handlers for a handler that matches the given protocol type and retu...
Interface class for protocol handlers.
container_type m_protocolHandlers
int likelyMinimumMessageSize() const
Structure for storing a single message.
@ XPT_Xbus
The Xsens Xbus protocol, enabled by default, always 0.
std::shared_ptr< IProtocolHandler > value_type
A typedef for a value type.
virtual bool hasProtocol(XsProtocolType type) const
bool validateMessage(XsMessage const &message) const override
Check a message for a validity.
const_iterator end() const
XsProtocolType
Protocol types (XsDevice::enableProtocol())
ProtocolManager(Communicator const &)
Default constructor.
XsMessage convertToMessage(XsProtocolType &type, MessageLocation &location, const XsByteArray &raw) override
Converts raw data using location into a XsMessage object.
virtual ~ProtocolManager()
virtual bool remove(XsProtocolType type)
Removes a protocol handler of a specified type.
Stores the location of a message in a buffer using a start position and a size.
int m_startPos
The offset of the first byte of the message or -1 if no message.