mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
40 lines
895 B
C++
40 lines
895 B
C++
#ifndef CDPCOMMANDMANAGER_H
|
|
#define CDPCOMMANDMANAGER_H
|
|
|
|
#include "cdpcommand.h"
|
|
#include <QObject>
|
|
#include <QHash>
|
|
#include <QtWebSockets>
|
|
#include <QNetworkAccessManager>
|
|
|
|
class CDPCommandManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit CDPCommandManager(QObject *parent = nullptr);
|
|
~CDPCommandManager();
|
|
|
|
void initialize(QString endpoint);
|
|
|
|
CDPCommand *sendCommand(QString cmd);
|
|
CDPCommand *sendCommend(QString cmd, QVariantMap& params);
|
|
|
|
signals:
|
|
void ready();
|
|
void eventReceived(QString eventName, QJsonObject params);
|
|
|
|
private:
|
|
QNetworkAccessManager *networkManager;
|
|
QWebSocket *socket;
|
|
|
|
int commandId = 0;
|
|
QHash<int, CDPCommand*> commandPool;
|
|
|
|
private slots:
|
|
void onTextMessageReceived(QString message);
|
|
void onSocketDisconnected();
|
|
void onSocketError(QAbstractSocket::SocketError error);
|
|
};
|
|
|
|
#endif // CDPCOMMANDMANAGER_H
|