#ifndef OVEN_H #define OVEN_H #include #include class OvenInterface : public QObject { Q_OBJECT public: virtual ~OvenInterface(){} virtual int currentTemp() = 0; virtual int currentHumidity() = 0; virtual int currentInterTemp() = 0; virtual bool door() = 0; signals: virtual void doorOpened() = 0; virtual void doorClosed() = 0; public slots: // virtual void setMode(Oven::Mode mode) = 0; virtual void setHumidity(int percentage) = 0; virtual void setTemp(int celsius) = 0; 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; 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