-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchannelController.h
104 lines (90 loc) · 2.8 KB
/
channelController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef CHANNELCONTROLLER_H
#define CHANNELCONTROLLER_H
#include <QDeclarativeItem>
#include <QTimer>
#include "plotline.h"
class SettingsController;
class CommunicationReply;
class DeviceCommunicationWorker;
class ChannelController : public QObject {
Q_OBJECT
public:
enum UpdateType {
Freeze,
Periodically
};
ChannelController(QDeclarativeItem* curve);
virtual void connectToSettingsController(const SettingsController* controller);
void resetTimer();
public slots:
void setUpdateType(ChannelController::UpdateType type);
void setUpdateInterval(int msecs);
void changeDataRange(QString channel, Channel::TransformationKind kind, Channel::Axis axis, float amount);
void autoDataRange();
virtual void changeChannelMode(QString channel, QString newMode);
// Make sure to call this default implementation from derived classes,
// after the code of the derived class has run
void redraw();
protected:
PlotLine* curve;
QTimer updateTimer;
UpdateType updateType;
// the update interval, in milliseconds
int updateInterval;
};
class ScopeChannelController : public ChannelController {
Q_OBJECT
public:
enum AcquisitionType {
Displayed,
Full
};
ScopeChannelController(QDeclarativeItem* curve, DeviceCommunicationWorker* worker);
virtual void changeChannelMode(QString channel, QString newMode);
QString channel;
bool fakeMode;
public slots:
virtual void doSingleUpdate();
void updateReady(CommunicationReply* reply);
private:
void fillCurveWithFakeData();
DeviceCommunicationWorker* worker;
};
class JSDefinedChannelController : public ChannelController {
Q_OBJECT
public:
enum OperationMode {
JSMath,
JSMeasurementHistory
};
JSDefinedChannelController(QDeclarativeItem* curve, QDeclarativeItem* textArea, QList<PlotLine*> inputChannels);
public slots:
virtual void doUpdate(const QString& text);
virtual void doUpdate();
virtual void changeChannelMode(QString channel, QString newMode);
virtual void scheduleUpdate();
private:
QList<PlotLine*> inputChannels;
QDeclarativeItem* textArea;
OperationMode operationMode;
};
class FixedFunctionChannelController : public ChannelController {
Q_OBJECT
public:
enum OperationMode {
CrossCorrelation,
FourierTransform
};
FixedFunctionChannelController(QDeclarativeItem* curve, const QList<PlotLine*>& channels);
virtual void changeChannelMode(QString channel, QString newMode);
public slots:
virtual void scheduleUpdate();
virtual void doUpdate();
virtual void setOperationMode(FixedFunctionChannelController::OperationMode newMode);
private:
QList<PlotLine*> channels;
OperationMode operationMode;
QTimer updateTimer;
PlotLine* fftTargetChannel;;
};
#endif