SEPIA
Software documentation for the APEX SEPIA receivers
environment.h
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef ENVIRONMENT_H
3 #define ENVIRONMENT_H
4 
5 #include <QGroupBox>
6 #include <QLabel>
7 #include <QDateTime>
8 #include <QTimer>
9 
10 #include "statusled.h"
11 
12 class Environment : public QGroupBox
13 {
14  Q_OBJECT
15  Q_PROPERTY(float dewarTemperature READ dewarTemperature)
16  Q_PROPERTY(float dewarPressure READ dewarPressure)
17  Q_PROPERTY(bool onUPS READ onUPS)
18 
19  public:
20  explicit Environment(QWidget *parent = 0);
21  float dewarTemperature() const { return m_dewarT; }
22  float dewarPressure() const { return m_dewarp; }
23  bool onUPS() const { return m_onups; }
24 
25  public slots:
26  void update(const QDateTime &tstamp, float T0, float T1, float T2, float T3, float p, bool ups);
27  void gpioConnected() { gpioLED->setOn(); }
28  void gpioDisconnected() { gpioLED->setOff(); }
29  void gpioError() { gpioLED->setError(); }
30  void ifConnected() { ifLED->setOn(); }
31  void ifDisconnected() { ifLED->setOff(); }
32  void ifError() { ifLED->setError(); }
33  void backendConnected() { backendLED->setOn(); }
34  void backendDisconnected() { backendLED->setOff(); }
35  void backendError() { backendLED->setError(); }
36  void agilentConnected() { agilentLED->setOn(); }
37  void agilentDisconnected() { agilentLED->setOff(); }
38  void agilentError() { agilentLED->setError(); }
39  void mcConnected(bool on) { on ? mcLED->setReady(false) : mcLED->setOff(); }
40  void mcReady(bool on) { mcLED->setReady(on); }
41  void mcError() { mcLED->setError(); }
42  void loggerRegistered(const QString &) { envLED->setOn(); }
43  void loggerUnregistered(const QString &) { envLED->setError(); }
44 
45  private:
46  QDateTime lastReading;
47  StatusLED *mcLED;
48  StatusLED *gpioLED;
49  StatusLED *ifLED;
50  StatusLED *backendLED;
51  StatusLED *agilentLED;
52  StatusLED *envLED;
53 
54  QLabel *gpioLabel;
55  QLabel *ifLabel;
56  QLabel *backendLabel;
57  QLabel *agilentLabel;
58 
59  QLabel *cryoA;
60  QLabel *cryoB;
61  QLabel *cryoC;
62  QLabel *cryoD;
63  QLabel *vacuum;
64  QLabel *ups;
65  QLabel *logtime;
66 
67  QTimer timer;
68  float m_dewarT;
69  float m_dewarp;
70  bool m_onups;
71 };
72 
73 #endif