ovencontroller.cpp 1.85 KB
#include "ovencontroller.h"

OvenController::OvenController(QObject *parent) : OvenInterface(parent)
{

}

void OvenController::setUdpHandler(UdpHandler *udp)
{
    this->udp = udp;
    connect(udp, SIGNAL(changed()), this, SLOT(onDataChanged()));
}

void OvenController::onDataChanged()
{
    udp->fillControl(control);
    udp->fillData(state);
}

int OvenController::currentTemp()
{
    return state.curr_heat;
}


int OvenController::currentHumidity()
{
    return state.curr_humidity;
}

int OvenController::currentInterTemp()
{
    return 0;
}

bool OvenController::door()
{
    return state.door_state;
}

void OvenController::setHumidity(int percentage)
{
    udp->set(TG_HUMIDITY, percentage);
}

void OvenController::setTemp(int celsius)
{
    udp->set(TG_HEAT, celsius);
}

void OvenController::setTime(int secs)
{
    udp->set(TG_TIME, secs);
}

void OvenController::setInterTemp(int celsius)
{
    udp->set(TG_INNER_TEMP, celsius);
}

void OvenController::setFan(int rpm)
{
    udp->set(TG_CONV_RPM, rpm);
}

void OvenController::startCooking()
{
    udp->set(TG_OVEN_MODE, 1);
    udp->turnOn(TG_SYSTEM);
    udp->turnOn(TG_COOKING);
}

void OvenController::stopCooking()
{
    udp->turnOff(TG_COOKING);
}

void OvenController::startPreheating()
{
    udp->set(TG_OVEN_MODE, 0);
    udp->turnOn(TG_SYSTEM);
    udp->turnOn(TG_PREHEAT);
}

void OvenController::stopPreheating()
{
    udp->turnOff(TG_PREHEAT);
}

void OvenController::startCooldown()
{
    udp->turnOn(TG_COOLDOWN);
}

void OvenController::stopCooldown()
{
    udp->turnOff(TG_COOLDOWN);
}

void OvenController::startHumidification()
{
    udp->turnOn(TG_INNERWATER);
}

void OvenController::stopHumidification()
{
    udp->turnOff(TG_INNERWATER);
}

void OvenController::startWashing()
{

}

void OvenController::stopWashing()
{

}

void OvenController::openDamper()
{

}

void OvenController::closeDamper()
{

}