[Twisted-Python] Serial port communication

Eugene Coetzee projects at reedflute.com
Fri Mar 28 09:28:30 EDT 2008

Daniel Marfil wrote:

> So I can get the whole response from the modem, but in that moment I 
> don't know how to tell the factory that it can send another 
> writeSomeData (remember that it must be done in a sequential way).
> So the question is: how can I tell the factory that it can run another 
> writeSomeData once I got the right response from the modem?
> I know that the main problem is my inexperience with Twisted, so I'm 
> sure there's a better way to implement this. Maybe a more appropiate 
> protocol?
> Any clue will be very welcome ;-)
You will have to have some knowledge of the protocol used by the modem - 
typically Hayes AT (http://www-dcg.fnal.gov/Net/HYSTRM20.TXT) and then 
look out for the termination characters (; <CR>) before you call write() 
again. You will probably want to implement a time out using 
reactor.callLater()  together with a state machine.


Eugene Coetzee

Reedflute Software Solutions

Telephone           -> +27 18 293 3236
General information -> info at reedflute.com
Project information -> projects at reedflute.com
Web                 -> www.reedflute.com

More information about the Twisted-Python mailing list