ANDROID ELM327/OBD2 PROTOCOL

与世无争的帅哥 提交于 2019-12-02 17:20:47
Eric Smekens

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

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.

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