Bluetooth

Tor Erik Sønvisen tores at stud.cs.uit.no
Fri Sep 23 21:26:43 EDT 2005


Okei....

I've been doing some research since my first post and now I'm really 
confused. I'm programming in xp, and found some c++ code out of this world 
that supposidly should list all available services to a given bluetooth 
device. This code however where only working with certain bluetooth-devices 
supported by the Microsoft Bluetooth Stack. If someone out there has any 
advice/ experience on bluetooth-programming on laptops (preferably in 
windows) I would appreciate it. Maybe there is some easy-to-grasp tutorials 
out there using the windows API for bluetooth-programing???

regards tores

"Paul Boddie" <paul at boddie.org.uk> wrote in message 
news:1127512737.067466.299070 at g49g2000cwa.googlegroups.com...
Tor Erik Sønvisen wrote:
> I'm making a server-side solution in Python and need to be able to
> communicate through bluetooth. Is there any bluetooth-packages out there 
> for
> python?

At the lowest level, you should be able to create sockets for Bluetooth
communications (see the socket module's documentation and the source
code in Modules/socketmodule.c); for example:

from socket import *
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)

On Linux, upon binding a device file to the Bluetooth device, you can
use things like pySerial to manage the communications; this works with
software like t616hack:

http://www.nelson.monkey.org/~nelson/weblog/tech/phone/
http://pyserial.sourceforge.net/

Various other tools exist which understand Bluetooth communications,
notably the OpenOBEX tools:

http://triq.net/obex/

I prefer to work with tools at the higher levels (obexftp to access
files, pySerial/t616hack to access messages), but provided your Python
distribution is set up correctly, you should be able to work at the
lowest levels too.

Paul





More information about the Python-list mailing list