This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Establishing RFCOMM Connection

Hi,

I am trying to establish a Bluetooth connection from an Android Smartphone (client) to F5438 + PAN1323 development board (Serv.er). I am using the sample application provided by the EtherMind SDK "simple". As I have been analyzing and lightly modifying the code and I have come across a couple of questions.

1.) As I am aware the appl_spp_start() function sets up the SPP profile and the RFCOMM service 0x0003. Is this enough to establish a connection and open an RFCOMM from an Android Smartphone?

2.) I am having a very hard time debugging this code because I do not know where sdk_display() is sending data to, and how to look at it.

3.) In android, I can find the device and pair with it, but once I try to open an RFCOMM socket, the program crashes

tmp = mmDevice.createRfcommSocketToServiceRecord( UUID.fromString("00001101-0000-100­0-8000-00805F9B34FB" ) );

I don't understand what the RFCOMM UUID is supposed to be. Any help will be greatly appreciated.

Thanks in advance,

-Adrian

  • Hello again,

    The source of the connection refuse was on the Android SDK which was giving an Service Discovery Request IOException following a connection attempt. The following is an alternative way of obtaining the BluetoothSocket object.

                /* This is a workaround method to establish connection */
                BluetoothDevice hxm = mBluetoothAdapter.getRemoteDevice(device.getAddress());
                Method m;
                m = hxm.getClass().getMethod("createRfcommSocket", new Class[]{int.class});
                tmp = (BluetoothSocket)m.invoke(hxm, Integer.valueOf(1));

    More information on this can be found here http://stackoverflow.com/questions/4444235/problems-connecting-with-bluetooth-android

    Thanks,

    -Adrian