Interface class for protocol handlers. More...
#include <iprotocolhandler.h>
Public Member Functions | |
virtual XsMessage | convertToMessage (MessageLocation &location, const XsByteArray &raw) const =0 |
Converts raw data using location into a XsMessage object. More... | |
virtual MessageLocation | findMessage (XsProtocolType &type, const XsByteArray &raw) const =0 |
Find the first message in the raw byte stream. More... | |
virtual void | ignoreMaximumMessageSize (bool ignore) |
Tells the protocol handler to ignore/expand its maximum message size. More... | |
virtual int | maximumMessageSize () const =0 |
Returns the maximum size of a valid message. More... | |
virtual int | minimumMessageSize () const =0 |
Returns the minimum size of a valid message. More... | |
virtual bool | setEnable (bool enable) |
Enables or disables the protocol handler if supported. A disabled protocol handler ignores and discards all data provided through the findMessage function. More... | |
virtual int | type () const =0 |
Returns the type of the protocol handler. More... | |
virtual | ~IProtocolHandler () |
Destructor. More... | |
Interface class for protocol handlers.
Describes the interfaces of the protocol handling classes. The protocol handlers are used to convert a binary data stream into XsMessage objects.
Definition at line 78 of file iprotocolhandler.h.
|
inlinevirtual |
Destructor.
Definition at line 82 of file iprotocolhandler.h.
|
pure virtual |
Converts raw data using location into a XsMessage object.
location | The location of a message to convert from raw data. |
raw | The raw byte stream. |
Implemented in nmea::ProtocolHandler, and ProtocolHandler.
|
pure virtual |
Find the first message in the raw byte stream.
This function scans raw for a sequence of bytes that can contain a full message. It returns the location and total byte size of the message so that the caller can remove those bytes from the stream. The return value can also describe that a partial message has been found. Return values:
type | The protocol type that was used. |
raw | The raw byte stream to analyze. |
Implemented in nmea::ProtocolHandler, and ProtocolHandler.
|
inlinevirtual |
Tells the protocol handler to ignore/expand its maximum message size.
This is mostly used when reading from a file that is known to contain correct data. Please note that the protocol handler can decide to ignore this call, which is what the default implementation does.
ignore | Set to true to ignore the maximum message size check. |
Reimplemented in ProtocolHandler.
Definition at line 132 of file iprotocolhandler.h.
|
pure virtual |
Returns the maximum size of a valid message.
This value may differ for different protocols.
Implemented in nmea::ProtocolHandler, and ProtocolHandler.
|
pure virtual |
Returns the minimum size of a valid message.
This value may differ for different protocols, but is always at least 1.
Implemented in nmea::ProtocolHandler, and ProtocolHandler.
|
inlinevirtual |
Enables or disables the protocol handler if supported. A disabled protocol handler ignores and discards all data provided through the findMessage function.
enable | : If true enables the protcol handler, if false it disables it. |
Definition at line 142 of file iprotocolhandler.h.
|
pure virtual |
Returns the type of the protocol handler.
Each protocol handler has a locally unique id that can be used for instantiation of the correct protocol handler.
Implemented in nmea::ProtocolHandler, and ProtocolHandler.