qpidctrl  0.7.1
qptc10device.h
Go to the documentation of this file.
1 #ifndef QPTC10DEVICE_H
2 #define QPTC10DEVICE_H
3 
4 #include "qpiddevice.h"
5 #include "qcepproperty.h"
7 #include "qptc10devicedialog.h"
8 #include "qpidobjectnamer.h"
9 #include <QIODevice>
10 #include <QTimer>
11 #include <QTextStream>
12 
13 class QPTC10Device : public QPidDevice
14 {
15  Q_OBJECT
16 public:
17  explicit QPTC10Device(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName);
18 
19  virtual void writeSettings(QSettings *set, QString section);
20  virtual void readSettings(QSettings *set, QString section);
21 
22  void configurationDialog();
23 
24 signals:
25 
26 public slots:
27 // void commChanged();
28 
29  void sendCommand(QString cmd);
30 
31  void readoutInitial();
32  void readoutPolling();
33  void readoutTimeout();
34  void changeSetPoint(double setPoint);
35  void changeRampRate(double rate);
36  void changeProportional(double prop);
37  void changeIntegral(double integ);
38  void changeDerivative(double deriv);
39  void enable(bool on);
40  void loopEnable(bool on);
41  bool canAutoTune();
42  void autoTune();
43 
44  void updateChannelList();
45  void onInputChannelChanged();
47 
48  void onGraphingTimeout();
49  void onLoggingTimeout();
50  void start();
51  void stop();
52 
53  void ptc10test(QString cmd);
54 
55 public:
57 
58 // enum {
59 // NoComm = 0,
60 // NetworkComm = 1,
61 // SerialComm = 2,
62 // SimulatedComm = 3
63 // };
64 
65 // Q_PROPERTY(int commType READ get_CommType WRITE set_CommType)
66 // QCEP_INTEGER_PROPERTY(CommType)
67 
68 // Q_PROPERTY(QString address READ get_Address WRITE set_Address)
69 // QCEP_STRING_PROPERTY(Address)
70 
71 // Q_PROPERTY(int port READ get_Port WRITE set_Port)
72 // QCEP_INTEGER_PROPERTY(Port)
73 
74 // Q_PROPERTY(QString portName READ get_PortName WRITE set_PortName)
75 // QCEP_STRING_PROPERTY(PortName)
76 
77  Q_PROPERTY(QString channelList READ get_ChannelList WRITE set_ChannelList STORED false)
78  QCEP_STRING_PROPERTY(ChannelList)
79 
80  Q_PROPERTY(QcepStringList channels READ get_Channels WRITE set_Channels STORED false)
81  QCEP_STRING_LIST_PROPERTY(Channels)
82 
83  Q_PROPERTY(QcepStringList inputChannels READ get_InputChannels WRITE set_InputChannels STORED false)
84  QCEP_STRING_LIST_PROPERTY(InputChannels)
85 
86  Q_PROPERTY(QcepStringList outputChannels READ get_OutputChannels WRITE set_OutputChannels STORED false)
87  QCEP_STRING_LIST_PROPERTY(OutputChannels)
88 
89  Q_PROPERTY(QString unitsList READ get_UnitsList WRITE set_UnitsList STORED false)
90  QCEP_STRING_PROPERTY(UnitsList)
91 
92  Q_PROPERTY(QcepStringList channelUnits READ get_ChannelUnits WRITE set_ChannelUnits STORED false)
93  QCEP_STRING_LIST_PROPERTY(ChannelUnits)
94 
95  Q_PROPERTY(QcepDoubleList channelValues READ get_ChannelValues WRITE set_ChannelValues STORED false)
96  QCEP_DOUBLE_LIST_PROPERTY(ChannelValues)
97 
98  Q_PROPERTY(int inputChannel READ get_InputChannel WRITE set_InputChannel)
99  QCEP_INTEGER_PROPERTY(InputChannel)
100 
101  Q_PROPERTY(QString inputUnits READ get_InputUnits WRITE set_InputUnits STORED false)
102  QCEP_STRING_PROPERTY(InputUnits)
103 
104  Q_PROPERTY(int outputChannel READ get_OutputChannel WRITE set_OutputChannel)
105  QCEP_INTEGER_PROPERTY(OutputChannel)
106 
107  Q_PROPERTY(QString outputUnits READ get_OutputUnits WRITE set_OutputUnits STORED false)
108  QCEP_STRING_PROPERTY(OutputUnits)
109 
110 private:
111  void queryProperty(QString qry, QcepDoubleProperty *property, double scale=1.0);
112  void queryProperty(QString qry, QcepBoolProperty *property);
113  void queryProperty(QString qry, QcepStringProperty *property);
114 
115  QString sendQuery(QString cmd);
116  void parseChannelList(QString chans);
117  void parseUnitsList(QString chans);
118  void parseOutputValues(QString chans);
119 
120  QString inputChannelName();
121  QString outputChannelName();
122  QString inputChannelUnits();
123  QString outputChannelUnits();
124 
125 private:
127 // QSharedPointer<QIODevice> m_IODevice;
128 };
129 
130 #endif // QPTC10DEVICE_H
QString inputChannelUnits()
QcepDoubleList channelValues
Definition: qptc10device.h:95
QString inputChannelName()
void readoutPolling()
void queryProperty(QString qry, QcepDoubleProperty *property, double scale=1.0)
void onInputChannelChanged()
QString outputUnits
Definition: qptc10device.h:107
void configurationDialog()
QWeakPointer< QPidController > QPidControllerWPtr
QPidObjectNamer m_ObjectNamer
Definition: qptc10device.h:56
virtual void readSettings(QSettings *set, QString section)
void readoutInitial()
QcepStringList inputChannels
Definition: qptc10device.h:83
QString sendQuery(QString cmd)
void onOutputChannelChanged()
void enable(bool on)
void changeDerivative(double deriv)
void parseOutputValues(QString chans)
void updateChannelList()
void changeSetPoint(double setPoint)
void changeRampRate(double rate)
QString outputChannelName()
QcepStringList channels
Definition: qptc10device.h:80
virtual void writeSettings(QSettings *set, QString section)
void changeIntegral(double integ)
QString outputChannelUnits()
void parseChannelList(QString chans)
void sendCommand(QString cmd)
QPTC10DeviceDialogPtr m_DeviceDialog
Definition: qptc10device.h:126
QPTC10Device(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName)
void onGraphingTimeout()
bool canAutoTune()
QSharedPointer< QPTC10DeviceDialog > QPTC10DeviceDialogPtr
QcepStringList channelUnits
Definition: qptc10device.h:92
void readoutTimeout()
QString inputUnits
Definition: qptc10device.h:101
void parseUnitsList(QString chans)
QString channelList
Definition: qptc10device.h:77
void loopEnable(bool on)
void changeProportional(double prop)
QcepStringList outputChannels
Definition: qptc10device.h:86
QString deviceName
Definition: qpiddevice.h:133
void ptc10test(QString cmd)
void onLoggingTimeout()
QString unitsList
Definition: qptc10device.h:89