qpidctrl  0.7.1
qlakeshoredevice.cpp
Go to the documentation of this file.
1 #include "qlakeshoredevice.h"
3 
4 QLakeshoreDevice::QLakeshoreDevice(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName) :
5  QPidDevice(ctrl, saver, LakeshoreDevice, deviceName, 1000, 2000),
6  m_ObjectNamer(this, "lakeshore"),
7  m_InputChannel(saver, this, "inputChannel", 1, "Input (Sensor) Channel (1=A, 2=B)"),
8  m_OutputChannel(saver, this, "outputChannel", 1, "Output (Control) Channel")
9 {
10 }
11 
12 void QLakeshoreDevice::writeSettings(QSettings *set, QString section)
13 {
14  QPidDevice::writeSettings(set, section+"/lakeshore");
15 
16  QcepProperty::writeSettings(this, &staticMetaObject, section+"/lakeshore", set);
17 }
18 
19 void QLakeshoreDevice::readSettings(QSettings *set, QString section)
20 {
21  QPidDevice::readSettings(set, section+"/lakeshore");
22 
23  QcepProperty::readSettings(this, &staticMetaObject, section+"/lakeshore", set);
24 }
25 
27 {
28 }
29 
31 {
32 }
33 
35 {
36 }
37 
39 {
40  if (m_DeviceDialog == NULL) {
42  }
43 
44  if (m_DeviceDialog) {
45  m_DeviceDialog->show();
46  m_DeviceDialog->raise();
47  }
48 }
49 
50 void QLakeshoreDevice::sendCommand(QString /*cmd*/)
51 {
52 }
53 
54 void QLakeshoreDevice::changeSetPoint(double /*setPoint*/)
55 {
56 }
57 
58 void QLakeshoreDevice::changeRampRate(double /*rate*/)
59 {
60 }
61 
63 {
64 }
65 
66 void QLakeshoreDevice::changeIntegral(double /*integ*/)
67 {
68 }
69 
70 void QLakeshoreDevice::changeDerivative(double /*deriv*/)
71 {
72 }
73 
74 void QLakeshoreDevice::enable(bool /*on*/)
75 {
76 }
77 
79 {
80  return true;
81 }
82 
84 {
85 }
86 
87 void QLakeshoreDevice::writeOutput(QString /*cmd*/)
88 {
89 }
90 
91 template <class T>
92 QLakeshoreCommand<T>::QLakeshoreCommand(QLakeshoreDevice *device, QString cmd, T *property) :
93  m_Device(device),
94  m_Command(cmd),
95  m_Property(property)
96 {
97 }
98 
99 template <class T>
101 {
102  return m_Property;
103 }
104 
105 template<>
107 {
108  return false;
109 }
110 
111 template<>
113 {
114  bool ok;
115  double value = reply.toDouble(&ok);
116 
117  if (ok && m_Property) {
118  m_Property->setValue(value);
119  }
120 
121  return (ok && m_Property);
122 }
123 
124 template<>
126 {
127  bool value = reply.startsWith("On");
128 
129  if (m_Property) {
130  m_Property->setValue(value);
131  }
132 
133  return (value && m_Property);
134 }
135 
136 template <class T>
138 {
139  return m_Command;
140 }
141 
142 template <class T>
144 {
145  m_Device->writeOutput(cmd());
146 }
147 
void changeDerivative(double deriv)
bool replyExpected() const
void enable(bool on)
virtual void writeSettings(QSettings *set, QString section)
Definition: qpiddevice.cpp:366
QPidObjectNamer m_ObjectNamer
QWeakPointer< QPidController > QPidControllerWPtr
void sendCommand(QString cmd)
QString cmd() const
QLakeshoreCommand(QLakeshoreDevice *device, QString cmd, T *property)
void changeSetPoint(double setPoint)
virtual void writeSettings(QSettings *set, QString section)
void writeOutput(QString cmd)
void changeIntegral(double integ)
virtual void readSettings(QSettings *set, QString section)
QLakeshoreDeviceDialogPtr m_DeviceDialog
void changeProportional(double prop)
virtual void readSettings(QSettings *set, QString section)
Definition: qpiddevice.cpp:375
QLakeshoreDevice(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName)
void changeRampRate(double rate)
bool processReply(QString reply)
QString deviceName
Definition: qpiddevice.h:133
QSharedPointer< QLakeshoreDeviceDialog > QLakeshoreDeviceDialogPtr
QSharedPointer< QLakeshoreDevice > QLakeshoreDevicePtr