/*
 * SmartHome server: Plug-in thermostat
 *
 * Copyright (C) 2010 Daniel Pisi <dan.pisi@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License
 * as published by the Free Software Foundation.
 *
 */

/**
 * @file shthermostat.h
 * @brief Implements a simple thermostat
 * @author Daniel Pisi
 */

#ifndef SHTHERMOSTAT_H
#define SHTHERMOSTAT_H

#include <QtCore/QCoreApplication>
#include <QtPlugin>
#include <QObject>
#include "shobjecthelper.h"

// -----------------------------------------------------------------------------

/**
 * \class ShThermostat
 * \brief Implements a simple thermostat
 */
class ShThermostat : public ShObjectHelper
{
    Q_OBJECT
    Q_INTERFACES(ShObject)

public:
    ShThermostat();
    virtual ~ShThermostat() {};
    virtual bool init(QString param);
    virtual void updatePins(const QList<ShPin> &pins) {};
    virtual void processMessage(ShMessagePtr message);

private:
    void updateOutput();

    double mDesiredTemp;
    double mMeasuredTemp;
    double mHysteresis;
    int    mOutput;
};
// -----------------------------------------------------------------------------

#endif // SHTHERMOSTAT_H
