PDA

View Full Version : watchdog timer implementation based on QTimer



araglin
18th May 2009, 16:02
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....


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!

QbelcorT
18th May 2009, 16:23
Hi,
Can you post the initialization part of your QTimer.Also, make sure it is not setup for singleshot.

araglin
18th May 2009, 16:33
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

araglin
18th May 2009, 16:34
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.