The following attached code files are Python scripts written to use the python bluetooth module
PyBluez from MIT:
http://code.google.com/p/pybluez/
Keywords: threaded, python, bluetooth, pybluez, linux, client, server
The master starts the server application which begins listening for connections. The clients are started up searching for the appropriate service that the master advertises. Once the service is found, a connection is attempted, if successful the client can begin sending messages to the server. All received messages at the server are taken and broadcast out to all connected clients. Messages are not sent back to the requesting client. Each client is capable of sending and receiving messages to the server.
Notes:
- The example code presented here was an exercise in using Python, Bluetooth, and synchronized threading by modifying the pre-existing RFCOMM server/client scripts from: http://org.csail.mit.edu/pybluez/
- The original RFCOMM server was a single threaded server capable of a single client connection, the modified code now accepts multiple client connections via threading, additionally the server broadcasts messages to other clients connected to the server.
- The original RFCOMM client was single threaded and transmitted messages to the RFCOMM server, now it can send and receive messages from the server.
Updates:
* The newest client/server python scripts attached have been made thread safe, and will now transmit time stamps back and forth with each other automatically, not requiring user intervention.
--
AndrewBlaich - 22 May 2008