mcicolella/freedomotic — pull request #2 by sarxos (2014-10-12 20:34:13+00:00)
Title: Minor changes in camera handling

Hi @mcicolella,

Great project :) I really like it and I'm sure to keep an eye on it.

I added few changes which should make your code more responsive:
* Open cameras and start panels/detectors in parallel, so GUI will not have to wait for these components to initialize (otherwise user may be forced to wait several seconds just for the GUI to appear).
* Open cameras in asynchronous mode. This causes calls to getImage() to be non-blocking so the problem that new image can be consumed by very active thread and other threads does not see the change at all.
* Use same interval/fps in panel and detector. Because of the network latency, in case of IP cameras there is no need to have low motion detection interval (one check per 100 ms is meaningless when you receive new image once per e.g. second). I used 2-seconds intervals for both panel rendering and motion check. Feel free to tune it if you need :)

I hope I didn't drop any bug or syntax error in the code since I edited it directly on github without checking if it works.

Take care!