#include #include #include #include #include "network.h" using namespace Concurrency; typedef std::map> MapResponse; typedef std::map MapMethod; class DevTools : public QObject { Q_OBJECT public: explicit DevTools(QObject* parent = nullptr); ~DevTools(); Q_SIGNALS: void statusChanged(const QString&); private Q_SLOTS: void stateChanged(QAbstractSocket::SocketState state); void onTextMessageReceived(QString message); public: void startDevTools(QString path, bool headless = false, int port = 9222); void closeDevTools(); bool checkMethod(long id); int getSession(); bool SendRequest(QString method, QJsonObject params, QJsonObject& root); long methodToReceive(QString method, QJsonObject params = {}); QString getStatus(); private: bool isConnected(); bool startChrome(QString path, bool headless = false, int port = 9222); bool GetwebSocketDebuggerUrl(QString& url, int port = 9222); long idIncrement(); long idmIncrement(); bool compareJson(QJsonValue storedparams, QJsonValue params); int session; QWebSocket webSocket; std::mutex mutex; MapResponse mapqueue; MapMethod mapmethod; long idcounter; long idmethod; PROCESS_INFORMATION processInfo; QString status; };