DarthAffe / OBD.NET

C#-Library to read data from car through an ELM327-/STN1170-Adapter
GNU General Public License v2.0
178 stars 82 forks source link

Reading MIL Status & DTCs #5

Closed rGunti closed 6 years ago

rGunti commented 6 years ago

Really liking this library and wanted to created a project with it. But it is missing a very crucial feature: reading Diagnostic Trouble Codes. Do you have any plans on implementing them in the near future?

DarthAffe commented 6 years ago

Hi, yes since I need this for my own project too, it is on the list of things to do. I haven't worked much on this lately, but I think it's quite easy to add trouble codes - I'll look into this over the week.

rGunti commented 6 years ago

Okay very nice. I will look into this as well and I might be able to supply something myself.

DarthAffe commented 6 years ago

Hey, just wanted to give you a update on this. Adding trouble codes will take a little longer - I'm running into a few problems here: Trouble codes are returned as multiple frames which OBD.NET doesn't support by design right now. This needs quite some work on the way data is received first. I then thought I could at least read the codes from the first frame, but I don't really understand how they are encoded only by the specification. I would need to run a few tests in the car to see some of the results which isn't possible currently - I'm working on my car-pc hardware so it's not in the car.

DarthAffe commented 6 years ago

Hey, I just pushed something to the DTC-branch (https://github.com/DarthAffe/OBD.NET/commit/59e8580e8dedc8f9b6851c8be997a6d7c18700c3). With this you should be able to request DTCs by calling RequestDTCs or RequestDTCsAsync. I'm pretty sure that it won't return more than 3 codes even if there are more returned by the car, since multiframe-support is still not implemented. You can also get the MIL-status and the real trouble-code count by requesting MonitorStatusSinceDTCsClreared (PID 0x01) through the normal RequestData method.