qdppms.h
1 /***************************************************************************
2  Copyright (C) 2002-2016 Shota Suetsugu and Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #ifndef qdppmsH
15 #define qdppmsH
16 
17 //---------------------------------------------------------------------------
18 #include "primarydriverwiththread.h"
19 #include "xnodeconnector.h"
20 
21 class XScalarEntry;
22 class QMainWindow;
23 class Ui_FrmQDPPMS;
25 
26 //! GPIB/serial interface for Quantum Design PPMS Model6000 or later
27 class DECLSPEC_SHARED XQDPPMS : public XPrimaryDriverWithThread {
28 public:
29  XQDPPMS(const char *name, bool runtime,
30  Transaction &tr_meas, const shared_ptr<XMeasure> &meas);
31  //! usually nothing to do
32  virtual ~XQDPPMS() = default;
33  //! Shows all forms belonging to driver
34  virtual void showForms();
35 
36  struct Payload : public XPrimaryDriver::Payload {
37  double temp() const {return m_sampleTemp;}
38  double user_temp() const {return m_sampleUserTemp;}
39  double magnetField() const {return m_magnetField;}
40  double position() const {return m_samplePosition;}
41  private:
42  friend class XQDPPMS;
43  double m_magnetField;
44  double m_samplePosition;
45  double m_sampleTemp;
46  double m_sampleUserTemp;
47  };
48 protected:
49  //! This function will be called when raw data are written.
50  //! Implement this function to convert the raw data to the record (Payload).
51  //! \sa analyze()
52  virtual void analyzeRaw(RawDataReader &reader, Transaction &tr) throw (XRecordError&);
53  //! This function is called after committing XPrimaryDriver::analyzeRaw() or XSecondaryDriver::analyze().
54  //! This might be called even if the record is invalid (time() == false).
55  virtual void visualize(const Snapshot &shot);
56 
57  //! driver specific part below
58  const shared_ptr<XScalarEntry> &field() const {return m_field;}
59  const shared_ptr<XScalarEntry> &position() const {return m_position;}
60  const shared_ptr<XScalarEntry> &temp() const {return m_temp;}
61  const shared_ptr<XScalarEntry> &user_temp() const {return m_user_temp;}
62  const shared_ptr<XDoubleNode> &heliumLevel() const {return m_heliumLevel;}
63 
64  const shared_ptr<XDoubleNode> &targetField() const {return m_targetField;}
65  const shared_ptr<XDoubleNode> &fieldSweepRate() const {return m_fieldSweepRate;}
66  const shared_ptr<XComboNode> &fieldApproachMode() const {return m_fieldApproachMode;}
67  const shared_ptr<XComboNode> &fieldMagnetMode() const {return m_fieldMagnetMode;}
68  const shared_ptr<XStringNode> &fieldStatus() const {return m_fieldStatus;}
69 
70  const shared_ptr<XDoubleNode> &targetPosition() const {return m_targetPosition;}
71  const shared_ptr<XComboNode> &positionApproachMode() const {return m_positionApproachMode;}
72  const shared_ptr<XIntNode> &positionSlowDownCode() const {return m_positionSlowDownCode;}
73  const shared_ptr<XStringNode> &positionStatus() const {return m_positionStatus;}
74 
75  const shared_ptr<XDoubleNode> &targetTemp() const {return m_targetTemp;}
76  const shared_ptr<XDoubleNode> &tempSweepRate() const {return m_tempSweepRate;}
77  const shared_ptr<XComboNode> &tempApproachMode() const {return m_tempApproachMode;}
78  const shared_ptr<XStringNode> &tempStatus() const {return m_tempStatus;}
79 protected:
80  virtual void setField(double field, double rate, int approach_mode, int magnet_mode) = 0;
81  virtual void setPosition(double position, int mode, int slow_down_code) = 0;
82  virtual void setTemp(double temp, double rate, int approach_mode) = 0;
83  virtual double getField() = 0;
84  virtual double getPosition() = 0;
85  virtual double getTemp() = 0;
86  virtual double getUserTemp() = 0;
87  virtual double getHeliumLevel() = 0;
88  virtual int getStatus() = 0;
89 private:
90  virtual void onFieldChanged(const Snapshot &shot, XValueNodeBase *);
91  virtual void onPositionChanged(const Snapshot &shot, XValueNodeBase *);
92  virtual void onTempChanged(const Snapshot &shot, XValueNodeBase *);
93 
94  const shared_ptr<XScalarEntry> m_field, m_position, m_temp, m_user_temp;
95 
96  const shared_ptr<XDoubleNode> m_heliumLevel;
97 
98  const shared_ptr<XDoubleNode> m_targetField, m_fieldSweepRate;
99  const shared_ptr<XComboNode> m_fieldApproachMode, m_fieldMagnetMode;
100  const shared_ptr<XStringNode> m_fieldStatus;
101 
102  const shared_ptr<XDoubleNode> m_targetPosition;
103  const shared_ptr<XComboNode> m_positionApproachMode;
104  const shared_ptr<XIntNode> m_positionSlowDownCode;
105  const shared_ptr<XStringNode> m_positionStatus;
106 
107  const shared_ptr<XDoubleNode> m_targetTemp, m_tempSweepRate;
108  const shared_ptr<XComboNode> m_tempApproachMode;
109  const shared_ptr<XStringNode> m_tempStatus;
110 
111  shared_ptr<XListener> m_lsnFieldSet, m_lsnTempSet, m_lsnPositionSet;
112 
113  std::deque<xqcon_ptr> m_conUIs;
114 
115  const qshared_ptr<FrmQDPPMS> m_form;
116 
117  void *execute(const atomic<bool> &);
118 };
119 
120 #endif

Generated for KAME4 by  doxygen 1.8.3