python - OBD-Python 无法获取 VIN 号
问题描述
我正在使用 OBD-Python 库,当我尝试从我的车辆中获取 VIN 号时,即使遵循自定义命令文档,我也会收到以下消息:
[obd.obd] 'b'0902':不支持 VIN NUMBER 日期:2018-07-09 14:48:30.428588 -- VIN NUMBER:无。
def vin(messages):
""" decoder for RPM messages """
d = messages[0].data # only operate on a single message
d = d[2:] # chop off mode and PID bytes
v = bytes_to_int(d) / 4.0 # helper function for converting byte arrays to ints
return v * Unit.VIN # construct a Pint Quantity
c = OBDCommand("VIN", # name
"VIN NUMBER", # description
b"0902", # command
17, # number of return bytes to expect
vin, # decoding function
ECU.ENGINE, # (optional) ECU filter
True) # (optional) allow a "01" to be added for speed
o = obd.OBD()
o.supported_commands.add(c)
o.query(c)
print('Data: ' + str(datetime.datetime.now()) + ' -- VIN NUMBER: '+str(connection.query(c)))
我做错了什么?
解决方案
你没有做错什么。SAE J1979 定义的几乎所有命令都是可选的——供应商可以选择是否实现它们。就您的车辆而言,供应商似乎决定反对它。
推荐阅读
- mobile - Nuxtjs:将本地主机暴露给外部不起作用
- excel - Excel 公式:如果时间大于 23:30,则返回同一日期的 11:30
- android - 有什么方法可以从应用程序获取 Android Management API 设备 ID
- html - 如何在 snappy pdf 中分页后获取第二页中的哪些内容?
- javascript - 单击按钮1时如何隐藏div2并显示div1角度
- jquery - 如何在 javascript 类中使用 JQuery $(this)
- node.js - 从 Linux 安装时,npm 是否创建了 bin/*.cmd 文件?
- html - Bootstrap 导航栏下拉菜单是否与 github 中的 html 预览兼容?
- jquery - 如何停止使用 jquery 播放音频?
- c# - 我需要参考哪些包来创建我自己的 NUnit 控制台运行器?