Bluetooth enabling JOP

This project describes how to Bluetooth enable JOP.

In the initial phase of the project SDIO Card was considered, but I found the RS-232 adapter to be more valuable, since it provides a quick time-to-market development, while no software is needed implemented on the host (for example JOP).

RS232 Adapter
The RS232 to Bluetooth Adapter is shown at the picture below. It connects to a device, like JOP through, the COM-port (RS232). The adapter is intelligent, and you control it by sending Hayes AT-like commands over the COM-port. The command set reference can be dowloaded at Blu2i also quick guides and firmware updates can be downloaded.

Example
To communicate with the adapter from a desktop Java app. you can use the javax.comm package.

Inquiry
To search for remote Bluetooth devices you send the command (out is an java.io.OutputStream):

out.write("AT+BTIN\r".getBytes);

The RS232 adapter will reply with the example data (BD_ADDR, class type, friendly name):

123456789012,123456,"friendly name"

123456789013,123456,"friendly name2"

OK

Connect
out.write("ATD123456789012,1101\r".getBytes);

Send data
out.write("ATX\"Hello World\"\r".getBytes);

To send non-visual chars you can use \hh where hh is the hex value. For example to send the byte value 1 use \01

Disconnect
out.write("ATH\r".getBytes); out.write("ATH\r".getBytes);

Open a channel
You do not need to open a channel (socket) for a remote device can connect and send data. This is a bit strange, due to security reasons. But you can set the adapter up not to accept incomming connections, or for you to accept incomming connection before establishment is done. Please see the S-register settings.

Receive data
When data is received by the RS232 adapter it sends a string to the host starting with RX

RX"Hello World"