QtPdCom
1.4.1
|
QML-Adapted Process Class. More...
#include <Qml_classes.h>
Public Member Functions | |
Q_INVOKABLE void | ping (QJSValue jsCallback, double timeout=0) |
Ping server. More... | |
![]() | |
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< VariableList > | list (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... | |
LoginManager * | getLoginManager () const |
Additional Inherited Members | |
![]() | |
enum | SslCaMode { SslCaMode::NoTLS, SslCaMode::DefaultCAs, SslCaMode::CustomCAs, SslCaMode::IgnoreCertificate } |
enum | ConnectionState { Disconnected, Connecting, Connected, ConnectError, ConnectedError } |
State of the process connection. More... | |
![]() | |
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 QtPdCom::Process * | getDefaultProcess () |
static void | setDefaultProcess (QtPdCom::Process *) |
Set default process "manually". More... | |
![]() | |
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 |
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
):
void QtPdCom::QmlProcess::ping | ( | QJSValue | jsCallback, |
double | timeout = 0 |
||
) |
Ping server.
jsCallback | Callback with two arguments: success (bool). true if ping was successful, false if not. duration (double), elapsed time in seconds. |
timeout | Timeout, in seconds, if greater than zero. |
References QtPdCom::Process::ping().