12345678910111213141516171819202122 |
- #include "readthread.h"
-
- ReadThread::ReadThread(InputManager* input, const QList<QVariant> &channels, quint64 interval, QObject *parent)
- : QThread(parent)
- , m_input(input)
- , m_channels(channels)
- , m_interval(interval)
- {
- qRegisterMetaType<InputValues>("InputValues");
- }
-
- void ReadThread::run()
- {
- while (true)
- {
- InputValues values;
- foreach (auto channel, m_channels)
- values.append(QPair<QVariant, QVariant>(channel, m_input->read(channel)));
- emit newValues(values, getTime());
- usleep(m_interval);
- }
- }
|