Torc  0.1
torcinput.h
Go to the documentation of this file.
1 #ifndef TORCINPUT_H
2 #define TORCINPUT_H
3 
4 // Qt
5 #include <QMutex>
6 #include <QObject>
7 
8 // Torc
9 #include "http/torchttpservice.h"
10 #include "torcdevice.h"
11 
12 #define INPUTS_DIRECTORY QStringLiteral("inputs")
13 
14 class TorcInput : public TorcDevice, public TorcHTTPService
15 {
16  Q_OBJECT
17  Q_CLASSINFO("Version", "1.0.0")
18  Q_PROPERTY(double operatingRangeMin READ GetOperatingRangeMin CONSTANT)
19  Q_PROPERTY(double operatingRangeMax READ GetOperatingRangeMax CONSTANT)
22 
23  public:
24  enum Type
25  {
26  Unknown = 0,
28  pH,
30  PWM,
35  };
36 
37  Q_ENUM(Type)
38 
39  public:
40  TorcInput(TorcInput::Type Type, double Value, double RangeMinimum, double RangeMaximum,
41  const QString &ModelId, const QVariantMap &Details);
42 
43 
44  virtual TorcInput::Type GetType (void) = 0;
45  virtual void Start (void) override;
46  QString GetUIName (void) override;
47 
48  protected:
49  virtual ~TorcInput() = default;
50 
51  signals:
52  void OutOfRangeLowChanged (bool Value);
53  void OutOfRangeHighChanged (bool Value);
54 
55  public slots:
56  // TorcHTTPService
57  void SubscriberDeleted (QObject *Subscriber);
58 
59  void SetValue (double Value) override;
60  void SetValid (bool Valid) final;
61 
62  double GetOperatingRangeMin (void);
63  double GetOperatingRangeMax (void);
64  bool GetOutOfRangeLow (void);
65  bool GetOutOfRangeHigh (void);
66 
67  protected:
68  double operatingRangeMin;
69  double operatingRangeMax;
70  bool outOfRangeLow;
71  bool outOfRangeHigh;
72 };
73 
74 #endif // TORCINPUT_H
bool GetOutOfRangeHigh(void)
Definition: torcinput.cpp:172
bool outOfRangeLow
Definition: torcinput.h:20
bool GetOutOfRangeLow(void)
Definition: torcinput.cpp:165
double GetOperatingRangeMin(void)
Definition: torcinput.cpp:153
double GetOperatingRangeMax(void)
Definition: torcinput.cpp:159
void SubscriberDeleted(QObject *Subscriber)
Definition: torcinput.cpp:81
void OutOfRangeLowChanged(bool Value)
void SetValid(bool Valid) final
Definition: torcinput.cpp:143
double operatingRangeMin
Definition: torcinput.h:18
void OutOfRangeHighChanged(bool Value)
void SetValue(double Value) override
Update the inputs value.
Definition: torcinput.cpp:90
bool outOfRangeHigh
Definition: torcinput.h:21
QString GetUIName(void) override
Definition: torcinput.cpp:73
virtual TorcInput::Type GetType(void)=0
double operatingRangeMax
Definition: torcinput.h:19
virtual void Start(void) override
Definition: torcinput.cpp:65