Files
oscilloscope/device.h
T

45 lines
827 B
C++
Raw Normal View History

2019-08-25 18:22:31 +02:00
#pragma once
#include <QIODevice>
#include <QDebug>
#define qvoid void
2019-08-30 12:23:10 +02:00
template<typename T> struct SamplePairT {
T x, y;
2019-08-25 18:22:31 +02:00
};
2019-08-30 12:23:10 +02:00
typedef SamplePairT<qint16> SamplePair;
2019-08-25 18:22:31 +02:00
class Device : public QIODevice
{
Q_OBJECT
public:
explicit Device(QObject *parent = nullptr);
signals:
void samplesReceived(const SamplePair *begin, const SamplePair *end);
protected:
qint64 readData(char *data, qint64 maxlen) override;
qint64 writeData(const char *data, qint64 len) override;
};
class FakeDevice : public QObject
{
Q_OBJECT
public:
explicit FakeDevice(QObject *parent = nullptr);
signals:
void samplesReceived(const SamplePair *begin, const SamplePair *end);
protected:
qvoid timerEvent(QTimerEvent *event) override;
private:
double m_dingsDesHaltHochZaehlt;
const int m_timerId;
};