Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java (J2SE) and Bluetooth

Tags:

java

bluetooth

I want to write some small program. It will run on my computer(laptop) with bluetooth adapter and then discover all the visible Bluetooth adapters (phones, printers, other computers, etc.), but I've not worked with bluetooth in Java before.

Help me to find starting point, please. What SDKs or libraries I must download first? What literature to read?

I've googled BlueCove, but it doesn't support my Samsung D600, so I could not test my app.

like image 793
Oleksandr Avatar asked Jul 24 '09 16:07

Oleksandr


3 Answers

This java sample will discover all visible devices, and it works with both the BlueCove and Avetana libraries ( http://www.avetana-gmbh.de/avetana-gmbh/produkte/jsr82.eng.xml ):

http://www.jsr82.com/jsr-82-sample-device-discovery/

like image 193
Brad Brown Avatar answered Nov 16 '22 22:11

Brad Brown


Ok, sorry for annoying. I've found an answer and it is BlueCove. After installing additional libs it works perfect on Linux Mint 7 now. Even, not listed in compatibility list Samsung D600 was discovered perfectly. Test program output:

run:
BlueCove version 2.1.0 on bluez
Address: 0006C990021D
Name: hostname-0
Starting device inquiry...
Device discovered: 0015B95BEA0F
INQUIRY_COMPLETED
Device Inquiry Completed. 
Bluetooth Devices: 
1. 0015B95BEA0F (zl0-b0tan)
BlueCove stack shutdown completed
BUILD SUCCESSFUL (total time: 13 seconds)
like image 25
Oleksandr Avatar answered Nov 16 '22 21:11

Oleksandr


Bluecove tends to be the best supported lib, however, you will find that the various underlying native bluetooth stacks on Windows vary dramatically in quality. The native Windows stack is only marginally supported by the Java APIs. BlueSoleil is slightly better, and Widcomm is generally the preferred.

However, neither BlueSoleil nor Widcomm are free if they didn't come with your adapter, though Widcomm can be hacked to work with non-officially supported adapters. The big limitation with it is that Bluecove does not support Widcomm on 64bit Windows.

Personally, I ended up just using Linux for Bluetooth development as it all just works there. :) I have not tried Avetana at all.

like image 1
jsight Avatar answered Nov 16 '22 23:11

jsight