I am working on an android application which has to connect to OBD II ELM327 device via Bluetooth and has to get data(rpm, speed.. etc) from car.. Able to connect via bluetooth but Not sure how to write a code for communication ... Can anyone help me on this or if have code for this please share ?
Bluetooth devices send and receive data as byte arrays. Although Android offers plenty of support for connecting to bluetooth devices and sharing information using BluetoothGatt, you will ultimately have to provide your own algorithm to interpret the byte[] data sent by the device and to construct a byte[] response in a format that the device can understand.
Check to see if the manufacturer of your obdII device provides an existing library for encoding and decoding byte[] data that you can use to communicate with the device. If no library exists, at the very least you will need to figure out how the device interprets information and implement your own encoding and decoding algorithm.