Now that the executive_smach stack reached a stable 1.0 status, we're exploring new ideas for future releases:
Enable programmatic use of the smach API
The way smach uses the Python 'with' statement makes it difficult to use smach programatically. We plan to resolve this in future releases, but this will most likely involve API changes.
Some example code can be found in asmach and asmach_tutorials here. Only a handful of files have been asynchronized so far:
- in asmach: state.py, state_machine.py
- in asmach_tutorials: state_machine.py state_machine2.py
- dhcp client
I added async.py, which currently is just a wrapper around twisted.internet. (But by changing a switch you can activate my implementation that has no dependencies, but that won't be as nice so far for event handling.)
state_machin.py is asmach is the best place to look for how to transform synchronous into asynchronous.
The dhcp client has been working nicely for a while, and gives a good idea of what's going on. See this file for more details. This code is completely asynchronous (never blocks), but reads pretty similarly to synchronous code.