如何申请OBD参数,并接收 [英] how to request OBD parameters and receive them

查看:313
本文介绍了如何申请OBD参数,并接收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid,我想开发一个蓝牙的应用程序从一个OBDII设备检索参数。我已经下载了样品蓝牙聊天应用程序和配置它。现在的问题是如何和什么是我需要发送到OBDII设备,以便接收参数的信息?和我应该怎么在应用端处理?

I'm new to android and I thought to develop a bluetooth app to retrieve parameters from an OBDII device. I have downloaded the sample bluetooth chat application and configured it. The problem is how and what is the message that I need to send to the OBDII device in order to receive the parameters? and how should I handle them in the application side?

感谢你。

推荐答案

你的问题不是很具体,但我会给你一些指导。

You're question is not very specific, but I will give you some guidelines.

首先,测试与你的车实际工作的已有的OBD-II阅读器应用程序。

First of all, test with an exisiting OBD-II reader application if your car actually works.

该ELM327蓝牙连接器,你有(我假定这是一个ELM327)转换ASCII命令电压。因此,所有你需要做的,就是发送一些ASCII命令,你会得到ASCII值回。

The ELM327-bluetooth-connector you have (I assumed it's a ELM327) translates ASCII commands to voltages. So all you have to do, is send some ASCII commands, and you get ASCII-values back.

该OBD协议懂几种模式和参数的,但我会解释获得的实时数据。这就是模式1。

The OBD protocol knows several modes and parameter's, but I will explain to get real-time data. That's mode 1.

模式1发送
这是有点简单,因为它是。 模式1是01。 这部分之后,你必须发送一个参数ID吧。 0C是RPM,0D是速度。 (。看看下面的链接)。 并在每个命令后,你必须发送一个回车。 (CR ='\ r')

Mode 1 Sending
This is kinda simple as it is. Mode 1 is '01'. After that part, you have to send a parameter ID with it. 0C is for RPM, 0D is for speed. (Look into the link below). And after each command you have to send a Carriage Return. (CR = '\r')

因此​​,基本上,速度,你必须发送:

So basically, for speed, you have to send:

'010D\r'

接收模式1
你将获得从模式1查询答案,以'41'。 在此之后,参数ID返回,然后将该值。 的值是大部分时间中十六进制。你将不得不做一些转换读取人类可读的值。欲了解更多信息,请参阅链接,公式的设置也进行转换。

Receiving Mode 1
The answer you will get back from a Mode 1 query, starts with '41'. After that the parameter ID is returned, and then the value. The value is most of the time in hex. You will have to do some conversion to read a human readable value. For more information, see the link, as formula's to convert are provided too.

例如:

'410D17'

所以17是您当前的速度在十六进制的值。 17十进制就是23,所以你开车以23公里/时。

So 17 is the value of your current speed in hex. 17 to decimal is 23, so you're driving with 23 km/h.

这维基百科页面有关于它的一些好的信息:
OBD-II参数

This wikipedia page has some good information about it:
OBD-II Parameters

这篇关于如何申请OBD参数,并接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆