| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | 
|---|---|
| 2 | // | 
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later | 
| 4 | |
| 5 | #ifndef SERVERHANDLER_H | 
| 6 | #define SERVERHANDLER_H | 
| 7 | |
| 8 | #include "tools.h" | 
| 9 | |
| 10 | #include <QVector> | 
| 11 | #include <QProcess> | 
| 12 | #include <QVariant> | 
| 13 | #include <QDebug> | 
| 14 | #include <QMetaEnum> | 
| 15 | #include <QDir> | 
| 16 | #include <QCoreApplication> | 
| 17 | #include <QThread> | 
| 18 | #include <QtConcurrent/QtConcurrent> | 
| 19 | |
| 20 | #include <jsonrpccpp/server.h> | 
| 21 | #include <jsonrpccpp/server/connectors/tcpsocketserver.h> | 
| 22 | |
| 23 | #include <iostream> | 
| 24 | |
| 25 | using namespace jsonrpc; | 
| 26 | using namespace std; | 
| 27 | |
| 28 | class ServerHandler :public QObject, public AbstractServer<ServerHandler> | 
| 29 | { | 
| 30 | Q_OBJECT | 
| 31 | Tools *tools{nullptr}; | 
| 32 | Json::Value toolsData; | 
| 33 | public: | 
| 34 | ServerHandler(TcpSocketServer &server, Tools *tools = nullptr); | 
| 35 | |
| 36 | void initialization(const Json::Value &request, Json::Value &response); | 
| 37 | void pullData(const Json::Value &request, Json::Value &response); | 
| 38 | void shutdown(const Json::Value &request, Json::Value &response); | 
| 39 | void exit(const Json::Value &request); | 
| 40 | }; | 
| 41 | |
| 42 | |
| 43 | |
| 44 | #endif // SERVERHANDLER_H | 
| 45 | 
