Blame view

app/gui/oven_control/oven.h 3.94 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
69
70
71
72
73
74
      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
      bool washing_ = false;
  
  
      bool paused_;
  
      QTimer cookingTimer;
c598b01b2   김태훈   GUI 업데이트
75
      QTimer damperTimer;
8c2952457   김태훈   응용 프로그램 추가
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
      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_; }
      bool washing() { return washing_; }
      bool paused() { return paused_; }
  
      int currentTemp() { return interface->currentTemp(); }
      int currentHumidity() { return interface->currentHumidity(); }
      int currentInterTemp() { return interface->currentInterTemp(); }
  
      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();
      void startWashing();
      void stopWashing();
  
      void openDamper();
      void closeDamper();
  
  
      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