views:

130

answers:

1

Hi everyone,

I need to access the bluetooth network interface from Java. All local network interfaces can be reached via:

Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();

This enumeration will contain ethernet cards, usb networking devices etc and I need to retrieve the bluetooth network interface in particular. One bad solution is to iterate through the enumeration and parse the display name of each device for "bluetooth", but it's not certain that this will work for all bluetooth interfaces. Does anyone know a better way, perhaps by doing some kind of probing?

+1  A: 

I suppose the "cleanest way' would be to use a JSR 82 implementation library, which comes with the class LocalDevice.

LocalDevice.getLocalDevice()

A project like BlueCove might do the trick.

VonC