javabluetoothjsr82

BluetoothStateException and JSR-82


i was just starting to get into the JSR-82 library as I need to implement some bluetooth functionality between a smartphone and a RaspberryPi when this code

try {
        LocalDevice local = LocalDevice.getLocalDevice();

        System.out.println(local.getBluetoothAddress());

        System.out.println(local.getFriendlyName());
        }
        catch (BluetoothStateException e){
            System.out.println(e.getMessage());
        } 

gives me the following Message: "This is not JSR-82 implementation". The error message is coming from the catch block. Has anyone encountered this problem before? I can't find anything on the internet.

I am using a MacOS Sierra 10.12.4 and Eclipse Oxygen latest version. I downloaded the JSR-82.jar from this side: http://mvnrepository.com/artifact/org.microemu/microemu-jsr-82

Any help is much appreciated, thanks guys


Solution

  • Thanks to James Jithin I found this link here which really helped me: https://coderanch.com/mobile/t/228055/Bluetooth-API-JSR

    As it says here, JSR-82 is not an implementation itself but a specification. Therefore you have to find a implementation of JSR-82. One of these is BlueCove which can be found here: http://www.bluecove.org

    If you explicitly want something to work on your Raspberry Pi I wouldn't recommend BlueCove, as it is not designed to work on ARM-Processors. I would suggest to use Python.