views:

1036

answers:

2

Similar to this question. I have been tasked to develop an application using Java to send message strings from my WinXP PC to a nearby mobile phone, using only Bluetooth.

I have found a free Java Bluetooth library (Bluecove) to work with, but it seems that it might not support OBEX under Windows, which as I read is necessary to perform this task.

Has anyone proven this using Java? What stack and Bluetooth library did you use?

Thanks. :)

A: 

Sun doesn't seem to think OBEX is necessary if you are only sending Strings. From the developer site (http://developers.sun.com/mobility/apis/articles/bluetoothintro/index.html):

JABWT also includes the Object Exchange APIs. OBEX is a high-level API and protocol for exchanging objects such as electronic business cards and calendar items transmitted in the vCard and vCalendar formats. On Bluetooth, object exchange occurs over RFCOMM.

If you are only sending Strings, you might want to go one level down and look into the RFCOMM protocol. Wikipedia has this to say about it:

RFComm. is sometimes called serial port emulation. The Bluetooth serial port profile is based on this protocol.

RFComm. provides a simple reliable data stream to the user, similar to TCP. It is used directly by many telephony related profiles as a carrier for AT commands, as well as being a transport layer for OBEX over Bluetooth.

So it sounds like sending data over RFCOMM is a lot like using a TCP stream. Unless you need to support more complicated structures than Strings, I think it should suit your needs.

Further reading tells me that a level below RFCOMM is L2CAP:

L2CAP and RFCOMM support through the L2CAPConnection and StreamConnection types respectively. While L2CAPConnection was introduced with JSR 82, StreamConnection was defined as part of the original javax.microedition.io GCF that was developed to rely on CLDC. Note that JABWT L2CAPConnection supports only connection-oriented L2CAP connections.

StreamConnection sounds promising for sending strings as well. I'd check out the APIs for both and see which one sounds most like what you want to do.

danben
I am aware of the lower RFCOMM and L2CAP layers. But those are not enough for my purposes as I need the phone to recognize my message and display it to the user without the need to have another application made by me to be running as a client. My understanding is that the RFCOMM is simply a transport and not a full Push-Pull (client/server) automagic setup. Like the OBEX is supposed to be.
Sebastian Dwornik
A: 

I found this on the Bluecove site that demonstrates sending a string message to a mobile phone over Bluetooth.

Sebastian Dwornik