dealmqttalarmthread.h 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef DEALMQTTALARMTHREAD_H
  2. #define DEALMQTTALARMTHREAD_H
  3. #include <QThread>
  4. #include <QDateTime>
  5. #include <QJsonDocument>
  6. #include <QJsonObject>
  7. #include <QJsonValue>
  8. #include <QJsonArray>
  9. #include <QJsonParseError>
  10. #include <QVariantMap>
  11. class MqttAlarmData{
  12. public:
  13. explicit MqttAlarmData(QString t = "",QByteArray d = "" ){
  14. topic = t;
  15. data = d;
  16. }
  17. QString topic;
  18. QByteArray data;
  19. };
  20. class DealMqttAlarmThread : public QThread
  21. {
  22. Q_OBJECT
  23. public:
  24. explicit DealMqttAlarmThread(QObject *parent = nullptr);
  25. void run();
  26. void stop();
  27. void appendMqttData(MqttAlarmData mqttData);
  28. signals:
  29. void dmq_log(QString log);
  30. void dmqSql(QString sql);
  31. void dmqAlarm(QString sql);
  32. public slots:
  33. private:
  34. bool keep;
  35. QList<MqttAlarmData> mqttDataList;
  36. };
  37. #endif // DEALMQTTALARMTHREAD_H