lightingcore.h 922 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef LIGHTINGCORE_H
  2. #define LIGHTINGCORE_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 "clientthread.h"
  11. #include "tcpserver.h"
  12. class LightingCore : public QObject
  13. {
  14. Q_OBJECT
  15. public:
  16. explicit LightingCore(QObject *parent = nullptr);
  17. ~LightingCore();
  18. void start();
  19. void shm_init();
  20. bool shm_load();
  21. signals:
  22. public slots:
  23. void onConnected();
  24. void dataLog(QString log);
  25. void mqtt_data(QString mqtt_msg);
  26. void control_data(QString deviceId,int switchStatus);
  27. void time_out();
  28. void response_msg(QString msg);
  29. private:
  30. LogThread *logthread;
  31. ClientThread *clientthread;
  32. TcpServer *tcpserver;
  33. QMQTT::Client *m_client;
  34. QSqlDatabase db;
  35. quint16 mqttIdx;
  36. QString ip,port,username,password;
  37. QTimer *timer;
  38. };
  39. #endif // LIGHTINGCORE_H