Page 1 of 1

Android receive commands via bluetooth with inputStream.

Posted: Fri Feb 27, 2015 10:40 pm
by jkozlowski
Hi

As mentioned in the topic there is a question how to properly receive content from obd adapter after connection. How should it look like with java ? I assume that

Code: Select all

UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");


is good UUID for connection and we read input stream from BluetoothDevice like:


Code: Select all

 Method m = device.getClass().getMethod("createRfcommSocket", int.class);
            // socket = (BluetoothSocket) m.invoke(device, 1);
            socket = device.createInsecureRfcommSocketToServiceRecord(mUUID);


in simplest version. When we want now to read from input stream

Code: Select all

this.inputStream = socket.getInputStream();


it stuck on

Code: Select all

inputStream.read(...)


Now when I want to

Regards