[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

bluetooth file transfer in python

chartsoft

2/12/2008 9:50:00 AM

I am a teacher and need to set up a computer with a bluetooth dongle
to poll for mobile phones with bluetooth switched on in the area then
send them a jpg file.

I understand that python is capeable of this.

1.) is it worth learning python to do this or can someone out there do
it for me for a v small fee?

2.) If I am going to do it can anyone give me pointers in the best way
to do it so I do not spend hours wasting time.

Many thanks

chartsoft
2 Answers

Dennis Lee Bieber

2/12/2008 10:23:00 AM

0

On Tue, 12 Feb 2008 01:50:28 -0800 (PST), chartsoft
<chartsoft@cwcom.net> declaimed the following in comp.lang.python:

> I am a teacher and need to set up a computer with a bluetooth dongle
> to poll for mobile phones with bluetooth switched on in the area then
> send them a jpg file.
>
> I understand that python is capeable of this.
>
Uhm... I'm not the one to lay down any laws but...

Bluetooth and WiFi are all matters of the underlying OS, as to how
they appear to application programs.

Python with base libraries doesn't, to my knowledge, have anything
relevant.

http://org.csail.mit.ed...
http://org.csail.mit.edu/mode/index.php/Bluetooth_...
http://snippets.dzone.com/post...

For the most part, once a device is identified, it is a matter of
fairly common network protocols -- file transfer is a version of FTP, I
believe -- finding devices AND BEING ABLE TO PAIR WITH THEM is the key.
Unless the device accepts an attempt to pair, you are out of luck -- so
if the idea is to send a warning graphic to, say, bluetooth phones that
"cheating" by sending data is not wanted, you may be out of luck; the
recipient device may not accept a connection attempt.

--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com wulfraed@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: web-asst@bestiaria.com)
HTTP://www.bestiaria.com/

Paul Boddie

2/13/2008 12:14:00 AM

0

On 12 Feb, 10:50, chartsoft <charts...@cwcom.net> wrote:
> I am a teacher and need to set up a computer with a bluetooth dongle
> to poll for mobile phones with bluetooth switched on in the area then
> send them a jpg file.

I guess you'd use OBEX to send the file, specifically using the "push"
mode of OBEX. Various tools such as hcitool and sdptool (found on GNU/
Linux distributions) and their counterparts exposed by Python
libraries such as PyBluez [1] would be appropriate for scanning for
devices.

> I understand that python is capeable of this.
>
> 1.) is it worth learning python to do this or can someone out there do
> it for me for a v small fee?
>
> 2.) If I am going to do it can anyone give me pointers in the best way
> to do it so I do not spend hours wasting time.

I've previously done OBEX-related things, mostly fetching things from
mobile phones, using the obexftp program [2] which is part of the
OpenOBEX project [3]. Naturally, you can call the obexftp program from
Python and interpret the responses and exit codes using functions in
the os, popen2 and subprocess modules. I believe that obexftp also
supports "push" mode, but you could probably find something else
related to OpenOBEX if it does not.

Since Bluetooth communications are supported using sockets in GNU/
Linux distributions and in Python (provided that the Bluetooth support
is detected and configured), you could communicate with phones using
plain network programming, but this would probably require you to
implement the OBEX protocols yourself - not a straightforward task for
a number of reasons, including one I mention below. Thus, it's
probably easier to go with obexftp at least initially.

There are a number of awkward things with obexftp and OpenOBEX,
however. Some phones do not follow the "standards" and the maintainer
of OpenOBEX wouldn't or just didn't include support for various
deviating Sony Ericsson phones, for example, thus requiring me to
patch the library myself. Although there may be a Python wrapper for
OpenOBEX, it's easier to just call obexftp as mentioned above, but
this means that you're limited to what that program can do.

Finally, and most significantly, OBEX isn't a totally free standard:
if you didn't already get the standards documents while they were
freely available, you now have to sign up with the quaintly named
Infrared Data Association [4] - a "pay to play" organisation with
restrictive redistribution terms on their specifications. Although I'd
recommend that anyone doing brand new stuff with mobile devices just
uses real standards instead of OBEX, I doubt that you have the choice.

Anyway, I hope that this helps you understand the subject area a bit
more.

Paul

P.S. It does also occur to me that desktop environments like KDE have
Bluetooth controls which could be automated in some way in order to
send files, but I haven't investigated this at all.

[1] http://org.csail.mit.ed...
[2] http://triq.net/ob...
[3] http://dev.zuckschwerdt.org...
[4] http://www...