java 如何与OBD-II设备通信

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29095470/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 14:41:16  来源:igfitidea点击:

How to communicate with OBD-II device

javaandroidbluetoothstreamobd-ii

提问by Jacob

There is OBD-IIdevice like http://www.rczd.com/c/2015/Car_Diagnostic_Tools_0223/41193.htmlthis device provider does not have its web page or documentation source. We have short "quick start" in box and assurance that it support OBD-II PIDs.

OBD-IIhttp://www.rczd.com/c/2015/Car_Diagnostic_Tools_0223/41193.html这样的设备,这个设备供应商没有它的网页或文档来源。我们在框中有简短的“快速启动”并保证它支持OBD-II PIDs.

Recently I used to follow https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_41

最近我经常关注https://en.wikipedia.org/wiki/OBD-II_PIDs#Mode_1_PID_41

The question is, if there are any general pattern how to communicate with this icar device.

问题是,如果有任何通用模式如何与这个 icar 设备进行通信。

Before I've used to connect with (freematics)donglethat has send the stream of data which I've parsed on fly.

在我用来连接之前,(freematics)dongle它已经发送了我动态解析的数据流。

Current one send only one value after one request we send to it (it is synchronous and can't handle more than one request per time).

当前一个在我们发送一个请求后只发送一个值(它是同步的,每次不能处理多个请求)。

I would like to get up-to-date OBD-IIparams to display them(frequently).

我想获得最新的OBD-II参数来显示它们(经常)。

Any ideas ?

有任何想法吗 ?

回答by ?ukasz Dembiński

If your device is compatible with the ELM327 you can use multiple PID requests but only if adapter is connected to the vehicle with CAN protocol. So it would work only with a subset of vehicles because not all vehicles support CAN.

如果您的设备与 ELM327 兼容,您可以使用多个 PID 请求,但前提是适配器通过 CAN 协议连接到车辆。因此它仅适用于一部分车辆,因为并非所有车辆都支持 CAN。

Popular scan tools simply sends sequential requests. Maximum throughput you can gain with this approach is about 30-40 rps.

流行的扫描工具只是发送顺序请求。使用这种方法可以获得的最大吞吐量约为 30-40 rps。

I don't know how freematics dongle works but I can see it has some SD card mounted - maybe it gives only emulation of parallelism and internally every request is sent sequentially?

我不知道 freematics 加密狗是如何工作的,但我可以看到它安装了一些 SD 卡 - 也许它只提供并行性模拟,并且在内部每个请求都是按顺序发送的?

If you are searching for reliable Java library for connecting to OBD II device I would recommend you https://github.com/pires/obd-java-api. You can also take a look at my library - https://github.com/devesion/java-obd-adapter

如果您正在寻找可靠的 Java 库来连接 OBD II 设备,我会推荐您https://github.com/pires/obd-java-api。你也可以看看我的图书馆 - https://github.com/devesion/java-obd-adapter