datacollectorpub.h 758 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef DATACOLLECTORPUB_H
  2. #define DATACOLLECTORPUB_H
  3. #include <QThread>
  4. #include <QDateTime>
  5. #include <QJsonDocument>
  6. #include <QJsonArray>
  7. #include <QJsonObject>
  8. #include <QJsonValue>
  9. #include <QJsonParseError>
  10. class DevData{
  11. public:
  12. explicit DevData(QString t="",QByteArray d=""){
  13. topic = t;
  14. data = d;
  15. }
  16. QString topic;
  17. QByteArray data;
  18. };
  19. class DataCollectorPub : public QThread
  20. {
  21. Q_OBJECT
  22. public:
  23. explicit DataCollectorPub(QObject *parent = nullptr);
  24. void run();
  25. void stop();
  26. void devMessage(DevData dev);
  27. signals:
  28. void publishDevData(QByteArray data);
  29. void dataListLog(QString msg);
  30. public slots:
  31. private:
  32. bool keep;
  33. QList<DevData> devMsgList;
  34. };
  35. #endif // DATACOLLECTORPUB_H