watchdog timer implementation based on QTimer
Hello!
Here is the problem:
I'm trying to implement a watchdogtimer-like behavior of Motion-Detection software.
1. When we recieve first MOTION-signal, we start video capturing and QTimer, which connected to stopVideoCapture().
2. If we don't recieve any MOTION-signal while timer is active, then stopVideoCapture() is called - and all done.
2a. But if we recieve another MOTION-signal, we need to restart timer to prolongate video capturing process... but I get stuck here - don't understand how to reset QTimer....
Code:
timer->stop();
timer->start(15000);
won't work because stopVideoCapture() is called after 15 sec from initial timer->start() no matter how many MOTION-signals were recieved within that interval...
Any suggestions?
Thanks in advance!
Re: watchdog timer implementation based on QTimer
Hi,
Can you post the initialization part of your QTimer.Also, make sure it is not setup for singleshot.
Re: watchdog timer implementation based on QTimer
Hello.
Thanks for your reaction, but I worked out this problem....
People, sorry, this topic is solved, it can be closed.
There was my mistake - bug in emiting of MOTION-signal
But look at it from bright side - now it's tested that QTimer's combination stop()-start() works...
Sorry again :o
Re: watchdog timer implementation based on QTimer
Quote:
Originally Posted by
QbelcorT
Hi,
Can you post the initialization part of your QTimer.Also, make sure it is not setup for singleshot.
by the way, singleshot timer is ok for that algorithm... I called setSingleShot(true) when init it.