简体   繁体   中英

Incomplete responses being received from BLE device flutter

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!!

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, eg by reading https://www.elmelectronics.com/wp-content/uploads/2016/07/ELM327DS.pdf .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM