QtPdCom  1.0.0
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
QtPdCom::Process Class Reference

PdCom::Process implementation for Qt. More...

#include <Process.h>

Inheritance diagram for QtPdCom::Process:
Inheritance graph
[legend]
Collaboration diagram for QtPdCom::Process:
Collaboration graph
[legend]

Classes

struct  Impl
 

Public Types

enum  ConnectionState {
  Disconnected , Connecting , Connected , ConnectError ,
  ConnectedError
}
 State of the process connection. More...
 

Signals

void processConnected ()
 Connection established.
 
void disconnected ()
 Disconnected gracefully.
 
void error ()
 Connection error.
 
void broadcastReceived (const QString &message, const QString &attr, std::uint64_t time_ns, const QString &user)
 
void pingReceived ()
 Received ping reply.
 

Public Member Functions

 Process (QObject *parent=nullptr)
 Constructor.
 
virtual ~Process ()
 Destructor.
 
void setApplicationName (const QString &)
 Sets the application name.
 
void connectToHost (const QString &, quint16=2345)
 Starts to connect to a process.
 
void disconnectFromHost ()
 Disconnects from a process.
 
ConnectionState getConnectionState () const
 
bool isConnected () const
 
const QString & getErrorString () const
 
QString getPeerName () const
 
void find (const QString &)
 Wrapper function for Process::findVariable.
 
void sendBroadcast (const QString &, const QString &attr="text")
 Send a broadcast message.
 
quint64 getRxBytes () const
 
quint64 getTxBytes () const
 
PdCom::MessageManagerBase * getMessageManager () const
 

Static Public Member Functions

static QtPdCom::ProcessgetDefaultProcess ()
 
static void setDefaultProcess (QtPdCom::Process *)
 Set default process "manually".
 
static bool loadTranslations (QTranslator &translator, const QString &locale)
 

Private Slots

void socketConnected ()
 Socket connection established.
 
void socketDisconnected ()
 Socket disconnected.
 
void socketError ()
 There was a socket error.
 
void socketRead ()
 The socket has new data to read.
 

Private Member Functions

std::string applicationName () const override
 Virtual from PdCom::Process.
 
std::string hostname () const override
 
int read (char *, int) override
 Read data from the socket.
 
void write (const char *, size_t) override
 Sends data via the socket.
 
void flush () override
 Flushed the socket.
 
void connected () override
 The process is connected and ready.
 
void broadcastReply (const std::string &message, const std::string &attr, std::chrono::nanoseconds time_ns, const std::string &user) override
 Broadcast Reply.
 
void pingReply () override
 Ping Reply.
 
void reset ()
 Resets the PdCom process.
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0)
 Disconnect method inherited from QObject.
 

Private Attributes

struct Q_DECL_HIDDEN Impl
 
std::unique_ptr< Implimpl
 

Detailed Description

PdCom::Process implementation for Qt.

Member Enumeration Documentation

◆ ConnectionState

State of the process connection.

Enumerator
Disconnected 

Process disconnected.

Connecting 

Currently connecting.

Connected 

Process connection established.

ConnectError 

An error happened while connecting.

ConnectedError 

An error happened, after the connection was established.

Constructor & Destructor Documentation

◆ Process()

Process::Process ( QObject *  parent = nullptr)

Constructor.

◆ ~Process()

Process::~Process ( )
virtual

Destructor.

References disconnectFromHost(), and impl.

Member Function Documentation

◆ applicationName()

std::string Process::applicationName ( ) const
overrideprivate

Virtual from PdCom::Process.

References impl.

◆ broadcastReceived

void QtPdCom::Process::broadcastReceived ( const QString &  message,
const QString &  attr,
std::uint64_t  time_ns,
const QString &  user 
)
signal

Referenced by broadcastReply().

◆ broadcastReply()

void Process::broadcastReply ( const std::string &  message,
const std::string &  attr,
std::chrono::nanoseconds  time_ns,
const std::string &  user 
)
overrideprivate

Broadcast Reply.

References broadcastReceived().

◆ connected()

void Process::connected ( )
overrideprivate

The process is connected and ready.

This virtual function from PdCom::Process has to be overloaded to let subclasses know about this event.

References Connected, impl, and processConnected().

◆ connectToHost()

void Process::connectToHost ( const QString &  address,
quint16  port = 2345 
)

Starts to connect to a process.

References Connecting, and impl.

◆ disconnect()

bool QtPdCom::Process::disconnect ( const char *  signal = 0,
const QObject *  receiver = 0,
const char *  method = 0 
)
private

Disconnect method inherited from QObject.

This is made private, to avoid confusion.

Parameters
signalSignal.
receiverReceiver.
methodMethod.

◆ disconnected

void QtPdCom::Process::disconnected ( )
signal

Disconnected gracefully.

This is only emitted, after the user called disconnectFromHost().

Referenced by disconnectFromHost(), and socketDisconnected().

◆ disconnectFromHost()

void Process::disconnectFromHost ( )

Disconnects from a process.

References Connected, Connecting, Disconnected, disconnected(), impl, and reset().

Referenced by ~Process().

◆ error

void QtPdCom::Process::error ( )
signal

Connection error.

This is emitted after a connection error or when the connection was closed due to a parser error.

Referenced by socketDisconnected(), socketError(), socketRead(), and write().

◆ find()

void Process::find ( const QString &  path)

Wrapper function for Process::findVariable.

◆ flush()

void Process::flush ( )
overrideprivate

Flushed the socket.

◆ getConnectionState()

Process::ConnectionState Process::getConnectionState ( ) const
Returns
The #connectionState.

References impl.

◆ getDefaultProcess()

QtPdCom::Process * Process::getDefaultProcess ( )
static

◆ getErrorString()

const QString & Process::getErrorString ( ) const
Returns
Error reason after the error() signal was emitted.

References impl.

◆ getMessageManager()

PdCom::MessageManagerBase * Process::getMessageManager ( ) const

References impl.

Referenced by QtPdCom::MessageModel::connect().

◆ getPeerName()

QString Process::getPeerName ( ) const
Returns
Host name of the process.

References impl.

◆ getRxBytes()

quint64 Process::getRxBytes ( ) const

References impl.

◆ getTxBytes()

quint64 Process::getTxBytes ( ) const

References impl.

◆ hostname()

std::string Process::hostname ( ) const
overrideprivate

References hostname().

Referenced by hostname().

◆ isConnected()

bool Process::isConnected ( ) const
Returns
true, if the process is connected.

References Connected, and impl.

◆ loadTranslations()

bool Process::loadTranslations ( QTranslator &  translator,
const QString &  locale 
)
static

References init_resources().

◆ pingReceived

void QtPdCom::Process::pingReceived ( )
signal

Received ping reply.

This is emitted after the reply to a ping (sent with ping()) was received from the server.

Referenced by pingReply().

◆ pingReply()

void Process::pingReply ( )
overrideprivate

Ping Reply.

References pingReceived().

◆ processConnected

void QtPdCom::Process::processConnected ( )
signal

Connection established.

This is emitted after the connection is established.

Referenced by connected().

◆ read()

int Process::read ( char *  buf,
int  count 
)
overrideprivate

Read data from the socket.

References impl.

◆ reset()

void Process::reset ( )
private

Resets the PdCom process.

References impl.

Referenced by disconnectFromHost(), socketDisconnected(), socketError(), socketRead(), and write().

◆ sendBroadcast()

void Process::sendBroadcast ( const QString &  msg,
const QString &  attr = "text" 
)

Send a broadcast message.

◆ setApplicationName()

void Process::setApplicationName ( const QString &  name)

Sets the application name.

References impl.

◆ setDefaultProcess()

void Process::setDefaultProcess ( QtPdCom::Process process)
static

Set default process "manually".

References QtPdCom::Process::Impl::defaultProcess.

◆ socketConnected

void Process::socketConnected ( )
privateslot

Socket connection established.

This is called, when the pure socket connection was established and the Process object can start using it.

References impl.

◆ socketDisconnected

void Process::socketDisconnected ( )
privateslot

Socket disconnected.

The socket was closed and the process has to be told, that it is disconnected.

References Connected, ConnectError, Connecting, Disconnected, disconnected(), error(), impl, and reset().

◆ socketError

void Process::socketError ( )
privateslot

There was a socket error.

The error could come up either while connecting the socket, or when the socket was already connected.

References Connected, ConnectedError, ConnectError, Connecting, error(), impl, and reset().

◆ socketRead

void Process::socketRead ( )
privateslot

The socket has new data to read.

References Connected, ConnectedError, ConnectError, error(), impl, and reset().

◆ write()

void Process::write ( const char *  buf,
size_t  count 
)
overrideprivate

Sends data via the socket.

This is the implementation of the virtual PdCom::Process method to enable the Process object to send data to the process.

References error(), impl, and reset().

Member Data Documentation

◆ Impl

struct Q_DECL_HIDDEN QtPdCom::Process::Impl
private

◆ impl

std::unique_ptr<Impl> QtPdCom::Process::impl
private

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