我正在尝试编写一个与ELM327(BT)通信的简单应用程序(类似于BluetoothChat示例)。
Torque(众所周知的Android OBD应用程序)能够连接OK - 它是唯一的一个。我的测试应用程序,SENA BTerm和android-obd-reader(着名的开源OBD应用程序)都无法连接。
我正在使用着名的服务UUID 00001101-0000-1000-8000-00805f9b34fb
当日志显示ACL_CONNECTED事件时,我的代码(和android-obd-reader)抛出一个IOException,说“套接字关闭或超时”。
这些是我在调用connect后运行测试的日志。
01-10 11:44:44.094: D/DRD(7313): About to connect
01-10 11:44:44.094: W/BluetoothAdapter(7313): getBluetoothService() called with no BluetoothManagerCallback
01-10 11:44:44.094: D/BTIF_SOCK(1311): service_uuid: 00001101-0000-1000-8000-00805f9b34fb
01-10 11:44:44.104: D/BluetoothSocket(7313): connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[62]}
01-10 11:44:44.114: E/MP-Decision(1374): UP Ld:34 Nw:1.990000 Tw:140 rq:3.500000 seq:147.000000
01-10 11:44:44.945: E/MP-Decision(1374): DOWN Ld:10 Ns:1.100000 Ts:190 rq:0.000000 seq:217.000000
01-10 11:44:45.856: W/bt-btif(1311): info:x0
01-10 11:44:45.856: D/(1311): remote version info [00:19:5d:26:d7:51]: 3, 7b, 229
01-10 11:44:45.866: D/btif_config_util(1311): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
01-10 11:44:45.896: I/BluetoothConnectionReceiver(7920): onReceive(context, Intent { act=android.bluetooth.device.action.ACL_CONNECTED flg=0x8000010 cmp=com.google.android.googlequicksearchbox/com.google.android.search.core.service.BluetoothConnectionReceiver (has extras) }, 00:19:5D:26:D7:51)
01-10 11:44:45.966: W/bt-sdp(1311): process_service_search_attr_rsp
01-10 11:44:45.976: E/bt-btif(1311): DISCOVERY_COMP_EVT slot id:90, failed to find channle, status:1, scn:0
01-10 11:44:45.976: W/bt-btif(1311): invalid rfc slot id: 90
01-10 11:44:45.976: D/DRD(7313): connectDevice():java.io.IOException: read failed, socket might closed or timeout, read ret: -1
有任何解释吗?我会把它归结为一个坏的适配器,除了Torque工作