ANDROID ELM327/OBD2 PROTOCOL

女生的网名这么多〃 提交于 2019-12-03 03:21:38

问题


I am trying to send command from ANDROID to ELM327/OBD2 protocol (WIFI Diagnostic troubles). I downloaded an api or library from: https://github.com/pires/android-obd-reader The problem that this api not have any documentation. We need help about the command and protocol to exchange data. Thanks!


回答1:


What do you really want to know?

With the ELM327 the protocol is fairly easy. You just send a PID in ASCII, and you will receive an answer in ASCII. It's based on polling. So you will receive 1 answer for 1 request. As long as you don't send, you don't receive.

For converting and what commands to send, check the links I provided.

Some more links:

AT Commands
OBD-II Commands




回答2:


If you want to use this library, you should download the source code. The source code is self-explanatory. There is also the source code of an example application. I tried to run the example application, but it didn't work for me. However, I took a look on the source code and it helped me for my application.

In this library you will find the main queries already implemented and easy to use. I only found an error on the ObdResetCommand class. This class implements the super class ObdCommand and it overrides the readResult method in this way:

@Override
public void readResult(InputStream in) throws IOException {
    // do nothing
    return;
}

To make it work, you should remove this overriding method in order to use the super class one. If you don't do that, the response is not read and it will be read in the following command, so that, every response would be delayed one query.

I hope it helps.



来源:https://stackoverflow.com/questions/15117475/android-elm327-obd2-protocol

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!