mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Add a scripting mode to GPClient (#110)
This commit is contained in:
33
GPClient/vpn_dbus.h
Normal file
33
GPClient/vpn_dbus.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef VPN_DBUS_H
|
||||
#define VPN_DBUS_H
|
||||
#include "vpn.h"
|
||||
#include "gpserviceinterface.h"
|
||||
|
||||
class VpnDbus : public QObject, public IVpn
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(IVpn)
|
||||
|
||||
private:
|
||||
com::yuezk::qt::GPService *inner;
|
||||
|
||||
public:
|
||||
VpnDbus(QObject *parent) : QObject(parent) {
|
||||
inner = new com::yuezk::qt::GPService("com.yuezk.qt.GPService", "/", QDBusConnection::systemBus(), this);
|
||||
QObject::connect(inner, &com::yuezk::qt::GPService::connected, this, &VpnDbus::connected);
|
||||
QObject::connect(inner, &com::yuezk::qt::GPService::disconnected, this, &VpnDbus::disconnected);
|
||||
QObject::connect(inner, &com::yuezk::qt::GPService::error, this, &VpnDbus::error);
|
||||
QObject::connect(inner, &com::yuezk::qt::GPService::logAvailable, this, &VpnDbus::logAvailable);
|
||||
}
|
||||
|
||||
void connect(const QString &preferredServer, const QList<QString> &servers, const QString &username, const QString &passwd, const QString &extraArgs);
|
||||
void disconnect();
|
||||
int status();
|
||||
|
||||
signals: // SIGNALS
|
||||
void connected();
|
||||
void disconnected();
|
||||
void error(const QString &errorMessage);
|
||||
void logAvailable(const QString &log);
|
||||
};
|
||||
#endif
|
Reference in New Issue
Block a user