How to make a testing bluetooth connection from a desktop PC to an android device

1.5k views Asked by At

I am using an Ubuntu 11.10 Desktop PC with a Bluetooth Dongle and an Android tablet using Android 2.2 with Bluetooth. (The Bluetooth on both devices should be of version 2.0 or 2.1)

I have checked that the Desktop PC and the Android tablet both use the Bluez Stack. I am able to pair the 2 devices and I could ping (using l2cap protocol) the Android tablet from my Desktop using the following command :

$ sudo l2ping 00:10:18:23:34:81
Ping: 00:10:18:23:34:81 from AE:2D:22:00:FF:00 (data size 44) ...
44 bytes from 00:10:18:23:34:81 id 0 time 26.93ms
44 bytes from 00:10:18:23:34:81 id 1 time 24.88ms
44 bytes from 00:10:18:23:34:81 id 2 time 33.92ms
44 bytes from 00:10:18:23:34:81 id 3 time 25.91ms

However, when I try to connect the Desktop to the Android tablet with rfcomm using the following command, there is an error :

$ sudo rfcomm connect hci0 00:10:18:23:34:81
Can't connect RFCOMM socket: Connection refused

I think that the Bluetooth on Desktop PC should support both l2cap and rfcomm and the Bluetooth on Android tablet should support at least l2cap.

I want to know that does the successful run of l2ping command indicates that there is valid communication between the Desktop PC and the Android tablet through Bluetooth ? How can I establish a connection (using whether l2cap or rfcomm) to test the Bluetooth communication between the 2 devices ?

1

There are 1 answers

0
Taras On

You are able to establish an RFCOMM connection between a desktop and an Android device. If your device acts as a server, you need to create UUID for your application, and then you'll be able to connect to it.