core.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef CORE_H
  2. #define CORE_H
  3. #include <QObject>
  4. #include <qmqtt.h>
  5. #include <QSqlDatabase>
  6. #include <QSqlQuery>
  7. #include <QDateTime>
  8. #include <QTimer>
  9. #include "logthread.h"
  10. #include "jzmqttpub.h"
  11. #include "jzmqttsub.h"
  12. #include "httpthread.h"
  13. #include "ytmqttpub.h"
  14. #include "ytmqttsub.h"
  15. class Core : public QObject
  16. {
  17. Q_OBJECT
  18. public:
  19. explicit Core(QObject *parent = nullptr);
  20. ~Core();
  21. void start();
  22. void shm_init();
  23. bool shm_load();
  24. signals:
  25. public slots:
  26. void onConnected();
  27. void dataLog(QString log);
  28. void receiveDevData(QString topic,QByteArray data);
  29. void receiveYtDevData(QString topic,QByteArray data);
  30. void mqtt_data(QString mqtt_msg);
  31. void mqtt_data1(QString mqtt_msg);
  32. void mqtt_data2(QString mqtt_msg);
  33. void time_out();
  34. private:
  35. LogThread *logthread;
  36. JZMqttPub *jzmqttpub;
  37. JZMqttSub *jzmqttsub;
  38. HttpThread *httpthread;
  39. YTMqttPub *ytmqttpub;
  40. YTMqttSub *ytmqttsub;
  41. QMQTT::Client *m_client;
  42. QSqlDatabase db;
  43. quint16 mqttIdx,mqttIdx1,mqttIdx2;
  44. QString ip,port,username,password;
  45. QTimer *timer;
  46. };
  47. #endif // CORE_H