InteractiveCore.h 951 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef INTERACTIVECORE_H
  2. #define INTERACTIVECORE_H
  3. #include <QObject>
  4. #include <QVariant>
  5. #include <QTimerEvent>
  6. #include "template_singleton.h"
  7. #include "InteractiveTask.h"
  8. #define TIMER_DATA_CHCHE_REFRESH 1000 * 10 // 定时刷新数据缓存,间隔10秒
  9. class InteractiveCore : public QObject
  10. {
  11. SINGLETON_DEFINE(InteractiveCore) // 定义为单例类
  12. Q_OBJECT
  13. private:
  14. explicit InteractiveCore(QObject *parent = nullptr);
  15. public:
  16. Q_INVOKABLE void appendTask(InteractiveTask::TaskType type, QVariant request, QJSValue callback);
  17. public slots:
  18. void slot_completed(InteractiveTask *task);
  19. void slot_failstart(InteractiveTask *task);
  20. // 临时槽函数,实现原有开关柜门功能
  21. // void slot_tid_update_Ex(quint16 count, QList<QString> tidList, const QVariant &user);
  22. protected:
  23. void timerEvent(QTimerEvent *event);
  24. private:
  25. int m_timerDataChcheRefresh;
  26. };
  27. #endif // INTERACTIVECORE_H