dmpcommthread.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef DMPCOMMTHREAD_H
  2. #define DMPCOMMTHREAD_H
  3. #include <QThread>
  4. #include <QTcpSocket>
  5. #include <QString>
  6. #include <QDateTime>
  7. #include <QHostAddress>
  8. class DMPCommThread : public QThread
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit DMPCommThread(qintptr socketDescriptor,QObject *parent = nullptr);
  13. ~DMPCommThread() override;
  14. void run() override;
  15. void close_self(QTcpSocket *so);
  16. void stop();
  17. void readData(QTcpSocket *so);
  18. int getserviceidx(QString sn);
  19. quint16 chk_crcc(QByteArray buff, quint16 len);
  20. QByteArray mk_rtn(quint8 type, quint16 sn);
  21. QByteArray mk_rtn(quint8 type);
  22. QByteArray mk_heartbeat_rtn();
  23. QByteArray mk_login_rtn();
  24. QByteArray mk_settime();
  25. signals:
  26. void CommData(QString data);
  27. void DatabaseData(QString sql);
  28. void getERealtimeValue(QString DeviceCode, QString bstr, QString pointstr, QDateTime t);
  29. public slots:
  30. private:
  31. qintptr SocketDescriptor;
  32. bool keepcomm;
  33. QString DeviceID;
  34. QString IEMI,IMSI;
  35. };
  36. #endif // DMPCOMMTHREAD_H