2017-08-21 23 views
0

我剛剛開始進入JSR-82庫,因爲我需要實現一個智能手機和樹莓派之間的一些藍牙功能時,該代碼BluetoothStateException和JSR-82

try { 
     LocalDevice local = LocalDevice.getLocalDevice(); 

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

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

給了我下面的消息: 「這不是JSR-82的實施」。錯誤消息來自catch塊。有沒有人遇到過這個問題?我在互聯網上找不到任何東西。

我正在使用MacOS Sierra 10.12.4和Eclipse Oxygen最新版本。我下載了JSR-82.jar從這個方面:http://mvnrepository.com/artifact/org.microemu/microemu-jsr-82

任何幫助非常感謝,謝謝你們

+1

好讀 - https://coderanch.com/mobile/t/228055/Bluetooth-API-JSR –

回答

0

感謝詹姆斯Jithin我發現這裏這個鏈接,真的幫了我:https://coderanch.com/mobile/t/228055/Bluetooth-API-JSR

因爲它在這裏說,JSR-82不是一個實現本身,而是一個規範。 因此你必須找到JSR-82的實現。其中之一是可以在這裏找到的BlueCove:http://www.bluecove.org

如果你明確地想要在Raspberry Pi上工作,我不會推薦BlueCove,因爲它不適用於ARM處理器。我會建議使用Python。