TDengine.h 902 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "MWareInterface.h"
  3. #include "taos.h"
  4. #include <QtCore/QObject>
  5. #include <QtCore/QDebug>
  6. class TDengine : public QObject
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit TDengine(QObject *parent = 0);
  11. ~TDengine();
  12. void exec(QString sql);
  13. public:
  14. int32_t msgProcess(TAOS_RES* msg); //消息处理
  15. tmq_t* buildConsumer(); //构建消费者
  16. tmq_list_t* buildTopicList(); //构建主题
  17. void topicLoop(); //轮询主题
  18. signals:
  19. public slots:
  20. private:
  21. QString host = "localhost";
  22. uint m_nPort = 0;
  23. QString user = "root";
  24. QString dbName = "taosdata";
  25. QString password;
  26. TAOS* pConn = NULL;
  27. public:
  28. void Setup(tagSetup ts);
  29. void subscribe(QString ch, EventSubInterface *fn); // 订阅
  30. void psubscribe(QString ch, EventSubInterface *fn); // 订阅:模式匹配
  31. void start();
  32. };