#ifndef IWATCHDOG_H #define IWATCHDOG_H #include class QTimer; class IWatchDog : public QObject { Q_OBJECT public: IWatchDog(const QString &name, QObject *parent = Q_NULLPTR); ~IWatchDog(); bool open(int timeoutSeconds, float feedSeconds); bool close(); bool isOpen(); void setFeed(bool bFeed=true); void setFeedTime(float seconds); void setTimeoutTime(int seconds); Q_SIGNALS: void feedCount(int count); public slots: void feedDog(); private: void checkoutTime(); protected: QString m_dogName; int m_type; int m_fd; bool m_feed; int m_timeoutTimes; float m_feedTimes; int m_feedCount; QTimer *m_timer; }; #endif // IWATCHDOG_H