qpidctrl  0.7.1
Public Slots | Public Member Functions | Public Attributes | Properties | Private Member Functions | Private Attributes | List of all members
QPTC10Device Class Reference

#include <qptc10device.h>

Inheritance diagram for QPTC10Device:
Inheritance graph

Public Slots

void sendCommand (QString cmd)
 
void readoutInitial ()
 
void readoutPolling ()
 
void readoutTimeout ()
 
void changeSetPoint (double setPoint)
 
void changeRampRate (double rate)
 
void changeProportional (double prop)
 
void changeIntegral (double integ)
 
void changeDerivative (double deriv)
 
void enable (bool on)
 
void loopEnable (bool on)
 
bool canAutoTune ()
 
void autoTune ()
 
void updateChannelList ()
 
void onInputChannelChanged ()
 
void onOutputChannelChanged ()
 
void onGraphingTimeout ()
 
void onLoggingTimeout ()
 
void start ()
 
void stop ()
 
void ptc10test (QString cmd)
 
- Public Slots inherited from QPidDevice
void printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime())
 
virtual void readoutInitial ()=0
 
virtual void readoutPolling ()=0
 
virtual void readoutTimeout ()=0
 
virtual void sendCommand (QString cmd)=0
 
virtual void changeSetPoint (double setPoint)=0
 
virtual void changeRampRate (double rate)=0
 
virtual void changeProportional (double prop)=0
 
virtual void changeIntegral (double integ)=0
 
virtual void changeDerivative (double deriv)=0
 
virtual void enable (bool on)=0
 
virtual void loopEnable (bool on)
 
virtual bool canAutoTune ()=0
 
virtual void autoTune ()=0
 
virtual void readyRead ()
 
virtual void onGraphingTimeout ()
 
virtual void onLoggingTimeout ()
 
virtual void start ()
 
virtual void stop ()
 
virtual void restart ()
 
virtual void changeRunState (int state)
 
virtual void changePollingInterval (double interval)
 
virtual void changeTimeoutInterval (double interval)
 
virtual void changeGraphingInterval (double interval)
 
virtual void changeLoggingInterval (double interval)
 
virtual void write (QString cmd)
 
virtual QString readLine (int sz=0)
 
virtual int waitForReadyRead (int tmout=0)
 
virtual int bytesAvailable ()
 
virtual int canReadLine ()
 

Public Member Functions

 QPTC10Device (QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, QString deviceName)
 
virtual void writeSettings (QSettings *set, QString section)
 
virtual void readSettings (QSettings *set, QString section)
 
void configurationDialog ()
 
- Public Member Functions inherited from QPidDevice
 QPidDevice (QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, int deviceType, QString deviceName, int pollIntervalMsec, int timeoutMsec)
 
virtual ~QPidDevice ()
 
QPidControllerWPtr controller () const
 
double cK2K (double cK)
 
double K2cK (double K)
 
double K2degC (double K)
 
double degC2K (double degC)
 
void updateConnected (double newConnected)
 
void updateTemperature (double newTemperature)
 
void updateRampPoint (double newRampPoint)
 
void updateOutputLevel (double newOutputLevel)
 
void resetTimeout ()
 
void pushCommand (QPidDeviceCommandPtr cmd)
 
void issueCommand ()
 
void completeCommand (QByteArray response)
 
void flushCommandQueue ()
 
int slowly (int msec)
 
QPidCommPortPtr commPort ()
 

Public Attributes

QPidObjectNamer m_ObjectNamer
 

Properties

QString channelList
 
QcepStringList channels
 
QcepStringList inputChannels
 
QcepStringList outputChannels
 
QString unitsList
 
QcepStringList channelUnits
 
QcepDoubleList channelValues
 
int inputChannel
 
QString inputUnits
 
int outputChannel
 
QString outputUnits
 
- Properties inherited from QPidDevice
int deviceType
 
QString deviceTypeName
 
QString deviceLongTypeName
 
QString deviceName
 
int runState
 
double pollingInterval
 
double timeoutInterval
 

Private Member Functions

void queryProperty (QString qry, QcepDoubleProperty *property, double scale=1.0)
 
void queryProperty (QString qry, QcepBoolProperty *property)
 
void queryProperty (QString qry, QcepStringProperty *property)
 
QString sendQuery (QString cmd)
 
void parseChannelList (QString chans)
 
void parseUnitsList (QString chans)
 
void parseOutputValues (QString chans)
 
QString inputChannelName ()
 
QString outputChannelName ()
 
QString inputChannelUnits ()
 
QString outputChannelUnits ()
 

Private Attributes

QPTC10DeviceDialogPtr m_DeviceDialog
 

Additional Inherited Members

- Public Types inherited from QPidDevice
enum  {
  NoDevice = 0, WatlowDevice = 1, PTC10Device = 2, LakeshoreDevice = 3,
  CryostreamDevice = 4, EurothermDevice = 5
}
 
- Signals inherited from QPidDevice
void inputChannelChanged (QString name, QString units)
 
void outputChannelChanged (QString name, QString units)
 
void loggedChannelNames (QStringList names)
 
void loggedChannelValues (QcepDoubleList values)
 
void graphedChannelNames (QStringList names)
 
void graphedChannelValues (QcepDoubleList values)
 
- Static Public Member Functions inherited from QPidDevice
static QString deviceTypeName (int typ)
 
static QString deviceLongTypeName (int typ)
 
static int deviceTypeCount ()
 

Detailed Description

Definition at line 13 of file qptc10device.h.

Constructor & Destructor Documentation

QPTC10Device::QPTC10Device ( QPidControllerWPtr  ctrl,
QcepSettingsSaverWPtr  saver,
QString  deviceName 
)
explicit

Definition at line 12 of file qptc10device.cpp.

References onInputChannelChanged(), and onOutputChannelChanged().

12  :
13  QPidDevice(ctrl, saver, PTC10Device, deviceName, 1000, 2000),
14  m_ObjectNamer(this, "ptc10"),
15  m_ChannelList(QcepSettingsSaverWPtr(), this, "channelList", "", "Channel List"),
16  m_Channels(QcepSettingsSaverWPtr(), this, "channels", QStringList(), "Channel List"),
17  m_InputChannels(QcepSettingsSaverWPtr(), this, "inputChannels", QStringList(), "Input Channel List"),
18  m_OutputChannels(QcepSettingsSaverWPtr(), this, "outputChannels", QStringList(), "Output Channel List"),
19  m_UnitsList(QcepSettingsSaverWPtr(), this, "unitsList", "", "Channel Units List"),
20  m_ChannelUnits(QcepSettingsSaverWPtr(), this, "channelUnits", QStringList(), "Channel Units List"),
21  m_ChannelValues(QcepSettingsSaverWPtr(), this, "channelValues", QcepDoubleList(), "Channel Values"),
22  m_InputChannel(saver, this, "inputChannel", -1, "Input Channel Number"),
23  m_InputUnits(QcepSettingsSaverWPtr(), this, "inputUnits", "", "Input Units"),
24  m_OutputChannel(saver, this, "outputChannel", -1, "Output Channel Number"),
25  m_OutputUnits(QcepSettingsSaverWPtr(), this, "outputUnits", "", "Output Units")
26 {
27  connect(prop_InputChannel(), SIGNAL(valueChanged(int,int)), this, SLOT(onInputChannelChanged()));
28  connect(prop_InputUnits(), SIGNAL(valueChanged(QString,int)), this, SLOT(onInputChannelChanged()));
29  connect(prop_OutputChannel(),SIGNAL(valueChanged(int,int)), this, SLOT(onOutputChannelChanged()));
30  connect(prop_OutputUnits(), SIGNAL(valueChanged(QString,int)), this, SLOT(onOutputChannelChanged()));
31 }
void onInputChannelChanged()
QPidObjectNamer m_ObjectNamer
Definition: qptc10device.h:56
void onOutputChannelChanged()
QPidDevice(QPidControllerWPtr ctrl, QcepSettingsSaverWPtr saver, int deviceType, QString deviceName, int pollIntervalMsec, int timeoutMsec)
Definition: qpiddevice.cpp:9
QString deviceName
Definition: qpiddevice.h:133

Member Function Documentation

void QPTC10Device::autoTune ( )
slot

Definition at line 418 of file qptc10device.cpp.

419 {
420 }
bool QPTC10Device::canAutoTune ( )
slot

Definition at line 413 of file qptc10device.cpp.

414 {
415  return true;
416 }
void QPTC10Device::changeDerivative ( double  deriv)
slot

Definition at line 391 of file qptc10device.cpp.

392 {
393 }
void QPTC10Device::changeIntegral ( double  integ)
slot

Definition at line 387 of file qptc10device.cpp.

388 {
389 }
void QPTC10Device::changeProportional ( double  prop)
slot

Definition at line 383 of file qptc10device.cpp.

384 {
385 }
void QPTC10Device::changeRampRate ( double  rate)
slot

Definition at line 378 of file qptc10device.cpp.

References outputChannelName(), and sendCommand().

379 {
380  sendCommand(tr("\"%1.PID.Ramp\" %2").arg(this->outputChannelName()).arg(rate/60.0)); // Convert ramp rate to degC/sec
381 }
QString outputChannelName()
void sendCommand(QString cmd)
void QPTC10Device::changeSetPoint ( double  setPoint)
slot

Definition at line 373 of file qptc10device.cpp.

References outputChannelName(), and sendCommand().

374 {
375  sendCommand(tr("\"%1.PID.Setpoint\" %2").arg(this->outputChannelName()).arg(setPoint));
376 }
QString outputChannelName()
void sendCommand(QString cmd)
void QPTC10Device::configurationDialog ( )
virtual

Implements QPidDevice.

Definition at line 70 of file qptc10device.cpp.

References m_DeviceDialog.

71 {
72  if (m_DeviceDialog == NULL) {
74  }
75 
76  if (m_DeviceDialog) {
77  m_DeviceDialog->show();
78  m_DeviceDialog->raise();
79  }
80 }
QPTC10DeviceDialogPtr m_DeviceDialog
Definition: qptc10device.h:126
QSharedPointer< QPTC10DeviceDialog > QPTC10DeviceDialogPtr
QSharedPointer< QPTC10Device > QPTC10DevicePtr
void QPTC10Device::enable ( bool  on)
slot

Definition at line 395 of file qptc10device.cpp.

References QPidDevice::printMessage(), and sendCommand().

396 {
397  QString onStr = (on ? "On" : "Off");
398 
399  printMessage("Outputs "+onStr);
400 
401  sendCommand(tr("outputEnable %1").arg(onStr));
402 }
void sendCommand(QString cmd)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
QString QPTC10Device::inputChannelName ( )
private

Definition at line 82 of file qptc10device.cpp.

Referenced by inputChannelUnits(), onInputChannelChanged(), and readoutPolling().

83 {
84  QStringList chans = get_InputChannels();
85 
86  return chans.value(get_InputChannel());
87 }
QString QPTC10Device::inputChannelUnits ( )
private

Definition at line 96 of file qptc10device.cpp.

References inputChannelName().

Referenced by onInputChannelChanged().

97 {
98  QStringList chans = get_Channels();
99  QStringList units = get_ChannelUnits();
100  QString chan = inputChannelName();
101 
102  int indx = chans.indexOf(chan);
103 
104  return units.value(indx);
105 }
QString inputChannelName()
void QPTC10Device::loopEnable ( bool  on)
slot

Definition at line 404 of file qptc10device.cpp.

References outputChannelName(), QPidDevice::printMessage(), and sendCommand().

405 {
406  QString onStr = (on ? "On" : "Off");
407 
408  printMessage("PID Loop "+onStr);
409 
410  sendCommand(tr("\"%1.PID.Mode\" %2").arg(this->outputChannelName()).arg(onStr));
411 }
QString outputChannelName()
void sendCommand(QString cmd)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::onGraphingTimeout ( )
slot

Definition at line 422 of file qptc10device.cpp.

References QPidDevice::controller(), and QPidDevice::graphedChannelValues().

423 {
424  QcepDoubleList vals;
426  QDateTime ts(QDateTime::currentDateTime());
427 
428  vals.append(ts.toTime_t());
429  vals.append(ts.date().day());
430  vals.append(ts.time().hour());
431  vals.append(ts.time().minute());
432  vals.append(ts.time().second());
433 
434  if (ctl) {
435  vals.append(ctl->get_Temperature());
436  vals.append(ctl->get_OutputLevel());
437  vals.append(ctl->get_SetPoint());
438  vals.append(ctl->get_RampPoint());
439  } else {
440  vals.append(0);
441  vals.append(0);
442  vals.append(0);
443  vals.append(0);
444  }
445 
446  vals.append(get_ChannelValues());
447 
448  emit graphedChannelValues(vals);
449 }
QPidControllerWPtr controller() const
Definition: qpiddevice.cpp:316
void graphedChannelValues(QcepDoubleList values)
QSharedPointer< QPidController > QPidControllerPtr
void QPTC10Device::onInputChannelChanged ( )
slot

Definition at line 46 of file qptc10device.cpp.

References QPidDevice::inputChannelChanged(), inputChannelName(), and inputChannelUnits().

Referenced by QPTC10Device(), readoutInitial(), and start().

47 {
49 }
QString inputChannelUnits()
QString inputChannelName()
void inputChannelChanged(QString name, QString units)
void QPTC10Device::onLoggingTimeout ( )
slot

Definition at line 451 of file qptc10device.cpp.

References QPidDevice::controller(), and QPidDevice::loggedChannelValues().

452 {
453  QcepDoubleList vals;
455  QDateTime ts(QDateTime::currentDateTime());
456 
457  vals.append(ts.toTime_t());
458  vals.append(ts.date().day());
459  vals.append(ts.time().hour());
460  vals.append(ts.time().minute());
461  vals.append(ts.time().second());
462 
463  if (ctl) {
464  vals.append(ctl->get_Temperature());
465  vals.append(ctl->get_OutputLevel());
466  vals.append(ctl->get_SetPoint());
467  vals.append(ctl->get_RampPoint());
468  } else {
469  vals.append(0);
470  vals.append(0);
471  vals.append(0);
472  vals.append(0);
473  }
474 
475  vals.append(get_ChannelValues());
476 
477  emit loggedChannelValues(vals);
478 }
QPidControllerWPtr controller() const
Definition: qpiddevice.cpp:316
QSharedPointer< QPidController > QPidControllerPtr
void loggedChannelValues(QcepDoubleList values)
void QPTC10Device::onOutputChannelChanged ( )
slot

Definition at line 51 of file qptc10device.cpp.

References QPidDevice::outputChannelChanged(), outputChannelName(), and outputChannelUnits().

Referenced by QPTC10Device(), readoutInitial(), and start().

52 {
54 }
QString outputChannelName()
QString outputChannelUnits()
void outputChannelChanged(QString name, QString units)
QString QPTC10Device::outputChannelName ( )
private

Definition at line 89 of file qptc10device.cpp.

Referenced by changeRampRate(), changeSetPoint(), loopEnable(), onOutputChannelChanged(), outputChannelUnits(), and readoutPolling().

90 {
91  QStringList chans = get_OutputChannels();
92 
93  return chans.value(get_OutputChannel());
94 }
QString QPTC10Device::outputChannelUnits ( )
private

Definition at line 107 of file qptc10device.cpp.

References outputChannelName().

Referenced by onOutputChannelChanged().

108 {
109  QStringList chans = get_Channels();
110  QStringList units = get_ChannelUnits();
111  QString chan = outputChannelName();
112 
113  int indx = chans.indexOf(chan);
114 
115  return units.value(indx);
116 }
QString outputChannelName()
void QPTC10Device::parseChannelList ( QString  chans)
private

Definition at line 181 of file qptc10device.cpp.

References channels, DEBUG_PTC10, QPidDevice::graphedChannelNames(), inputChannels, QPidDevice::loggedChannelNames(), outputChannels, QPidDevice::printMessage(), and sendQuery().

Referenced by readoutPolling(), and updateChannelList().

182 {
183  if (qcepDebug(DEBUG_PTC10)) {
184  printMessage(tr("parseChannelList(\"%1\")").arg(chans.trimmed()));
185  }
186 
187  if (chans != get_ChannelList()) {
188  set_ChannelList(chans);
189  }
190 
191  QStringList channels, outputChannels, inputChannels;
192 
193  QStringList chs = chans.split(", ", QString::SkipEmptyParts);
194 
195  foreach(QString ch, chs) {
196  QString cht = ch.trimmed();
197  QString res = sendQuery(tr("\"%1.PID.Mode?\"").arg(cht));
198 
199  channels.append(ch.trimmed());
200 
201  if (res.startsWith("Error")) {
202  inputChannels.append(cht);
203  } else {
204  outputChannels.append(cht);
205  }
206  }
207 
208  set_Channels(channels);
209  set_InputChannels(inputChannels);
210  set_OutputChannels(outputChannels);
211 
212  QStringList res;
213  res.append("Epoch");
214  res.append("Day");
215  res.append("Hours");
216  res.append("Minutes");
217  res.append("Seconds");
218  res.append("Temperature");
219  res.append("Output");
220  res.append("Set Point");
221  res.append("Ramp Point");
222  res.append(channels);
223 
224  emit graphedChannelNames(res);
225  emit loggedChannelNames(res);
226 
227  if(qcepDebug(DEBUG_PTC10)) {
228  printMessage(chans.trimmed());
229  }
230 }
QcepStringList inputChannels
Definition: qptc10device.h:83
void graphedChannelNames(QStringList names)
QString sendQuery(QString cmd)
void loggedChannelNames(QStringList names)
QcepStringList channels
Definition: qptc10device.h:80
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
QcepStringList outputChannels
Definition: qptc10device.h:86
void QPTC10Device::parseOutputValues ( QString  chans)
private

Definition at line 269 of file qptc10device.cpp.

References DEBUG_PTC10, and QPidDevice::printMessage().

Referenced by readoutPolling().

270 {
271  QcepDoubleList vals;
272  QStringList vs = str.split(", ");
273 
274  foreach(QString v, vs) {
275  vals.append(v.toDouble());
276  }
277 
278  set_ChannelValues(vals);
279 
280  if(qcepDebug(DEBUG_PTC10)) {
281  printMessage(tr("parseOutputValues: %1").arg(str.trimmed()));
282  }
283 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::parseUnitsList ( QString  chans)
private

Definition at line 249 of file qptc10device.cpp.

References DEBUG_PTC10, and QPidDevice::printMessage().

Referenced by readoutPolling(), and updateChannelList().

250 {
251  if (str != get_UnitsList()) {
252  set_UnitsList(str);
253  }
254 
255  QStringList units;
256  QStringList us = str.split(", ");
257 
258  foreach(QString u, us) {
259  units.append(u.trimmed());
260  }
261 
262  set_ChannelUnits(units);
263 
264  if(qcepDebug(DEBUG_PTC10)) {
265  printMessage(tr("parseUnitsList: %1").arg(str.trimmed()));
266  }
267 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::ptc10test ( QString  cmd)
slot

Definition at line 480 of file qptc10device.cpp.

References QPidDevice::canReadLine(), QPidDevice::commPort(), QPidDevice::printMessage(), and QPidDevice::waitForReadyRead().

481 {
482  printMessage("PTC10 Test");
483 
484  commPort()->write(qPrintable(cmd+"\n"));
485 
486  while (commPort()->waitForReadyRead(1000)) {
487  if (commPort()->canReadLine()) {
488  break;
489  }
490  }
491 
492  QString r1 = commPort()->readLine(1000);
493 }
virtual int canReadLine()
Definition: qpiddevice.cpp:545
virtual int waitForReadyRead(int tmout=0)
Definition: qpiddevice.cpp:535
QPidCommPortPtr commPort()
Definition: qpiddevice.cpp:121
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::queryProperty ( QString  qry,
QcepDoubleProperty *  property,
double  scale = 1.0 
)
private

Definition at line 285 of file qptc10device.cpp.

References DEBUG_PTC10, QPidDevice::printMessage(), and sendQuery().

Referenced by readoutPolling().

286 {
287  if (qcepDebug(DEBUG_PTC10)) {
288  printMessage(tr("sendQuery %1").arg(qry));
289  }
290 
291  QString res = sendQuery(qry);
292 
293  if (property) {
294  property->setValue(res.toDouble()*scale);
295  }
296 }
QString sendQuery(QString cmd)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::queryProperty ( QString  qry,
QcepBoolProperty *  property 
)
private

Definition at line 298 of file qptc10device.cpp.

References DEBUG_PTC10, QPidDevice::printMessage(), and sendQuery().

299 {
300  if (qcepDebug(DEBUG_PTC10)) {
301  printMessage(tr("sendQuery %1").arg(qry));
302  }
303 
304  QString res = sendQuery(qry);
305 
306  if (property) {
307  property->setValue(!res.startsWith("Off"));
308  }
309 }
QString sendQuery(QString cmd)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::queryProperty ( QString  qry,
QcepStringProperty *  property 
)
private

Definition at line 311 of file qptc10device.cpp.

References DEBUG_PTC10, QPidDevice::printMessage(), and sendQuery().

312 {
313  if (qcepDebug(DEBUG_PTC10)) {
314  printMessage(tr("sendQuery %1").arg(qry));
315  }
316 
317  QString res = sendQuery(qry);
318 
319  if (property) {
320  property->setValue(res.trimmed());
321  }
322 }
QString sendQuery(QString cmd)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::readoutInitial ( )
slot

Definition at line 118 of file qptc10device.cpp.

References DEBUG_PTC10, onInputChannelChanged(), onOutputChannelChanged(), QPidDevice::printMessage(), sendCommand(), and updateChannelList().

119 {
120  if (qcepDebug(DEBUG_PTC10)) {
121  printMessage("Readout Initial");
122  }
123 
124 // QString res = immediateQuery("Channel.list");
125 
126 // printMessage(tr("Channel List : %1").arg(res));
127 
128  sendCommand("system.com.verbose medium");
129 
133 }
void onInputChannelChanged()
void onOutputChannelChanged()
void updateChannelList()
void sendCommand(QString cmd)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::readoutPolling ( )
slot

Definition at line 135 of file qptc10device.cpp.

References QPidDevice::controller(), DEBUG_PTC10, inputChannelName(), outputChannelName(), parseChannelList(), parseOutputValues(), parseUnitsList(), QPidDevice::printMessage(), queryProperty(), and sendQuery().

136 {
137  if (qcepDebug(DEBUG_PTC10)) {
138  printMessage("Readout Polling");
139  }
140 
142 
143  if (ctl) {
144  QString res = sendQuery("getOutput.names");
145 
146  if (res != get_ChannelList()) {
147  parseChannelList(res);
148  }
149 
150  res = sendQuery("getOutput.units");
151 
152  if (res != get_UnitsList()) {
153  parseUnitsList(res);
154  }
155 
156  res = sendQuery("getOutput");
157  parseOutputValues(res);
158 
159  if (outputChannelName().length()) {
160  queryProperty(tr("\"%1.PID.Mode?\"").arg(this->outputChannelName()), ctl->prop_LoopEnabled());
161  queryProperty(tr("\"%1.PID.Setpoint?\"").arg(this->outputChannelName()), ctl->prop_SetPoint());
162  queryProperty(tr("\"%1.PID.RampT?\"").arg(this->outputChannelName()), ctl->prop_RampPoint());
163  queryProperty(tr("\"%1.PID.Ramp?\"").arg(this->outputChannelName()), ctl->prop_RampRate(), 60.0);
164  queryProperty(tr("\"%1?\"").arg(this->outputChannelName()), ctl->prop_OutputLevel());
165  queryProperty(tr("outputEnable?"), ctl->prop_Enabled());
166  }
167 
168  if (inputChannelName().length()) {
169  queryProperty(tr("\"%1?\"").arg(this->inputChannelName()), ctl->prop_Temperature());
170  }
171  }
172 }
QString inputChannelName()
void queryProperty(QString qry, QcepDoubleProperty *property, double scale=1.0)
QPidControllerWPtr controller() const
Definition: qpiddevice.cpp:316
QSharedPointer< QPidController > QPidControllerPtr
QString sendQuery(QString cmd)
void parseOutputValues(QString chans)
QString outputChannelName()
void parseChannelList(QString chans)
void parseUnitsList(QString chans)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::readoutTimeout ( )
slot

Definition at line 174 of file qptc10device.cpp.

References QPidDevice::flushCommandQueue(), and QPidDevice::printMessage().

175 {
176  printMessage("Readout Timeout");
177 
179 }
void flushCommandQueue()
Definition: qpiddevice.cpp:472
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::readSettings ( QSettings *  set,
QString  section 
)
virtual

Reimplemented from QPidDevice.

Definition at line 63 of file qptc10device.cpp.

References QPidDevice::readSettings().

64 {
65  QPidDevice::readSettings(set, section+"/ptc10");
66 
67  QcepProperty::readSettings(this, &staticMetaObject, section+"/ptc10", set);
68 }
virtual void readSettings(QSettings *set, QString section)
Definition: qpiddevice.cpp:375
void QPTC10Device::sendCommand ( QString  cmd)
slot

Definition at line 357 of file qptc10device.cpp.

References QPidDevice::commPort(), DEBUG_PTC10, and QPidDevice::printMessage().

Referenced by changeRampRate(), changeSetPoint(), enable(), loopEnable(), and readoutInitial().

358 {
359  if (qcepDebug(DEBUG_PTC10)) {
360  printMessage(tr("cmmnd:%1").arg(cmd));
361  }
362 
363  if (QThread::currentThread() != thread()) {
364  printMessage("Thread error");
365  }
366 
367  if (commPort()) {
368  commPort()->write(qPrintable(cmd+"\n"));
369  commPort()->waitForBytesWritten(1000);
370  }
371 }
QPidCommPortPtr commPort()
Definition: qpiddevice.cpp:121
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
QString QPTC10Device::sendQuery ( QString  cmd)
private

Definition at line 324 of file qptc10device.cpp.

References QPidDevice::canReadLine(), QPidDevice::commPort(), DEBUG_PTC10, QPidDevice::printMessage(), and QPidDevice::waitForReadyRead().

Referenced by parseChannelList(), queryProperty(), readoutPolling(), and updateChannelList().

325 {
326  if (qcepDebug(DEBUG_PTC10)) {
327  printMessage(tr("query:%1").arg(cmd.trimmed()));
328  }
329 
330  if (QThread::currentThread() != thread()) {
331  printMessage("Thread error");
332  }
333 
334  QString res;
335 
336  if (commPort()) {
337  commPort()->readAll();
338  commPort()->write(qPrintable(cmd+"\n"));
339  commPort()->waitForBytesWritten(1000);
340 
341  while (commPort()->waitForReadyRead(1000)) {
342  if (commPort()->canReadLine()) {
343  res = commPort()->readLine(10000);
344 
345  if (qcepDebug(DEBUG_PTC10)) {
346  printMessage(tr("reply:%1").arg(res.trimmed()));
347  }
348 
349  return res;
350  }
351  }
352  }
353 
354  return res;
355 }
virtual int canReadLine()
Definition: qpiddevice.cpp:545
virtual int waitForReadyRead(int tmout=0)
Definition: qpiddevice.cpp:535
QPidCommPortPtr commPort()
Definition: qpiddevice.cpp:121
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime())
Definition: qpiddevice.cpp:321
void QPTC10Device::start ( )
slot

Definition at line 33 of file qptc10device.cpp.

References onInputChannelChanged(), onOutputChannelChanged(), and QPidDevice::start().

34 {
36 
39 }
void onInputChannelChanged()
void onOutputChannelChanged()
virtual void start()
Definition: qpiddevice.cpp:139
void QPTC10Device::stop ( )
slot

Definition at line 41 of file qptc10device.cpp.

References QPidDevice::stop().

42 {
44 }
virtual void stop()
Definition: qpiddevice.cpp:189
void QPTC10Device::updateChannelList ( )
slot

Definition at line 232 of file qptc10device.cpp.

References QPidDevice::commPort(), parseChannelList(), parseUnitsList(), and sendQuery().

Referenced by readoutInitial().

233 {
234  if (QThread::currentThread() != thread()) {
235  QMetaObject::invokeMethod(this, "updateChannelList", Qt::BlockingQueuedConnection);
236  } else {
237  if (commPort()->successfullyConnected()) {
238  QString res = sendQuery("getOutput.names");
239 
240  parseChannelList(res);
241 
242  res = sendQuery("getOutput.units");
243 
244  parseUnitsList(res);
245  }
246  }
247 }
QString sendQuery(QString cmd)
void parseChannelList(QString chans)
QPidCommPortPtr commPort()
Definition: qpiddevice.cpp:121
void parseUnitsList(QString chans)
void QPTC10Device::writeSettings ( QSettings *  set,
QString  section 
)
virtual

Reimplemented from QPidDevice.

Definition at line 56 of file qptc10device.cpp.

References QPidDevice::writeSettings().

57 {
58  QPidDevice::writeSettings(set, section+"/ptc10");
59 
60  QcepProperty::writeSettings(this, &staticMetaObject, section+"/ptc10", set);
61 }
virtual void writeSettings(QSettings *set, QString section)
Definition: qpiddevice.cpp:366

Member Data Documentation

QPTC10DeviceDialogPtr QPTC10Device::m_DeviceDialog
private

Definition at line 126 of file qptc10device.h.

Referenced by configurationDialog().

QPidObjectNamer QPTC10Device::m_ObjectNamer

Definition at line 56 of file qptc10device.h.

Property Documentation

QString QPTC10Device::channelList
readwrite

Definition at line 77 of file qptc10device.h.

QcepStringList QPTC10Device::channels
readwrite

Definition at line 80 of file qptc10device.h.

Referenced by parseChannelList().

QcepStringList QPTC10Device::channelUnits
readwrite

Definition at line 92 of file qptc10device.h.

QcepDoubleList QPTC10Device::channelValues
readwrite

Definition at line 95 of file qptc10device.h.

int QPTC10Device::inputChannel
readwrite

Definition at line 98 of file qptc10device.h.

QcepStringList QPTC10Device::inputChannels
readwrite

Definition at line 83 of file qptc10device.h.

Referenced by parseChannelList().

QString QPTC10Device::inputUnits
readwrite

Definition at line 101 of file qptc10device.h.

int QPTC10Device::outputChannel
readwrite

Definition at line 104 of file qptc10device.h.

QcepStringList QPTC10Device::outputChannels
readwrite

Definition at line 86 of file qptc10device.h.

Referenced by parseChannelList().

QString QPTC10Device::outputUnits
readwrite

Definition at line 107 of file qptc10device.h.

QString QPTC10Device::unitsList
readwrite

Definition at line 89 of file qptc10device.h.


The documentation for this class was generated from the following files: