xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/watchdog/iwatchdog.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef IWATCHDOG_H
2 #define IWATCHDOG_H
3 #include <QObject>
4 
5 class QTimer;
6 class IWatchDog : public QObject
7 {
8     Q_OBJECT
9 
10 public:
11     IWatchDog(const QString &name, QObject *parent = Q_NULLPTR);
12     ~IWatchDog();
13 
14     bool open(int timeoutSeconds, float feedSeconds);
15     bool close();
16     bool isOpen();
17 
18     void setFeed(bool bFeed=true);
19     void setFeedTime(float seconds);
20     void setTimeoutTime(int seconds);
21 
22 Q_SIGNALS:
23     void feedCount(int count);
24 
25 public slots:
26     void feedDog();
27 
28 private:
29     void checkoutTime();
30 
31 protected:
32 
33     QString m_dogName;
34     int m_type;
35     int m_fd;
36     bool m_feed;
37     int m_timeoutTimes;
38     float m_feedTimes;
39     int m_feedCount;
40     QTimer *m_timer;
41 };
42 
43 #endif // IWATCHDOG_H
44