qpidctrl  0.7.1
qwatlowdevice.h
Go to the documentation of this file.
1 #ifndef QWATLOWDEVICE_H
2 #define QWATLOWDEVICE_H
3 
4 #include <QObject>
5 #include "qextserialport.h"
6 #include <QSharedPointer>
7 #include "qpidcontroller.h"
8 #include <QStringList>
9 #include <QTimer>
10 #include "qcepproperty.h"
11 #include "qpiddevice.h"
12 #include "qwatlowdevicedialog.h"
14 #include "qpidobjectnamer.h"
15 
16 class QWatlowDevice : public QPidDevice
17 {
18  Q_OBJECT
19 public:
20  explicit QWatlowDevice(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName);
21 
22 signals:
23  void newParameterValue(QString param, double value);
24 
25 public slots:
26  void timerEvent(QTimerEvent *);
27  void onReadyRead();
28  void onDsrChanged(bool status);
29  void onTimeout();
30 
31  void start();
32  void stop();
33 
34  void setParameter(QString param, double val);
35  void getParameter(QString param);
36  void pushCommand(QString cmd);
37  void sendCommand(QString cmd);
38 
39  void readoutInitial();
40  void readoutPolling();
41  void readoutTimeout();
42  void changeSetPoint(double setPoint);
43  void changeRampRate(double rate);
44  void changeProportional(double prop);
45  void changeIntegral(double integ);
46  void changeDerivative(double deriv);
47  void enable(bool on);
48  bool canAutoTune();
49  void autoTune();
50 
51  void onGraphingTimeout();
52  void onLoggingTimeout();
53 
54 public:
55  virtual void writeSettings(QSettings *set, QString section);
56  virtual void readSettings(QSettings *set, QString section);
57 
58  void configurationDialog();
59  void writeOutput(QString cmd);
60 
61 private:
62  void issueCommand();
63  void completeCommand();
64  void abandonCommand();
65  QString errorMessage(int val);
66 
67 public:
69 
70 private:
71  QStringList m_CommandQueue;
73  QString m_Parameter;
74  QString m_Reply;
76  int m_TimerID;
77 };
78 
79 template <class T>
81 {
82 public:
83  QWatlowCommand(QWatlowDevice *device, QString cmd, T *property);
84 
85  bool replyExpected() const;
86  bool processReply(QString reply);
87  void issueCommand();
88 
89  QString cmd() const;
90 
91 private:
93  QString m_Command;
95 };
96 
97 typedef QSharedPointer<QWatlowDevice> QWatlowDevicePtr;
98 
99 #endif // QWATLOWCONTROLLER_H
QStringList m_CommandQueue
Definition: qwatlowdevice.h:71
QWatlowCommand(QWatlowDevice *device, QString cmd, T *property)
QWatlowDevice * m_Device
Definition: qwatlowdevice.h:92
void completeCommand()
QWeakPointer< QPidController > QPidControllerWPtr
void readoutTimeout()
QString errorMessage(int val)
QSharedPointer< QWatlowDeviceDialog > QWatlowDeviceDialogPtr
QTimer m_CommandTimer
Definition: qwatlowdevice.h:72
QString m_Command
Definition: qwatlowdevice.h:93
void onDsrChanged(bool status)
void sendCommand(QString cmd)
QWatlowDevice(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName)
void changeIntegral(double integ)
void changeRampRate(double rate)
bool replyExpected() const
QSharedPointer< QWatlowDevice > QWatlowDevicePtr
Definition: qwatlowdevice.h:97
void writeOutput(QString cmd)
void onGraphingTimeout()
void configurationDialog()
void changeProportional(double prop)
virtual void writeSettings(QSettings *set, QString section)
void setParameter(QString param, double val)
void changeSetPoint(double setPoint)
QString m_Parameter
Definition: qwatlowdevice.h:73
void pushCommand(QString cmd)
virtual void readSettings(QSettings *set, QString section)
void enable(bool on)
void readoutPolling()
QString cmd() const
bool processReply(QString reply)
void readoutInitial()
QString deviceName
Definition: qpiddevice.h:133
QString m_Reply
Definition: qwatlowdevice.h:74
void timerEvent(QTimerEvent *)
QPidObjectNamer m_ObjectNamer
Definition: qwatlowdevice.h:68
void newParameterValue(QString param, double value)
void getParameter(QString param)
QWatlowDeviceDialogPtr m_DeviceDialog
Definition: qwatlowdevice.h:75
void changeDerivative(double deriv)
void onLoggingTimeout()