QtPdCom  1.4.1
Public Member Functions | List of all members
QtPdCom::QmlProcess Class Reference

QML-Adapted Process Class. More...

#include <Qml_classes.h>

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

Public Member Functions

Q_INVOKABLE void ping (QJSValue jsCallback, double timeout=0)
 Ping server. More...
 
- Public Member Functions inherited from QtPdCom::Process
 Process (QObject *parent=nullptr)
 Constructor. More...
 
virtual ~Process ()
 Destructor. More...
 
void setApplicationName (const QString &)
 Sets the application name. More...
 
QString getApplicationName () const
 
Q_INVOKABLE void connectToHost (const QString &, quint16=2345)
 Starts to connect to a process. More...
 
Q_INVOKABLE void disconnectFromHost ()
 Disconnects from a process. More...
 
 Q_ENUM (ConnectionState)
 
ConnectionState getConnectionState () const
 
bool isConnected () const
 
const QString & getErrorString () const
 
QString getPeerName () const
 
QUrl getUrl () const
 
int getPort () const
 
QString getHost () const
 
Q_INVOKABLE void sendBroadcast (const QString &, const QString &attr="text")
 Send a broadcast message. More...
 
quint64 getRxBytes () const
 
quint64 getTxBytes () const
 
QVariant nameQt () const
 Remote process name string. More...
 
QVariant versionQt () const
 Remote process version string. More...
 
QFuture< PdCom::Variable > find (const QString &)
 Find a Variable. More...
 
QFuture< VariableListlist (const QString &="")
 Wrapper function for Process::list. More...
 
QFuture< void > pingQt ()
 
QFuture< std::vector< PdCom::ClientStatistics > > getClientStatisticsQt ()
 
template<class Class , class Function >
QFutureWatcher< PdCom::Variable > & find (const QString &path, Class *obj, Function &&callback)
 Also find a Variable. More...
 
template<class Class , class Function >
QFutureWatcher< VariableList > & list (const QString &path, Class *obj, Function &&callback)
 
template<class Class , class Function >
QFutureWatcher< void > & ping (Class *obj, Function &&callback)
 
template<class Class , class Function >
QFutureWatcher< std::vector< PdCom::ClientStatistics > > & getClientStatistics (Class *obj, Function &&callback)
 
void setCaMode (SslCaMode mode)
 Set Traffic Encryption mode. More...
 
SslCaMode getCaMode () const
 Get Traffic Encryption mode. More...
 
void setClientCertificate (const QSslCertificate &cert, const QSslKey &key)
 Provide a client certificate. More...
 
void setCustomCAs (QList< QSslCertificate > cas)
 Set list of trusted Certificate Authorities. More...
 
PdCom::MessageManagerBase * getMessageManager () const
 
void setLoginManager (LoginManager *lm)
 Set the Login Manager. More...
 
LoginManagergetLoginManager () const
 

Additional Inherited Members

- Public Types inherited from QtPdCom::Process
enum  SslCaMode { SslCaMode::NoTLS, SslCaMode::DefaultCAs, SslCaMode::CustomCAs, SslCaMode::IgnoreCertificate }
 
enum  ConnectionState {
  Disconnected, Connecting, Connected, ConnectError,
  ConnectedError
}
 State of the process connection. More...
 
- Signals inherited from QtPdCom::Process
void processConnected ()
 Connection established. More...
 
void disconnected ()
 Disconnected gracefully. More...
 
void error ()
 Connection error. More...
 
void broadcastReceived (const QString &message, const QString &attr, std::uint64_t time_ns, const QString &user)
 
void connectionStatusChanged ()
 
void sslCaModeChanged ()
 
- Static Public Member Functions inherited from QtPdCom::Process
static QtPdCom::ProcessgetDefaultProcess ()
 
static void setDefaultProcess (QtPdCom::Process *)
 Set default process "manually". More...
 
- Properties inherited from QtPdCom::Process
bool connected
 The process is connected and ready. More...
 
ConnectionState connectionState
 
SslCaMode sslCaMode
 
int port
 
QString host
 
QUrl url
 
QString applicationName
 
QtPdCom::LoginManager loginManager
 
QVariant name
 
QVariant version
 

Detailed Description

QML-Adapted Process Class.

This class is specialized for QML applications. A singleton is created for you, DefaultProcess . Micro example (paste into a file and open it with qml6 ):

import QtQuick
import QtQuick.Controls
import de.igh.qtpdcom 1.4
ApplicationWindow {
width: 1024
height: 600
visible: true
Label {
anchors.centerIn: parent
text: "Server: " + DefaultProcess.name
}
Component.onCompleted: DefaultProcess.connectToHost("localhost", 2345)
}

Member Function Documentation

◆ ping()

void QtPdCom::QmlProcess::ping ( QJSValue  jsCallback,
double  timeout = 0 
)

Ping server.

Parameters
jsCallbackCallback with two arguments: success (bool). true if ping was successful, false if not. duration (double), elapsed time in seconds.
timeoutTimeout, in seconds, if greater than zero.
Button {
text: "ping"
onClicked: DefaultProcess.ping((succes, duration) =>
console.log(success, duration), 1.0)
}

References QtPdCom::Process::ping().


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