cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
cc_tools_qt::ToolsProtocol Class Referenceabstract

#include "cc_tools_qt/ToolsProtocol.h"

Detailed Description

Main polymorphic interface class for protocols.

It is used by CommsChampion Tools to create and manipulate protocol messages.

Inherits QObject.

Public Types

using DataInfosList = std::list< ToolsDataInfoPtr >
 List of raw data buffers.
 
using MsgDataSeq = ToolsMessage::DataSeq
 Type used to contain raw bytes seqence.
 
enum class  UpdateStatus { NoChange , Changed }
 Status of message "update" operation. More...
 

Signals

void sigErrorReport (const QString &str)
 Signal used to report error.
 
void sigInterPluginConfigReport (const QVariantMap &props)
 Signal to report inter-plugin configuration.
 
void sigSendMessageReport (ToolsMessagePtr msg)
 Signal used to report new protocol message to be sent out.
 

Public Member Functions

virtual ~ToolsProtocol () noexcept
 Destructor.
 
void applyInterPluginConfig (const QVariantMap &props)
 Apply inter-plugin configuration.
 
ToolsMessagePtr cloneMessage (const ToolsMessage &msg)
 Clone the message object.
 
ToolsMessagesList createAllMessages ()
 Create all messages supported by the protocol.
 
ToolsMessagePtr createInvalidMessage (const MsgDataSeq &data)
 Create dummy message containing invalid input.
 
ToolsMessagePtr createMessage (const QString &idAsString, unsigned idx=0)
 Create message object given string representation of the message ID.
 
void messageReceivedReport (ToolsMessagePtr msg)
 Make the protocol aware that the message has been received from remote end.
 
void messageSentReport (ToolsMessagePtr msg)
 Make the protocol aware that the message has been sent out to the remote end.
 
const QString & name () const
 Retrieve name of the protocol.
 
ToolsMessagesList read (const ToolsDataInfo &dataInfo, bool final=false)
 Read the received data input.
 
void setDebugOutputLevel (unsigned level=0U)
 Set debug output level.
 
void socketConnectionReport (bool connected)
 Make the protocol aware about socket connection status.
 
UpdateStatus updateMessage (ToolsMessage &msg)
 Update (or refresh) message contents.
 
ToolsDataInfoPtr write (ToolsMessage &msg)
 Serialise message.
 

Protected Member Functions

virtual void applyInterPluginConfigImpl (const QVariantMap &props)
 Polymorphic inter-plugin configuration application.
 
unsigned getDebugOutputLevel () const
 Get current debug output level.
 
virtual void messageReceivedReportImpl (ToolsMessagePtr msg)
 Polymorphic processing of the message reception report.
 
virtual void messageSentReportImpl (ToolsMessagePtr msg)
 Make the protocol aware that the message has been sent out to the remote end.
 
virtual const QString & nameImpl () const =0
 Polymorphic protocol name retrieval.
 
void reportError (const QString &str)
 Report operation error.
 
void reportInterPluginConfig (const QVariantMap &props)
 Report inter-plugin configuration.
 
void sendMessageRequest (ToolsMessagePtr msg)
 Request a protocol message to be sent out.
 
void setNameToMessageProperties (ToolsMessage &msg)
 Helper function to assign protocol name to message properties.
 
virtual void socketConnectionReportImpl (bool connected)
 Polymorphic processing of the socket connection report.
 

Static Protected Member Functions

static QVariantMap getExtraInfoFromMessageProperties (const ToolsMessage &msg)
 Helper function to retrieve "extra info" from message properties.
 
static ToolsMessagePtr getExtraInfoMsgToMessageProperties (const ToolsMessage &msg)
 Helper function to retrieve "extra info message" object from properties of the application message object.
 
static bool getForceExtraInfoExistenceFromMessageProperties (const ToolsMessage &msg)
 Helper function to check whether "extra info" existence is force.
 
static void mergeExtraInfoToMessageProperties (const QVariantMap &extraInfo, ToolsMessage &msg)
 Helper function to merge existing "extra info" and provided one.
 
static void setExtraInfoMsgToMessageProperties (ToolsMessagePtr extraInfoMsg, ToolsMessage &msg)
 Helper function to assign "extra info message" object as a property of application message object.
 
static void setExtraInfoToMessageProperties (const QVariantMap &extraInfo, ToolsMessage &msg)
 Helper function to set "extra info" to message properties.
 
static void setForceExtraInfoExistenceToMessageProperties (ToolsMessage &msg)
 Helper function to force "extra info" existence.
 
static void setRawDataToMessageProperties (ToolsMessagePtr rawDataMsg, ToolsMessage &msg)
 Helper function to assign "raw data message" object as a property of application message object.
 
static void setTransportToMessageProperties (ToolsMessagePtr transportMsg, ToolsMessage &msg)
 Helper function to assign "tranport message" object as a property of application message object.
 

Member Enumeration Documentation

◆ UpdateStatus

Status of message "update" operation.

Enumerator
NoChange 

The message contents haven't been changed.

Changed 

The message contents have been changed.

Member Function Documentation

◆ applyInterPluginConfig()

void cc_tools_qt::ToolsProtocol::applyInterPluginConfig ( const QVariantMap &  props)

Apply inter-plugin configuration.

Allows one plugin to influence the configuration of another. This function will be called for all currently chosen plugins to override current configuration. Invokes polymorphic applyInterPluginConfigImpl().

Parameters
[in]propsProperties map.

◆ applyInterPluginConfigImpl()

void cc_tools_qt::ToolsProtocol::applyInterPluginConfigImpl ( const QVariantMap &  props)
protectedvirtual

Polymorphic inter-plugin configuration application.

Invoked by the applyInterPluginConfig().

Parameters
[in]propsProperties map.

◆ cloneMessage()

ToolsMessagePtr cc_tools_qt::ToolsProtocol::cloneMessage ( const ToolsMessage msg)

Clone the message object.

Returns
Pointer to newly created message with the same contents

◆ createMessage()

ToolsMessagePtr cc_tools_qt::ToolsProtocol::createMessage ( const QString &  idAsString,
unsigned  idx = 0 
)

Create message object given string representation of the message ID.

Parameters
[in]idAsStringString representation of the message ID.
[in]idxIndex of the message type within the range of message types with the same ID.

◆ messageReceivedReport()

void cc_tools_qt::ToolsProtocol::messageReceivedReport ( ToolsMessagePtr  msg)

Make the protocol aware that the message has been received from remote end.

Invokes messageReceivedReportImpl().

Parameters
[in]msgPointer to the message object

◆ messageReceivedReportImpl()

void cc_tools_qt::ToolsProtocol::messageReceivedReportImpl ( ToolsMessagePtr  msg)
protectedvirtual

Polymorphic processing of the message reception report.

Empty function, does nothing.

Parameters
[in]msgPointer to the message object

◆ messageSentReport()

void cc_tools_qt::ToolsProtocol::messageSentReport ( ToolsMessagePtr  msg)

Make the protocol aware that the message has been sent out to the remote end.

Invokes messageSentReportImpl().

Parameters
[in]msgPointer to the message object

◆ messageSentReportImpl()

void cc_tools_qt::ToolsProtocol::messageSentReportImpl ( ToolsMessagePtr  msg)
protectedvirtual

Make the protocol aware that the message has been sent out to the remote end.

Empty function, does nothing

Parameters
[in]msgPointer to the message object

◆ name()

const QString & cc_tools_qt::ToolsProtocol::name ( ) const

Retrieve name of the protocol.

Invokes nameImpl().

◆ nameImpl()

virtual const QString & cc_tools_qt::ToolsProtocol::nameImpl ( ) const
protectedpure virtual

Polymorphic protocol name retrieval.

Invoked by name().

◆ read()

ToolsMessagesList cc_tools_qt::ToolsProtocol::read ( const ToolsDataInfo dataInfo,
bool  final = false 
)

Read the received data input.

Parameters
[in]dataInfoReceived data information
[in]finalFinal input indication, if true no more data is expected
Returns
List of created messages

◆ reportError()

void cc_tools_qt::ToolsProtocol::reportError ( const QString &  str)
protected

Report operation error.

This function is expected to be invoked by the derived class, when some error is detected. This function will emit sigErrorReport() signal.

Parameters
[in]strError string.

◆ reportInterPluginConfig()

void cc_tools_qt::ToolsProtocol::reportInterPluginConfig ( const QVariantMap &  props)
protected

Report inter-plugin configuration.

Sometimes configuration of one plugin may influence configuration of another. Use this function to report inter-plugin configuration properties. When invoked all other plugins are expected to get their respecitve applyInterPluginConfig() functions invoked.
Emits sigInterPluginConfigReport() signal.

Parameters
[in]propsReported properties.

◆ sendMessageRequest()

void cc_tools_qt::ToolsProtocol::sendMessageRequest ( ToolsMessagePtr  msg)
protected

Request a protocol message to be sent out.

This function is expected to be invoked by the derived class, when an extra message needs to be sent out. This function will invoke emit sigSendMessageReport() signal.

Parameters
[in]msgPointer to the message object.

◆ setDebugOutputLevel()

void cc_tools_qt::ToolsProtocol::setDebugOutputLevel ( unsigned  level = 0U)

Set debug output level.

Parameters
[in]levelDebug level. If 0, debug output is disabled

◆ setNameToMessageProperties()

void cc_tools_qt::ToolsProtocol::setNameToMessageProperties ( ToolsMessage msg)
protected

Helper function to assign protocol name to message properties.

Expected to be used by the derived class.

◆ sigErrorReport

void cc_tools_qt::ToolsProtocol::sigErrorReport ( const QString &  str)
signal

Signal used to report error.

Parameters
[in]strError message.

◆ sigInterPluginConfigReport

void cc_tools_qt::ToolsProtocol::sigInterPluginConfigReport ( const QVariantMap &  props)
signal

Signal to report inter-plugin configuration.

Parameters
[in]propsConfiguration properties.

◆ sigSendMessageReport

void cc_tools_qt::ToolsProtocol::sigSendMessageReport ( ToolsMessagePtr  msg)
signal

Signal used to report new protocol message to be sent out.

Parameters
[in]msgPointer to message object

◆ socketConnectionReport()

void cc_tools_qt::ToolsProtocol::socketConnectionReport ( bool  connected)

Make the protocol aware about socket connection status.

Invokes socketConnectionReportImpl().

Parameters
[in]connectedSocket connection status.

◆ socketConnectionReportImpl()

void cc_tools_qt::ToolsProtocol::socketConnectionReportImpl ( bool  connected)
protectedvirtual

Polymorphic processing of the socket connection report.

Empty function, does nothing

Parameters
[in]connectedSocket connection status

◆ updateMessage()

ToolsProtocol::UpdateStatus cc_tools_qt::ToolsProtocol::updateMessage ( ToolsMessage msg)

Update (or refresh) message contents.

Returns
Status of the update.

◆ write()

ToolsDataInfoPtr cc_tools_qt::ToolsProtocol::write ( ToolsMessage msg)

Serialise message.

Parameters
[in]msgReference to message object, passed by non-const reference to allow update of the message properties.
Returns
Serialised data.

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