guardcore.h 937 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef GUARDCORE_H
  2. #define GUARDCORE_H
  3. #include <QObject>
  4. #include <qmqtt.h>
  5. #include <QSqlDatabase>
  6. #include <QSqlQuery>
  7. #include "logthread.h"
  8. #include "httpthread.h"
  9. #include "databasethread.h"
  10. #include "tcpserver.h"
  11. #include "devinfotcpserver.h"
  12. class GuardCore : public QObject
  13. {
  14. Q_OBJECT
  15. public:
  16. explicit GuardCore(QObject *parent = nullptr);
  17. ~GuardCore();
  18. void start();
  19. bool shm_load();
  20. void shm_init();
  21. signals:
  22. public slots:
  23. void onConnected();
  24. void dataLog(QString log);
  25. void mqtt_data(QString mqtt_msg);
  26. void mqtt_event(QString mqtt_event);
  27. void appendSql(QString sql);
  28. private:
  29. LogThread *logthread;
  30. HttpThread *httpthread;
  31. DatabaseThread *dbthread;
  32. TcpServer *tcpserver;
  33. DevInfoTcpServer *devinfoserver;
  34. QMQTT::Client *m_client;
  35. QSqlDatabase db;
  36. quint16 mqttIdx,mqttEventIdx;
  37. QString ip,port,username,password;
  38. };
  39. #endif // GUARDCORE_H