I'd appreciate some advice on structuring my ConnectPort X2 python application.
Sitting behind the X2 gateway we have 7 pieces of custom electronics with XBee Series 2 radios (ZNet 2.5, v1241). 6 of these are "launchers", the 7th is a "popper". The origin of the naming is probably best understood by looking at this Flickr photo stream, http://www.flickr.com/photos/futnuh/sets/72157604097042458/?page=3
Every 10 seconds launchers emit a short "ping" message. The X2 is supposed to answer with a "pong" response. Failure to do so will eventually result in a launcher resetting its XBee2 radio. When a launcher is fired, it emits a sequence of short messages: "fire", "wait", "ready". The popper isn't manually activated but fires based on a countdown timer. The popper can also be put into a sleep mode. This needs to occur if no launchers fire for some number of minutes (i.e. the room is empty).
All of the infrastructure for the above is in place. We can telnet into the X2 and run simple scripts that observe the "ping" messages and fire sequences. We can send commands to the launchers and popper as required. It's time to wrap this all up into a single application that runs on the X2 at boot time. The question then: how to structure this application?
The simple script I use at the moment opens up a socket to the endpoint (gateway) and repeatedly blocks until data is received from the mesh network. This precludes any sort of pro-active (rather than reactive) business logic happening. If I want tasks to occur - like say sending status updates by UPD back to the office - these really should occur as scheduled events. As should putting the popper into sleep mode.
On a regular computer, I'd use Twisted. What would you suggest on the X2, asyncore?