[Twisted-Python] Using SerialPort with t.a.s.Application
Ralph Meijer
twisted at ralphm.ik.nu
Fri Jan 28 03:00:43 MST 2011
On Fri, 2011-01-28 at 09:29 +0100, Albert Brandl wrote:
> Hi!
>
> In our project, we accumulate data from various sources. Some of them are
> connected via serial line (e.g. a GPS receiver and a weather station).
>
> I'd like to run the application with twistd. But it looks as if SerialPort
> does not really fit into this framework. It does not implement IService,
> so `my_serial_port.setServiceParent(collection)` does not work.
>
> Is there any technical reason that SerialPort does not implement
> IService? Could you suggest a workaround for this problem (other than
> dumping t.a.s.Application ;-))?
One way to do this, is using t.a.i.GenericClient to hook up the device
to the protocol. This is also a Service that can be hooked up to an
Application. Unfortunately, it uses the now deprecated connectWith
method on a reactor, and therefore GenericClient has been deprecated as
well.
exarkun suggested a new FileDescriptorClient that might use the
reactor's addReader and addWriter methods.
--
ralphm
More information about the Twisted-Python
mailing list