dogthread.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef DOGTHREAD_H
  2. #define DOGTHREAD_H
  3. #include <QThread>
  4. #include <QDateTime>
  5. #include <QStringList>
  6. #include <QTcpSocket>
  7. #include <QFile>
  8. #include <QByteArray>
  9. #include <stdio.h>
  10. #define daefile "/opt/db/daemon.cfg"
  11. typedef unsigned char * POINTER;
  12. typedef unsigned long int UINT4;
  13. typedef struct {
  14. UINT4 state[4]; /* state (ABCD) */
  15. UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
  16. unsigned char buffer[64]; /* input buffer */
  17. } MD5_CTX;
  18. class dogThread : public QThread
  19. {
  20. Q_OBJECT
  21. public:
  22. explicit dogThread(QObject *parent = 0, QStringList params=QStringList());
  23. void start_app();
  24. void chk_version();
  25. int mk_verqry(unsigned char *cmd);
  26. int mk_proqry(unsigned char *cmd, int idx);
  27. bool check_frame(QByteArray rtn, int idx, FILE *fd);
  28. void set_termtime();
  29. void save_cfg();
  30. void chk_file();
  31. bool load_param();
  32. void chk_param(char *buf);
  33. void trim(char *buf, char *dat);
  34. void run();
  35. signals:
  36. public slots:
  37. private:
  38. QStringList Params;
  39. uint start_t;
  40. int start_h;
  41. QTcpSocket *so;
  42. unsigned long Length,t_Length;
  43. MD5_CTX context;
  44. unsigned char Major,Minor,t_Major,t_Minor;
  45. char Checksum[33],t_Checksum[33],t_DeviceTypeId[40];
  46. time_t UpTime,t_UpTime;
  47. bool runFlag;
  48. };
  49. #endif // DOGTHREAD_H