Android receive commands via bluetooth with inputStream.

Inquiry and support for Freematics products
Post Reply
jkozlowski
Posts: 3
Joined: Wed Feb 25, 2015 10:22 pm

Android receive commands via bluetooth with inputStream.

Post 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
Post Reply