I can't 开发者_JAVA技巧connect to OBDKey sometimes . I use BluetoothChat example to connect to OBDKey. I can connect to it and read data, but sometimes socket is closed.
m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
mmSocket = (BluetoothSocket) m.invoke(mmDevice, 1);
mmSocket.connect();
Before this OBDKey is paired succesfully. Why does socket close sometimes?
Make sure you have a valid BluetoothSocket
before calling connect()
.
Let me know directly if you need specific help with the OBDKey interface.
精彩评论