Blame view

app/gui/oven_control/oven.h 4 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
4
5
6
7
8
9
10
11
  #ifndef OVEN_H
  #define OVEN_H
  
  #include <QObject>
  #include <QTimer>
  
  class OvenInterface : public QObject
  {
      Q_OBJECT
  
  public:
c598b01b2   김태훈   GUI 업데이트
12
      OvenInterface(QObject *parent = 0) : QObject(parent) {}
8c2952457   김태훈   응용 프로그램 추가
13
14
15
16
17
18
19
      virtual ~OvenInterface(){}
      virtual int currentTemp() = 0;
      virtual int currentHumidity() = 0;
      virtual int currentInterTemp() = 0;
      virtual bool door() = 0;
  
  signals:
c598b01b2   김태훈   GUI 업데이트
20
21
      void doorOpened();
      void doorClosed();
8c2952457   김태훈   응용 프로그램 추가
22
23
24
25
26
  
  public slots:
  //    virtual void setMode(Oven::Mode mode) = 0;
      virtual void setHumidity(int percentage) = 0;
      virtual void setTemp(int celsius) = 0;
43d009fb5   김태훈   오븐 제어 인터페이스에 시간 설...
27
      virtual void setTime(int secs) = 0;
8c2952457   김태훈   응용 프로그램 추가
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
      virtual void setInterTemp(int celsius) = 0;
      virtual void setFan(int rpm) = 0;
  
      virtual void startCooking() = 0;
      virtual void stopCooking() = 0;
      virtual void startPreheating() = 0;
      virtual void stopPreheating() = 0;
      virtual void startCooldown() = 0;
      virtual void stopCooldown() = 0;
      virtual void startHumidification() = 0;
      virtual void stopHumidification() = 0;
      virtual void startWashing() = 0;
      virtual void stopWashing() = 0;
  
      virtual void openDamper() = 0;
      virtual void closeDamper() = 0;
  };
  
  Q_DECLARE_INTERFACE(OvenInterface, "OvenInterface")
  
  class Oven : public QObject
  {
      Q_OBJECT
  
  public:
      enum Mode { HeatMode, SteamMode, CombinationMode };
  
  private:
      Mode mode_;
      int humidity_;
      int temp_;
      int time_;
      bool interTempEnabled_ = false;
      int interTemp_;
      int fan_; // 1 ~ 5
      bool cooking_ = false;
      bool preheating_ = false;
      bool cooldown_ = false;
      bool damper_ = false; // true: open, false: close
      bool humidification_ = false;
      bool door_ = false; // true: open, false: close
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
69
70
71
72
  
      int currentHumidity_;
      int currentTemp_;
      int currentInterTemp_;
8c2952457   김태훈   응용 프로그램 추가
73
74
75
76
77
  
  
      bool paused_;
  
      QTimer cookingTimer;
c598b01b2   김태훈   GUI 업데이트
78
      QTimer damperTimer;
8c2952457   김태훈   응용 프로그램 추가
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
      QTimer humidificationTimer;
      QTimer interTempTimer;
  
      OvenInterface *interface;
  
  public:
      explicit Oven(QObject *parent = 0);
  
  
      Mode mode() { return mode_; }
      int humidity() { return humidity_; }
      int temp() { return temp_; }
      int time();
      bool interTempEnabled() { return interTempEnabled_; }
      int interTemp() { return interTemp_; }
      int fan() { return fan_; }
      bool cooking() { return cooking_; }
      bool preheating() { return preheating_; }
      bool cooldown() { return cooldown_; }
      bool damper() { return damper_; }
      bool humidification() { return humidification_; }
      bool door() { return door_; }
8c2952457   김태훈   응용 프로그램 추가
101
      bool paused() { return paused_; }
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
102
103
104
      int currentTemp() { return currentTemp_; }
      int currentHumidity() { return currentHumidity_; }
      int currentInterTemp() { return currentInterTemp_; }
8c2952457   김태훈   응용 프로그램 추가
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
  
      bool cookingStartable();
      bool preheatingStartable();
      bool cooldownStartable();
      bool humidificationStartable();
      bool damperOpenable();
  
  
      int maxTemp();
      int minTemp();
      int maxInterTemp();
      int minInterTemp();
      int maxFan();
      int minFan();
  
  signals:
      void changed(Oven *);
      void doorOpened();
  
  public slots:
      void setMode(Mode mode);
      void setDefault(Mode mode);
      void setHumidity(int percentage);
      void setTemp(int celsius);
      void setTime(int secs);
      void setInterTempEnabled(bool enabled);
      void setInterTemp(int celsius);
      void setFan(int speed);
  
      void stop();
      void startCooking();
      void stopCooking();
      void startPreheating();
      void stopPreheating();
      void startCooldown();
      void stopCooldown();
      void startHumidification();
      void stopHumidification();
8c2952457   김태훈   응용 프로그램 추가
143
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
144
      void openDamper(int secs = 300);
8c2952457   김태훈   응용 프로그램 추가
145
      void closeDamper();
6eb13ba2e   김태훈   예열 팝업 동작 보완 및 동작 ...
146
147
148
      void setCurrentHumidity(int percentage);
      void setCurrentTemp(int celsius);
      void setCurrentInterTemp(int celsius);
8c2952457   김태훈   응용 프로그램 추가
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
  
      void setInterface(OvenInterface *interface);
  
  private slots:
      bool setMode_(Mode mode);
      bool setHumidity_(int percentage);
      bool setTemp_(int celsius);
      bool setInterTempEnabled_(bool enabled);
      bool setInterTemp_(int celsius);
      bool setFan_(int speed);
  
  
  
      void onDoorOpened();
      void onDoorClosed();
  };
  
  
  
  #endif // OVEN_H