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.

Multiple Bluetooth devices and Java

Other Parts Discussed in Thread: CC2540, CC2541

I am  working on the "JavaSimplePeripheral" code from TI and trying to understand how does it work.
The thing is that TI's Java Program detects the USB Bluetooth Dongle (cc2540)  just fine and it also detects a Bluetooth device with the address 60:03:08:D7:C3:A0.
I do not know where is this device. It might be my neighbor's cell phone  or may its the my Laptop internal Bluetooth. But I do not know for sure.
It tries to connect with the device 60:03:08:D7:C3:A0. But since, the device does not reply back so nothing happens. But the Java program keeps itself running.
This shows that the USB dongle (CC2540) is talking to the Java program. The Java program is initializing, discovering and establishing the link. The program also shows the Bluetooth address  60:03:08:D7:C3:A0 in the Java console window.
I using CC2541 based TiWi-ub1 module from a company called LSR. The Bluetooth address of this device is A4:98:5D:7E:44:07.
When I turned ON this device and run the Java Program.  The Java Program shows the following
"Error connecting to the device
Remove and insert again the USB dongle from the USB slot, restart the
application and try again."
The Java Program does not even reached to the point where it shows Bluetooth address of the device just like it shows when it detects only one Bluetooth device.
I think that the Java program does not know how to handle multiple Bluetooth devices. It does not know which one to connect.  I tested the same thing with BTool and everything works fine. The CC2541 based TiWi module worked fine. But the BTool allows user to choose the bluetooth address of the device that user wants to choose but the Java code does not allow to do that. 
I am attaching Java code with this message. Please let me know how I should I solve this problem. I would appreciate the feedback if some one already has solved this problem. 
Thanks
jess
  • Hi Jess,

    The JavaSimplePeripheral is a demonstration tool, hence not all aspects of the BLE protocol are being exposed at the Java application level. You could use this code as a reference and build in functionality to identify a device based on its BD ADDR, Advertising or Scan Response data, for example, and expose that info to the Java app. Perhaps someone has done this and can share it with the forum.

    Best wishes