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::ToolsSocket Class Referenceabstract

#include "cc_tools_qt/ToolsSocket.h"

Detailed Description

Main polymorphic interface class for sockets.

It is used by CommsChampion Tools to drive low level I/O operations.

Inherits QObject.

Public Types

enum  ConnectionProperty { ConnectionProperty_Autoconnect = 0x1 , ConnectionProperty_NonDisconnectable = 0x2 }
 Available socket connection properties values. More...
 

Signals

void sigConnectionStatusReport (bool connected)
 Signal used to report socket connection status.
 
void sigDataReceivedReport (ToolsDataInfoPtr data)
 Signal used to report new data arrival.
 
void sigErrorReport (const QString &msg)
 Signal used to report error.
 
void sigInterPluginConfigReport (const QVariantMap &props)
 Signal to report inter-plugin configuration.
 

Public Member Functions

 ToolsSocket ()
 Constructor.
 
virtual ~ToolsSocket () noexcept
 Destructor.
 
void applyInterPluginConfig (const QVariantMap &props)
 Apply inter-plugin configuration.
 
unsigned connectionProperties () const
 Get properties describing socket connection right after plugins have been loaded and applied.
 
bool isRunning () const
 Report whether the socket has been properly started.
 
bool isSocketConnected () const
 Check socket connected.
 
void sendData (ToolsDataInfoPtr dataPtr)
 Request socket to send data.
 
void setDebugOutputLevel (unsigned level=0U)
 Set debug output level.
 
bool socketConnect ()
 Connect socket.
 
void socketDisconnect ()
 Disconnect socket.
 
bool start ()
 Start socket's operation.
 
void stop ()
 Stop socket's operation.
 

Protected Member Functions

virtual void applyInterPluginConfigImpl (const QVariantMap &props)
 Polymorphic inter-plugin configuration application.
 
virtual unsigned connectionPropertiesImpl () const
 Polymorphic connection properties functionality implementation.
 
unsigned getDebugOutputLevel () const
 Get current debug output level.
 
void reportDataReceived (ToolsDataInfoPtr dataPtr)
 Report new data has been received.
 
void reportDisconnected ()
 Report socket disconnection.
 
void reportError (const QString &msg)
 Report I/O operation error.
 
void reportInterPluginConfig (const QVariantMap &props)
 Report inter-plugin configuration.
 
virtual void sendDataImpl (ToolsDataInfoPtr dataPtr)=0
 Polymorphic data send functionality implementation.
 
virtual bool socketConnectImpl ()
 Polymorphic socket connection functionality implementation.
 
virtual void socketDisconnectImpl ()
 Polymorphic socket disconnection functionality implementation.
 
virtual bool startImpl ()
 Polymorphic start functionality implementation.
 
virtual void stopImpl ()
 Polymorphic stop functionality implementation.
 

Static Protected Member Functions

static unsigned long long currTimestamp ()
 Get current timestamp.
 

Member Enumeration Documentation

◆ ConnectionProperty

Available socket connection properties values.

Enumerator
ConnectionProperty_Autoconnect 

Perfrom "connect" upon startup.

ConnectionProperty_NonDisconnectable 

Do not allow socket disconnection.

Member Function Documentation

◆ applyInterPluginConfig()

void cc_tools_qt::ToolsSocket::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::ToolsSocket::applyInterPluginConfigImpl ( const QVariantMap &  props)
protectedvirtual

Polymorphic inter-plugin configuration application.

Invoked by the applyInterPluginConfig().

Parameters
[in]propsProperties map.

◆ connectionProperties()

unsigned cc_tools_qt::ToolsSocket::connectionProperties ( ) const

Get properties describing socket connection right after plugins have been loaded and applied.

The returned value is used by the driving application to properly present user interface. For example, whether the socket needs to be auto-connected or the application should wait for explicty user request.

Returns
OR-ed values of ConnectionProperty values.

◆ connectionPropertiesImpl()

unsigned cc_tools_qt::ToolsSocket::connectionPropertiesImpl ( ) const
protectedvirtual

Polymorphic connection properties functionality implementation.

Invoked by connectionProperties(). In can be overriden by the derived class.

Returns
0.

◆ reportDataReceived()

void cc_tools_qt::ToolsSocket::reportDataReceived ( ToolsDataInfoPtr  dataPtr)
protected

Report new data has been received.

This function needs to be invoked by the derived class when new data has been received from the I/O link. This function will invoke callback set by setDataReceivedCallback().

Parameters
[in]dataPtrNew data information.

◆ reportDisconnected()

void cc_tools_qt::ToolsSocket::reportDisconnected ( )
protected

Report socket disconnection.

Sometimes socket may get unexpectedly disconnected. When such situation is discovered, it should be reported to the running application. This function is expected to be invoked by the derived class and it will invoke callback set by setDisconnectedReportCallback().

◆ reportError()

void cc_tools_qt::ToolsSocket::reportError ( const QString &  msg)
protected

Report I/O 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]msgError message.

◆ reportInterPluginConfig()

void cc_tools_qt::ToolsSocket::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.

◆ sendData()

void cc_tools_qt::ToolsSocket::sendData ( ToolsDataInfoPtr  dataPtr)

Request socket to send data.

Invokes the sendDataImpl(), which must be implemented in the derived class.

Parameters
[in]dataPtrInformation about outging data

◆ sendDataImpl()

virtual void cc_tools_qt::ToolsSocket::sendDataImpl ( ToolsDataInfoPtr  dataPtr)
protectedpure virtual

Polymorphic data send functionality implementation.

Invoked by sendData(). It must be overridden and implemented in the derived class.

◆ setDebugOutputLevel()

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

Set debug output level.

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

◆ sigConnectionStatusReport

void cc_tools_qt::ToolsSocket::sigConnectionStatusReport ( bool  connected)
signal

Signal used to report socket connection status.

Parameters
[in]connectedConnection status

◆ sigDataReceivedReport

void cc_tools_qt::ToolsSocket::sigDataReceivedReport ( ToolsDataInfoPtr  data)
signal

Signal used to report new data arrival.

Parameters
[in]dataNew data object

◆ sigErrorReport

void cc_tools_qt::ToolsSocket::sigErrorReport ( const QString &  msg)
signal

Signal used to report error.

Parameters
[in]msgError message.

◆ sigInterPluginConfigReport

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

Signal to report inter-plugin configuration.

Parameters
[in]propsConfiguration properties.

◆ socketConnect()

bool cc_tools_qt::ToolsSocket::socketConnect ( )

Connect socket.

After the socket has been successfully started (see start()), the driving application invokes this function as well. It can be used to open the I/O device and/or connect to remote host (in case of network socket). The function invokes virtual socketConnectImpl(), which can be overridden by the derived class.

Returns
true in case the operation is successful, false otherwise.

◆ socketConnectImpl()

bool cc_tools_qt::ToolsSocket::socketConnectImpl ( )
protectedvirtual

Polymorphic socket connection functionality implementation.

Invoked by socketConnect() and default implementation does nothing. It can be overridden by the derived class.

Returns
true

◆ socketDisconnect()

void cc_tools_qt::ToolsSocket::socketDisconnect ( )

Disconnect socket.

This function is used to close the opened I/O device and/or to disconnect from the remote host (in case of network socket). The function invokes virtual socketDisconnectImpl(), which can be overridden by the derived class.

◆ socketDisconnectImpl()

void cc_tools_qt::ToolsSocket::socketDisconnectImpl ( )
protectedvirtual

Polymorphic socket disconnection functionality implementation.

Invoked by socketDisconnect() and default implementation does nothing. It can be overridden by the derived class.

◆ start()

bool cc_tools_qt::ToolsSocket::start ( )

Start socket's operation.

Prior to being started, the socket is not allowed to generate any events. The function invokes virtual startImpl() which can be overriden by the derived class.

Returns
true in case the socket's operation has been successfully started, false otherwise.

◆ startImpl()

bool cc_tools_qt::ToolsSocket::startImpl ( )
protectedvirtual

Polymorphic start functionality implementation.

Invoked by start() and default implementation does nothing. It can be overrided by the derived class.

Returns
true

◆ stop()

void cc_tools_qt::ToolsSocket::stop ( )

Stop socket's operation.

After being stopped, the socket is not allowed to generate any events. The function invokes virtual stopImpl(), which can be overriden by the derived class

◆ stopImpl()

void cc_tools_qt::ToolsSocket::stopImpl ( )
protectedvirtual

Polymorphic stop functionality implementation.

Invoked by stop() and default implementation does nothing. It can be overridden by the derived class.


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