Public Member Functions | List of all members
IProtocolHandler Class Referenceabstract

Interface class for protocol handlers. More...

#include <iprotocolhandler.h>

Inheritance diagram for IProtocolHandler:
Inheritance graph
[legend]

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~IProtocolHandler()

virtual IProtocolHandler::~IProtocolHandler ( )
inlinevirtual

Destructor.

Definition at line 82 of file iprotocolhandler.h.

Member Function Documentation

◆ convertToMessage()

virtual XsMessage IProtocolHandler::convertToMessage ( MessageLocation location,
const XsByteArray raw 
) const
pure virtual

Converts raw data using location into a XsMessage object.

Parameters
locationThe location of a message to convert from raw data.
rawThe raw byte stream.
Returns
A XsMessage object that was converted from raw byte stream.

Implemented in nmea::ProtocolHandler, and ProtocolHandler.

◆ findMessage()

virtual MessageLocation IProtocolHandler::findMessage ( XsProtocolType type,
const XsByteArray raw 
) const
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:

  • startpos >= 0 and size > 0: A full message with size has been found at startpos.
  • startpos >= 0 and size == 0: The start of a message has been found at startpos, but the size could not yet be determined.
  • startpos >= 0 and size < 0: The start of a message has been found at startpos, and the size of the full message is at least -size.
  • startpos < 0: No messages have been found.
Parameters
typeThe protocol type that was used.
rawThe raw byte stream to analyze.
Returns
A MessageLocation object that describes what was found.

Implemented in nmea::ProtocolHandler, and ProtocolHandler.

◆ ignoreMaximumMessageSize()

virtual void IProtocolHandler::ignoreMaximumMessageSize ( bool  ignore)
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.

Parameters
ignoreSet to true to ignore the maximum message size check.

Reimplemented in ProtocolHandler.

Definition at line 132 of file iprotocolhandler.h.

◆ maximumMessageSize()

virtual int IProtocolHandler::maximumMessageSize ( ) const
pure virtual

Returns the maximum size of a valid message.

This value may differ for different protocols.

Returns
The maximum size of a valid message for the protocol.

Implemented in nmea::ProtocolHandler, and ProtocolHandler.

◆ minimumMessageSize()

virtual int IProtocolHandler::minimumMessageSize ( ) const
pure virtual

Returns the minimum size of a valid message.

This value may differ for different protocols, but is always at least 1.

Returns
The minimum size of a valid message for the protocol.

Implemented in nmea::ProtocolHandler, and ProtocolHandler.

◆ setEnable()

virtual bool IProtocolHandler::setEnable ( bool  enable)
inlinevirtual

Enables or disables the protocol handler if supported. A disabled protocol handler ignores and discards all data provided through the findMessage function.

Parameters
enable: If true enables the protcol handler, if false it disables it.
Returns
true if the protocol handler was correctly enabled or disabled, false if the protocol handler doesn't support this function

Definition at line 142 of file iprotocolhandler.h.

◆ type()

virtual int IProtocolHandler::type ( ) const
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.

Returns
The type id of the protocol handler.

Implemented in nmea::ProtocolHandler, and ProtocolHandler.


The documentation for this class was generated from the following file:


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:21