userverthread.h 950 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef USERVERTHREAD_H
  2. #define USERVERTHREAD_H
  3. #include <QThread>
  4. #include <QList>
  5. #include <QTcpSocket>
  6. #include <QDateTime>
  7. #include <QHostAddress>
  8. class UServerThread : public QThread
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit UServerThread(QObject *parent = 0, QString ip="", quint16 port=0);
  13. void mkCommCmd(unsigned char *cmd, unsigned char *data, unsigned char cmdCode, int dataLen);
  14. int mkHeartBeatCmd(unsigned char *cmd);
  15. int mkDeviceRegistCmd(unsigned char *cmd);
  16. int chk_protocol(QByteArray rtn, unsigned char *outData);
  17. bool chk_frame(QByteArray rtn);
  18. int mkTimeSetRtn(QByteArray rtn, unsigned char *cmd);
  19. bool set_systime(int year, int mon, int day, int hour, int min, int sec);
  20. void appendAllRealdata();
  21. void run();
  22. signals:
  23. public slots:
  24. private:
  25. uint CommTime;
  26. QTcpSocket *so;
  27. QString ServerIP;
  28. quint16 ServerPort;
  29. QList<QByteArray> CmdList;
  30. };
  31. #endif // USERVERTHREAD_H