Announcement

Collapse
No announcement yet.

CygWin Simulator - Running Sim & Application together?

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

  • CygWin Simulator - Running Sim & Application together?

    Hi guys,

    I managed to get the OBDII Sim working on cygwin pretty easily thru following the instructions.

    My goal is to simulate the OBD using the supplied simulator, and make use of the simulator in the Windows environment - is this possible?

    When running the sim over COM1 I'm getting a "port is already open!" error (which kinda makes sense :P)

    Cheers,

    Paul

  • #2
    It sounds like you're trying to open COM1 with the sim, and then open COM1 with your application? That won't work in windows.

    Did you install com0com? The way that obdsim works is by opening one end of a virtual serial port [defaults to CNCA0, IIRC], and then you point your OBDII application at the other end.

    com0com is here: http://com0com.sourceforge.net/.
    I wrote some instructions on using obdsim on windows here: obdsim-on-windows.txt
    Which is just a shortened version of the real com0com README

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

    Comment


    • #3
      Yeah... did the classic of posting the query and only then looking in the /doc folder of the SVN checkout, d'oh.

      Anyway - the setup I've got working (on Win7 no less) is:

      1) Cygwin up and running the extra dev packages set out on your website;
      2) Latest version of OBDII GPS Logger built from SVN;
      3) Set up com0com with Com4 on one side, Com7 on the other;
      4) Booted up the simulator in default mode - serial port /dev/ttyS6 (I think... will confirm later);
      5) Booted up the win app on Com4;
      6) Enjoyed some simulator goodness.

      Sim works, very nice! Next on the agenda is simulating some fault codes so I can start writing code to test against it....

      Cheers,

      Paul

      Comment


      • #4
        Yay! I'm glad it's working :-D

        Which software is your "win app on Com4"? I know my stuff works with scantool.net, but I haven't tried many others on windows.

        The sim does understand error codes, but the default plugin [Cycle] doesn't provide them. There's a cheesy "Error" generator that just spits out some errors [it also ignores the reset command], or the GUI one is a lot better.

        To get the GUI one: If you haven't already done it, just open cygwin's setup.exe and install the packages "fltk-devel" and "fltk". Then re-run cmake and rebuild [you may need to purge your whole build dir first, as cmake caches the fltk stuff a bit over-vigorously].

        To run it, use "obdsim.exe -g gui_fltk". I'm guessing you've already found the manpages, but if you haven't, the obdsim page [online here] explains how to use different generators



        Gary (-;
        OBDGPSLogger, for logging OBDII and/or GPS data
        OBDSim, an OBDII/ELM327 software simulator
        mp3car forums: obdgpslogger, obdsim

        Comment


        • #5
          Oops, tried to build the app again after nuking the build dir but had a make exception:

          Code:
          Scanning dependencies of target obdgui
          [ 54%] Building CXX object src/gui/CMakeFiles/obdgui.dir/guessdevs.cpp.o
          In file included from /home/Paolo/obdgpslogger/src/gui/guessdevs.cpp:26:
          /usr/include/FL/Fl_Input_Choice.H:41: error: invalid use of undefined type `stru
          ct Fl_Group'
          /usr/include/FL/Fl_Widget.H:35: error: forward declaration of `struct Fl_Group'
          /usr/include/FL/Fl_Input_Choice.H: In static member function `static void Fl_Inp
          ut_Choice::menu_cb(Fl_Widget*, void*)':
          /usr/include/FL/Fl_Input_Choice.H:62: error: 'class Fl_Input_Choice' has no memb
          er named 'do_callback'
          /usr/include/FL/Fl_Input_Choice.H: In static member function `static void Fl_Inp
          ut_Choice::inp_cb(Fl_Widget*, void*)':
          /usr/include/FL/Fl_Input_Choice.H:67: error: 'class Fl_Input_Choice' has no memb
          er named 'do_callback'
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::inp_
          $
          /usr/include/FL/Fl_Input_Choice.H:71: error: `x' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:71: error: (Each undeclared identifier is repo
          rted only once for each function it appears in.)
          /usr/include/FL/Fl_Input_Choice.H:71: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::inp_
          y()':
          /usr/include/FL/Fl_Input_Choice.H:72: error: `y' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:72: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::inp_
          w()':
          /usr/include/FL/Fl_Input_Choice.H:73: error: `w' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:73: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::inp_
          h()':
          /usr/include/FL/Fl_Input_Choice.H:74: error: `h' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:74: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::menu
          _x()':
          /usr/include/FL/Fl_Input_Choice.H:76: error: `x' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:76: error: `w' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:76: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::menu
          _y()':
          /usr/include/FL/Fl_Input_Choice.H:77: error: `y' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:77: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `int Fl_Input_Choice::menu
          _h()':
          /usr/include/FL/Fl_Input_Choice.H:79: error: `h' undeclared (first use this func
          tion)
          /usr/include/FL/Fl_Input_Choice.H:79: error: `box' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In constructor `Fl_Input_Choice::Fl_Input_Cho
          ice(int, int, int, int, const char*)':
          /usr/include/FL/Fl_Input_Choice.H:82: error: type `struct Fl_Group' is not a dir
          ect base of `Fl_Input_Choice'
          /usr/include/FL/Fl_Input_Choice.H:83: error: incomplete type `Fl_Group' used in
          nested name specifier
          /usr/include/FL/Fl_Input_Choice.H:84: error: `align' undeclared (first use this
          function)
          /usr/include/FL/Fl_Input_Choice.H:93: error: `end' undeclared (first use this fu
          nction)
          /usr/include/FL/Fl_Input_Choice.H: In member function `void Fl_Input_Choice::res
          ize(int, int, int, int)':
          /usr/include/FL/Fl_Input_Choice.H:114: error: incomplete type `Fl_Group' used in
           nested name specifier
          make[2]: *** [src/gui/CMakeFiles/obdgui.dir/guessdevs.cpp.o] Error 1
          make[1]: *** [src/gui/CMakeFiles/obdgui.dir/all] Error 2
          make: *** [all] Error 2
          Am I missing something else?

          Comment


          • #6
            That's ... odd. Looks like missing headers, or ... something.

            For want of being lazy, obdsim also builds just fine under MSYS/MinGW. I have a recent build here: obdsimwindows-2010-04-18.zip.

            I'll have to go and try what you're doing; as a whole I find Cygwin to be a suboptimal solution [you can think of it like linux is to winelib as windows is to cygwin], I'll try and install it later.

            Gary (-;
            OBDGPSLogger, for logging OBDII and/or GPS data
            OBDSim, an OBDII/ELM327 software simulator
            mp3car forums: obdgpslogger, obdsim

            Comment


            • #7
              I will take lazy! Have a result... GUI sim is up and running.

              Got some sample output from commands sent from my "app" (ok, a glorified console). This is the log output for the sim:

              Code:
              ATSP0
              OK
              >010C
              ?
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010C
              41 0C 4D E2
              >010D
              41 0C 4D E2
              >010D
              41 0D 00
              >010D
              41 0D 00
              >010D
              41 0D 00
              >010D
              41 0D 00
              >010D
              41 0D 00
              >010D
              41 0D 00
              >010D
              41 0D 7D
              >010D
              41 0D 7D
              >010D
              41 0D 7D
              >
              The first two commands I send are "ATE0" (echo off) and "ATSP0" (set protocol). I then send down 10 RPM reads, then 10 MPH reads.

              Interestingly, the feedback I receive seems to be "one command behind" - e.g. my first MPH request has a RPM value returned, and the first RPM request has ? returned (probably in response to the dubious ATSP0 command).

              Anyway, good enough work for going zero to hero in one evening I reckon

              Ta,

              Paul

              Comment


              • #8
                Update: looks like it's the "ATSP0" that makes the Sim unhappy, leaving that out makes it return the correct results....

                Comment


                • #9
                  Yeah, I don't honor SP right now. I'm planning on adding multiple protocol support and making SP do the right thing... eventually.

                  Gary (-;
                  OBDGPSLogger, for logging OBDII and/or GPS data
                  OBDSim, an OBDII/ELM327 software simulator
                  mp3car forums: obdgpslogger, obdsim

                  Comment


                  • #10
                    Nice one.

                    I've had a spare couple of hours over the weekend to fling something together.

                    This app will eventually be a fully fledged WPF or Mono application (running on Windows, *Nix, and Mac would be nice!), but for now I've put together a console app to bring together the core functionality.

                    Here's a peek:



                    Ta,

                    Paul

                    Comment


                    • #11
                      Great stuff!

                      What's kinda sad is that at this point I think more people are using my sim than logger, even though the sim was entirely a secondary thing to the original logger. 's all good though :-D

                      Gary (-;
                      OBDGPSLogger, for logging OBDII and/or GPS data
                      OBDSim, an OBDII/ELM327 software simulator
                      mp3car forums: obdgpslogger, obdsim

                      Comment

                      Working...
                      X