Do Twisted and PyBluez work together?

I want to use twisted and bluetooth together. At the moment, I am doing this with PyBluez running in a twisted stream.

PyBluez just creates some kind of socket (or socket-like? Does it have a file descriptor object like a regular socket), basically you:

sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) sock.connect((device_id,1)) 

Can I somehow insert this socket into a twisted reactor and associate it with the protocol?

+4
source share
3 answers

You can write a class that implements IReadDescriptor (or IWriteDescriptor), and connect it to the reactor, for example, in this example .

+4
source

I found this project that combines pybluez with twisted: http://pydoc.net/airi/0.1.1/airi.twisted_bluetooth

+1
source

This part of the code really helped me a lot. Now I have a working implementation in Twisted.

0
source

All Articles