1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef READTHREAD_H
- #define READTHREAD_H
-
- #include <QThread>
- #include <sys/time.h>
- #include "inputmanager.h"
-
- typedef QList<QPair<QVariant, QVariant>> InputValues;
-
- class ReadThread : public QThread
- {
- Q_OBJECT
- public:
- explicit ReadThread(InputManager* input, const QList<QVariant> &channels, quint64 interval, QObject *parent = 0);
-
- inline __suseconds_t getTime() const;
-
- protected:
- void run();
-
- signals:
- void newValues(InputValues values, quint64 timestamp);
-
- private:
- InputManager* m_input;
-
- QList<QVariant> m_channels;
-
- quint64 m_interval;
- };
-
- __suseconds_t ReadThread::getTime() const
- {
- struct timeval time;
- gettimeofday(&time, NULL);
- return 1000000 * time.tv_sec + time.tv_usec;
- }
-
- Q_DECLARE_METATYPE(InputValues)
-
- #endif // READTHREAD_H
|