Announcement

Collapse
No announcement yet.

.NET OBD2 Library

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • .NET OBD2 Library

    Well, not sure if there is any interest in this... but as many people know I have one of the more comprehensive open source C++ obd2 libraries around. The issue is, this library depends on Qt, which is quite a heavy dependency if you are not using Qt to write your application. I came across a situation where I needed to use OBD2 in c#, so I went ahead and wrote a wrapper for the core obd interface code that allows you to use it with c#. I've attached three files. The first is the actual c# library source + obdlib.dll binary (This is the c++ communications part). The second is the test application project file, and the third is a compiled version of the test and the library for anyone to try out. To use it, you put in the COM port, baud rate, and hit connect. Then type a PID into the pid text box like 010C, or 0110. Then hit "Add pid", and it should start to update.

    I'm working on adding a lot more stuff like connection information, tool version, etc, but this gives you an idea what's usable. If there is any interest I'll throw it up on gitorious and keep it updated. The eventual goal is to have it near identical to the Qt version which uses the same underlying communications library.

    Edit 4/23/12: Fixed a bug that heezer7 helped me track down. Thanks!!

    Edit 4/26/12: Fixed bug Sonic reported, com ports above 9 and text ports (CNCA etc) not working. Download obdlib.zip and replace obdlib.dll to fix.
    Attached Files
    Last edited by malcom2073; 04-26-2012, 09:29 AM.
    "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
    RevFE
    My Shop

  • #2


    Something I have put off writing for way too long. What license is it released under? Do you happen to have it on github or somewhere where I could watch for any updates?

    and THANKS!


    Edit: lmao@Here there be monsters
    Last edited by heezer7; 04-13-2012, 01:42 PM.
    openMobile - Download
    Like what you see? Donations are always welcome

    Comment


    • #3
      Lookie there I forgot the license. It'll be LGPLv2, just like the underlying libobd is

      Oh, and yes it's on gitorious, inside libobd https://gitorious.org/libobd
      https://gitorious.org/libobd/libobd/...r/ObdThread.cs


      Edit:
      Originally posted by heezer7 View Post
      Edit: lmao@Here there be monsters
      I wrote that code over 5 years ago (Closer to 10), and it scares me because I no longer have any idea how it works, but it works GREAT!
      Last edited by malcom2073; 04-13-2012, 01:53 PM.
      "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
      RevFE
      My Shop

      Comment


      • #4
        This is where no matter how hard I try to completely understand OSS licenses and plugin structures and such I am still lost at times. OM is GPLv3 which cannot directly use v2. But can I write a GPLv2 plugin so I can use a LGPLv2 lib and not conflict with OM? ugh. Seems like I can never get a consistent answer especially when the plugin is using helper functions in the GPLv3 application it is a plugin for.
        openMobile - Download
        Like what you see? Donations are always welcome

        Comment


        • #5
          Correct. as far as I understand it you can do anything with LGPLv2 licensed code that you can with GPLv2. In addition: You can use LGPL code in a closed source app, as long as it's a .dll (not statically linked), and not modified. If modified, you have to release the modifications, not the closed source stuff.

          Now, that being said, you can also use lgplv2 licensed code in a gplv3 licensed application, since lgplv2+ gives you the option to relicense the library as gplv2+ (also known as, gplv3). And this is lgplv2+ (The + means "or any later version")
          "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
          RevFE
          My Shop

          Comment


          • #6
            oh ok, I assumed since you said v2 that you meant straight v2 and not v2+ (since it seems like some people do want to stay with v2). Means I don't have to figure it out for a bit longer. haha
            openMobile - Download
            Like what you see? Donations are always welcome

            Comment


            • #7
              Sorry, my bad. Yeah 2+,
              "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
              RevFE
              My Shop

              Comment


              • #8
                Need to clear your PMs ;-)

                I have a basic plugin for OM up and going with your OBD2 code. Thanks again! However I am having a bit of a problem. I am not getting any data back from your test app. I can connect and once I request a PID I see the lights start going like crazy but all the values always stay at 0. I tried on 2 different cars, but could never make it into the if with the second break point here http://i91.photobucket.com/albums/k299/heezer7/obd.png

                With other software I could connect ok with the same port and baud. Any thoughts?
                openMobile - Download
                Like what you see? Donations are always welcome

                Comment


                • #9
                  Oops, I'll clear them in a bit

                  Hmm, it seems the response isn't coming back properly. "\v1 46" should be "41 46" Does it consistently return \v1 at the beginning of every reply?
                  "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
                  RevFE
                  My Shop

                  Comment


                  • #10
                    I can't say every time but I did see it a few times at least. Back inside now but I can go check again later and have it dump a bunch of replies if that is something that would interest you.
                    openMobile - Download
                    Like what you see? Donations are always welcome

                    Comment


                    • #11
                      Yeah if you wouldn't mind dumping a bunch of replies. If that part is wrong, it's an issue in the underlying library. I've used the library on quite a wide range of vehicles and scantools, which would make this a good bug to fix
                      "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
                      RevFE
                      My Shop

                      Comment


                      • #12
                        Big thanks to heezer7, I got the bug figured out. New version posted above, in theory should work fine on all vehicles now
                        "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
                        RevFE
                        My Shop

                        Comment


                        • #13
                          any reason why the binary wouldnt work with obdsim? I put in the proper com port and hit connect but any PIDs i add have a value of 0, and obdsim doesnt report any queries
                          mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
                          Follow Me on Twitter or Facebook
                          Live mp3Car Facebook Chat

                          Comment


                          • #14
                            Are you talking about Chunky_Ks's obdsim? That's what I use to test most of the time.

                            Don't use CNCA, use COM4 or COM5, a com number below 9. I don't believe I have it provisioned for using text com ports.
                            "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
                            RevFE
                            My Shop

                            Comment


                            • #15
                              Originally posted by malcom2073 View Post
                              Are you talking about Chunky_Ks's obdsim? That's what I use to test most of the time.

                              Don't use CNCA, use COM4 or COM5, a com number below 9. I don't believe I have it provisioned for using text com ports.
                              ok that was the problem i was using com13. Thanks!
                              mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
                              Follow Me on Twitter or Facebook
                              Live mp3Car Facebook Chat

                              Comment

                              Working...
                              X