このアプリでは、Bluetooth デバイスと Android フォンをプログラムでペアリングする必要があります。これは、Nexus S を除く、テストしたすべての携帯電話で問題なく動作しています。
従来の (PIN コード) ペアリングから新しいセキュア シンプル ペアリング (SSP) 方式に切り替えるまで、この電話で動作していました。
ペアリングが失敗したときに取得するログは次のとおりです。
10-31 15:16:47.933: D/ShockboxBluetooth(9676): Created socket
10-31 15:16:47.953: E/BluetoothEventLoop.cpp(110): event_filter: Received signal org.bluez.Adapter:DeviceCreated from /org/bluez/254/hci0
10-31 15:16:47.953: E/BluetoothEventLoop.cpp(110): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/254/hci0
10-31 15:16:49.187: E/BluetoothEventLoop.cpp(110): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/254/hci0/dev_00_07_80_4D_B9_00
10-31 15:16:49.566: E/BluetoothEventLoop.cpp(110): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/254/hci0/dev_00_07_80_4D_B9_00
10-31 15:16:49.593: D/BluetoothService(110): updateDeviceServiceChannelCache(00:07:80:4D:B9:00)
10-31 15:16:49.609: D/BluetoothService(110): uuid(application): 00001101-0000-1000-8000-00805f9b34fb 1
10-31 15:16:49.609: D/BluetoothService(110): Making callback for 00001101-0000-1000-8000-00805f9b34fb with result 1
10-31 15:16:49.617: I/BluetoothEventLoop.cpp(110): agent_event_filter: Received method org.bluez.Agent:OutOfBandAvailable
10-31 15:16:54.156: E/BluetoothEventLoop.cpp(110): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/254/hci0/dev_00_07_80_4D_B9_00
10-31 15:16:54.156: D/BluetoothService(110): 00:07:80:4D:B9:00 bond state 10 -> 12 (0)
10-31 15:16:54.421: I/BluetoothEventLoop.cpp(110): agent_event_filter: Received method org.bluez.Agent:OutOfBandAvailable
10-31 15:16:54.988: E/ShockboxBluetooth(9676): Could not connect to Device
10-31 15:16:54.988: E/ShockboxBluetooth(9676): java.io.IOException: Connection refused
10-31 15:16:54.988: E/ShockboxBluetooth(9676): at android.bluetooth.BluetoothSocket.connectNative(Native Method)
10-31 15:16:54.988: E/ShockboxBluetooth(9676): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:204)
10-31 15:16:54.988: E/ShockboxBluetooth(9676): at com.Impakt.Shockbox.ShockboxBluetooth$ConnectThread.run(ShockboxBluetooth.java:416)
10-31 15:16:54.992: D/ShockboxBluetooth(9676): Closed socket
読む量が多いので絞っていきます(と思います)。これはラインと関係があると思います
10-31 15:16:49.617: I/BluetoothEventLoop.cpp(110): agent_event_filter: Received method org.bluez.Agent:OutOfBandAvailable
問題は nexus S の NFC にあると考えています。NFC を使用してペアリングしたいのかもしれません。
(リフレクションを使用して) ペアリングに成功しましたcreateInsecureRfcommSocket
が、(明らかに) で作成されたソケットでデバイスからデータを受信できず、API レベル 10 が必要なためlistenUsingRfcommWithServiceRecord
使用したくありません。 listenUsingInsecureRfcommWithServiceRecord
2.2/2.3.2 の電話を使用している多数の顧客を排除することになります。
どんな助けでも大歓迎です。ありがとう!