Torc  0.1
torcpiswitchinput.h
Go to the documentation of this file.
1 #ifndef TORCPISWITCHINPUT_H
2 #define TORCPISWITCHINPUT_H
3 
4 // Qt
5 #include <QFile>
6 
7 // Torc
8 #include "torcqthread.h"
9 #include "torcswitchinput.h"
10 
11 class TorcPiSwitchInput;
12 
14 {
15  Q_OBJECT
16  public:
18  virtual ~TorcPiSwitchInputThread() = default;
19 
20  void Start (void) override;
21  void Finish (void) override;
22  void Stop (void);
23 
24  signals:
25  void Changed (double Value);
26 
27  protected:
28  void run (void) override;
29  void Update (void);
30 
31  private:
32  Q_DISABLE_COPY(TorcPiSwitchInputThread)
33  TorcPiSwitchInput *m_parent;
34  int m_pin;
35  bool m_aborted;
36  QFile m_file;
37 };
38 
39 class TorcPiSwitchInput final : public TorcSwitchInput
40 {
41  Q_OBJECT
42 
43  public:
44  TorcPiSwitchInput(int Pin, const QVariantMap &Details);
45  virtual ~TorcPiSwitchInput();
46 
47  void Start (void) override;
48  QStringList GetDescription (void) override;
49 
50  private:
51  Q_DISABLE_COPY(TorcPiSwitchInput)
52  int m_pin;
53  TorcPiSwitchInputThread *m_inputThread;
54 };
55 
56 #endif // TORCPISWITCHINPUT_H
void Changed(double Value)
virtual ~TorcPiSwitchInputThread()=default
void Start(void) override
TorcPiSwitchInputThread(TorcPiSwitchInput *Parent, int Pin)
void Finish(void) override
A Torc specific wrapper around QThread.
Definition: torcqthread.h:7