dncommthread.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef DNCOMMTHREAD_H
  2. #define DNCOMMTHREAD_H
  3. #include <QThread>
  4. #include <QDateTime>
  5. #include <QList>
  6. class DNCommThread : public QThread
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit DNCommThread(QObject *parent = 0,
  11. quint8 id=0,
  12. bool enabled=false,
  13. QString path="");
  14. void setparam(QString path, bool enabled);
  15. void setCommType(quint16 type);
  16. quint16 chk_crcc(quint8 *d, int len);
  17. QByteArray comm_work(QByteArray cmd, bool needrtn);
  18. void ef_comm2_read();
  19. void chk_rtn(QByteArray Rtn);
  20. void set_speed(int speed);
  21. int set_Parity(int databits,int stopbits,int parity);
  22. int open_comm();
  23. void chk_e2(QByteArray d, uint t);
  24. void chk_e3(QByteArray d, uint t);
  25. void run();
  26. signals:
  27. void log(QString txt);
  28. public slots:
  29. private:
  30. quint8 Id;
  31. bool Enabled;
  32. bool CommOpened;
  33. QString CommPath;
  34. quint16 CommType;
  35. bool reopen;
  36. int fd;
  37. int ef_idx;
  38. int noEcho0,noEcho1;
  39. // quint8 liveCur,deathCur;
  40. // QList<quint8> liveList,deathList;
  41. };
  42. #endif // DNCOMMTHREAD_H