Incomplete responses being received from BLE device flutter

Issue

I am not able to received complete responses from my BLE device which I am supposed to receive for the commands written to characteristics using flutter_blue. What I am receiving in response is the command itself which I sent for write. The responses received are being decoded properly.

The commands which I’m trying to write are OBDII protocols which are

AT Z
AT H0
AT H0
AT L0
AT S0
01 0C

Surprisingly the command "AT Z" gives response "ELM 327v1.5" which is correct. This is the only command from which I am receiving the correct response. All other commands are returning the command itself which is partially correct because most of the times the actual responses are received along with the command name.

The response reading and decoding is implemented in the following way

await read_CX.setNotifyValue(true);

read_CX.value.listen((response) {
  print(utf8.decode(response));
}

Has anyone faced similar issue of receiving incomplete data? Can anyone please help me out?

Thanks!!

Solution

First, add ATE0\r to your init sequence, this will stop the adapter from echoing back what you send.

Then, familiarize yourself with the AT commands provided by the ELM327, e.g. by reading https://www.elmelectronics.com/wp-content/uploads/2016/07/ELM327DS.pdf.

Answered By – DrMickeyLauer

Answer Checked By – Mildred Charles (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.