tcpserver.h 666 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef TCPSERVER_H
  2. #define TCPSERVER_H
  3. #include <QObject>
  4. #include <QTcpServer>
  5. #include <QTcpSocket>
  6. #include <QDateTime>
  7. #include <QJsonDocument>
  8. #include <QJsonObject>
  9. #include <QJsonValue>
  10. #include <QJsonArray>
  11. #include <QJsonParseError>
  12. #include <QVariant>
  13. class TcpServer : public QObject
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit TcpServer(QObject *parent = nullptr);
  18. void start();
  19. void response_msg(QString msg);
  20. signals:
  21. void control_data(QString deviceId,int switchStatus);
  22. void tcp_log(QString log);
  23. public slots:
  24. void new_incomming();
  25. void read_data();
  26. private:
  27. QTcpServer *svr;
  28. QTcpSocket *so;
  29. };
  30. #endif // TCPSERVER_H