/*
 * SmartHome server: Plug-in timer
 *
 * 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 shtimer.h
 * @brief Implements a simple timer
 * @author Daniel Pisi
 */

#ifndef SHTIMER_H
#define SHTIMER_H

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

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

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

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

private slots:
    void onTimeout();

private:
    QTimer *mTimer;
    bool mOutput;
};
// -----------------------------------------------------------------------------

#endif // SHTIMER_H
