BluetoothStateException 和 JSR-82

BluetoothStateException and JSR-82

我刚开始接触 JSR-82 库,因为我需要在智能手机和 RaspberryPi 之间实现一些蓝牙功能,而这段代码

try {
        LocalDevice local = LocalDevice.getLocalDevice();

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

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

给我以下消息:"This is not JSR-82 implementation"。错误消息来自 catch 块。有没有人遇到过这个问题?我在互联网上找不到任何东西。

我使用的是 MacOS Sierra 10.12.4 和 Eclipse Oxygen 最新版本。我从这边下载了 JSR-82.jar:http://mvnrepository.com/artifact/org.microemu/microemu-jsr-82

非常感谢任何帮助,谢谢大家

感谢 James Jithin,我在这里找到了 link 这对我很有帮助:https://coderanch.com/mobile/t/228055/Bluetooth-API-JSR

正如此处所述,JSR-82 本身不是一种实现,而是一种规范。 因此,您必须找到 JSR-82 的实现。其中之一是 BlueCove,可在此处找到:http://www.bluecove.org

如果您明确希望某些东西在您的 Raspberry Pi 上运行,我不会推荐 BlueCove,因为它不是为在 ARM 处理器上运行而设计的。我建议使用 Python.