Catching Keyboard interrupt is counter productive here as the previous
signal handler might be SIGINT which works by raising KeyboardInterrupt.
This has caused ctrl+c to remove the lock file but not stop the process.
Ignoring SIG_CHLD can be convenient but parts of the python standard
library relies on the behaviour of SIG_CHLD and will not work correctly
in this configuration.
I'm not 100% certain why this is needed, to be honest. Maybe something I don't get about Python and threads? This fixes double-announcements about connecting to the internet.
16.0.0 seem to have problems with newer versions of system installed
openSSL stack. Discussion in issue #705
Thanks to BoBeR182 for providing this solution.
On the Mark 1 device, there is a sequence of events that produce a guide to the user for getting their device setup and connected to the internet. This process is basically:
* Enclosure client starts up, sending a message to the Arduino
* When/if the Arduino responds, it checks for a live internet connection
* If no connection is found, the user is prompted
However the speech client was sometimes not fully up, so the request to speak the prompt was sent before it was listening.
Additionally, sometimes events would occur that caused the prompt to connect the unit multiple time in a row. This commit limits the prompts to a max of once every 30 seconds.
Finally, I commented the code and renamed some of the methods to clarify this sequence of events. The code:
Timer(5, self.stop).start()
and:
def stop(self):
if not self.started:
self.writer.stop()
Are some of the most confusing lines of code I've ever seen. :)
Major changes:
* The messagebus message "enclosure.start" is now "enclosure.started"
* Enclosure.start() is now Enclosure.on_arduino_responded()
* Enclosure.started is now Enclosure.arduino_responded
* Added Enclosure.last_internet_notification to track notification times
* The notification call to the speech client is now delayed by 5 seconds, providing time for the speech client to come up. (And an additional check is run to verify the connection is still down immediately before the verbal prompt is spoken)