You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readthread.cpp 575B

12345678910111213141516171819202122
  1. #include "readthread.h"
  2. ReadThread::ReadThread(InputManager* input, const QList<QVariant> &channels, quint64 interval, QObject *parent)
  3. : QThread(parent)
  4. , m_input(input)
  5. , m_channels(channels)
  6. , m_interval(interval)
  7. {
  8. qRegisterMetaType<InputValues>("InputValues");
  9. }
  10. void ReadThread::run()
  11. {
  12. while (true)
  13. {
  14. InputValues values;
  15. foreach (auto channel, m_channels)
  16. values.append(QPair<QVariant, QVariant>(channel, m_input->read(channel)));
  17. emit newValues(values, getTime());
  18. usleep(m_interval);
  19. }
  20. }