Implement command to read VIN number
jnsmith0274 opened this issue · 17 comments
How about a command to read the VIN number (mode 09)?
Why not? Will gladly review a PR.
@pires it seems that the response is always "7F0912" for my car , even when all other command return "NO DATA" for example when car not powered, is this a bug?
Probably.
@pires see #41
which requires #42 to work.
it was using just the first buffer chunk before which is always the same (the first line of the multiline response). took me quite a while to figure this out. When you connect to the device via some OBD terminal you may see that the response is having more lines.
Thank you @anti43! I probably screwed up when cherry-picking your commits before.
Will release RC3 in a moment.
Tests are failing so I can't release RC3.
Tests run: 42, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.154 sec <<< FAILURE!
testValidSpeedMetricWithMessage(com.github.pires.obd.commands.ExtraMessagesTest) Time elapsed: 0.011 sec <<< FAILURE!
com.github.pires.obd.exceptions.NonNumericResponseException: Error reading response: BUSINIT...410D40
at com.github.pires.obd.commands.ObdCommand.fillBuffer(ObdCommand.java:180)
at com.github.pires.obd.commands.ObdCommand.readResult(ObdCommand.java:163)
at com.github.pires.obd.commands.ExtraMessagesTest.testValidSpeedMetricWithMessage(ExtraMessagesTest.java:78)
@pires IMO the "BUS INIT" message should be entirely ignored (as with the "SEARCHING" message) or throw an according BusInitException. If this test is a valid scenario then the message BUS INIT has not been handled properly in the past. There shall only be two modes of handling
- remove message on reading the response
or - throw exception
This test implies that there is a "silently ignore" magic?
See cesarizu@2e58fec
where this is introduced. But if multiline commands are supported (VIN), this cannot be done anymore.
Ignoreable messages should be just removed from the output I think, however it has to be distinguished between
"BUS INIT" and "BUS INIT ERROR"
Probably a way:
https://github.com/pires/obd-java-api/pull/43/files
Maybe not the best option, just a quick guess.
@pires yes probably, as I wrote it was just a quick guess as grounds for discussion.
I did not try this, I just wanted to show you the problem. OK I agree, PR is not a good way to do this, sorry if this was not clear!
just checked the raw response is also 7F 09 12 \r\r
so nothing getting lost later
@pires ok I saw you used
which works for 01 commands. for the 09 commands, this should support 7F0912 as well. so probably a generic UnsupportedCommandException matching a regex for 7F0[0-9]12 should handle this well. I guess I will implement it next week after my vacation.
@nomwerp 7F means "not supported" basically.
thanks , so not a bug after all ;)