OBDPython无法获取VIN编号

2024-05-16 01:27:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用库OBD Python,当我试图从我的车辆上获取一个VIN编号时,即使遵循自定义命令文档,我收到了以下消息:

[车载诊断]“b'0902”:不支持VIN编号 日期:2018-07-09 14:48:30.428588--VIN编号:无。

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)))

我做错什么了?在


Tags: tonumberforreturnbytesfunctionqueryoptional
1条回答
网友
1楼 · 发布于 2024-05-16 01:27:01

你没做错什么。几乎所有由SAE J1979定义的命令都是可选的—供应商可以选择是否执行这些命令。就你的车辆而言,看来是供应商决定不接受它。在

相关问题 更多 >