Question for software experts...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • S2central.net
    Retired OG Mod
    • Jul 2003
    • 16590
    • Country: Northern Ireland

    #1

    Question for software experts...

    I used to do some software programming many years ago - mostly assembly, some C and Pascal - way before PC days.

    With a large number of Motronic projects in motion I need to write some software to automate a lot of things but need some advice on the best environment to get into on PC for some applications.

    I need to do two things essentially.

    1. Parse a lot of binary files (one at a time) - searching for specific sequences to create an output file that defines where certain data is. WinOLS attempts to do this, but only finds like a quarter of the maps that I can locate with my eyes. To enter all of this map info into tuning software packages manually is a massive boring task...

    2. send / receive commands on a serial port to an external device. I have the API for it, but have no idea what is the best environment to create the device software.


    I need something that is easy to get me started - and has a forum of users and docs where code snippets are shared and programming tips exchanged.

    WOuld some of the modern scripting type languages (PHP, perl or python) be suitable for the file parsing - which if those is easiest to get up and running quickly ?

    I like the thought of creating a script which can look for configurable parameters one at a time, rather than parsing everything at once - and doing it again when any new variables are discovered.

    Dare I say that something like Visual Basic is suitable for the comms application ? How easy is that to get operational ?
    Paul Nugent
    Webmaster http://S2central.net
    Administrator http://S2forum.com

    1994 S2 Coupe ABY - aka Project Lazarus
    2001 A6 allroad 2.5TDi - family tank
    2003 S4 Avant 4.2 V8 - daily burble

    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

    There are only 10 kinds of people that understand binary - those that do, and those that don't
  • Sonic
    Administrator
    • Jul 2006
    • 5514
    • Home: United Kingdom Current: England

    #2
    Interesting

    I cant advise too much on the application languages, but PHP is quick and a piece of piss to parse files with. An application language would be a lot quicker, but would take you longer to write. You can actually use PHP in an application fashion, without running it through a webserver, but this IS NOT advisable.

    As for the serial communication (you could get PHP to do this also ) i would say C#, VB or C would be the best.
    S2Forum.com Administrator

    Comment

    • S2central.net
      Retired OG Mod
      • Jul 2003
      • 16590
      • Country: Northern Ireland

      #3
      Good stuff Sonic... I had hoped PHP was a good bet, but I had no idea that it had comms capability...

      I'll google about for quick start guides on PHP, but if you can shortcut the search time with any useful sites or books that might help it would be awesome.

      I'm pretty sure the comms application will be a lot more tricky than the file parser...
      Paul Nugent
      Webmaster http://S2central.net
      Administrator http://S2forum.com

      1994 S2 Coupe ABY - aka Project Lazarus
      2001 A6 allroad 2.5TDi - family tank
      2003 S4 Avant 4.2 V8 - daily burble

      Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

      There are only 10 kinds of people that understand binary - those that do, and those that don't

      Comment

      • Nuvo
        S2Forum Possessed
        • Nov 2003
        • 3825

        #4
        Originally posted by S2central.net
        Parse a lot of binary files (one at a time) - searching for specific sequences to create an output file that defines where certain data is. WinOLS attempts to do this, but only finds like a quarter of the maps that I can locate with my eyes. To enter all of this map info into tuning software packages manually is a massive boring task...
        This is something you should be able to write yourself. I would suggest coding a simple console app in C to step through each byte in the binary file to find the desired byte pattern then write every matched sequence and its offset to a text file or similar.

        What file format does the tuning package use?

        ANSI C is a system programmers language capable of handling serial comms too via standard IO or a static library of your choosing.

        Comment

        • Smiley
          S2Forum Addict
          • Jun 2005
          • 329
          • Country: Germany

          #5
          Maybe the (UNIX) tool "awk" or "gawk" is able to help you in finding the byte number for a given 'string'. I'm quite shure it does this for text files, but binary..
          You haven't found a HEX-Editor that is scriptable?

          With the API i would personally start with VB, don't know how the COM-handling will be. Do you have a DLL, or do you want to send and recieve raw bytes?
          '93 Audi S2 Avant panthero black, 412.000km
          '94 Audi S4 C4 Avant 303Tkm, KW, Brembos, BN-Pipes, Bose, S6 front (sold)
          '93 Audi S4 C4 Avant, 260Tkm
          '88 Audi 100 Avant turbo 44Q
          '84 Audi 80 quattro tornado red
          sigpic

          Comment

          • S2central.net
            Retired OG Mod
            • Jul 2003
            • 16590
            • Country: Northern Ireland

            #6
            Yep Nuvo - I wrote file parsers in a past life - and a disassembler once was probably my best work.

            So this PHP then - if I get the Windows installer from http://www.php.net/downloads.php - will that install on a standalone PC ok - this is no web server... I just need the PHP parser to work on general purpose scripts... has nothing to do with building on top of web pages.

            The tuning package I have uses a proprietary file format to describe the map locations - I am hoping that I can extend this idea into a script that creates a definition file when I whizz the BIN through it. That would be really cool !
            Paul Nugent
            Webmaster http://S2central.net
            Administrator http://S2forum.com

            1994 S2 Coupe ABY - aka Project Lazarus
            2001 A6 allroad 2.5TDi - family tank
            2003 S4 Avant 4.2 V8 - daily burble

            Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

            There are only 10 kinds of people that understand binary - those that do, and those that don't

            Comment

            • Smiley
              S2Forum Addict
              • Jun 2005
              • 329
              • Country: Germany

              #7
              Yes, Nuvo is right... it maybe quite quick to write it yourself, there are examples in the net for string searches and file and COM I/O, for C/VB/Java...
              so some sort of LEGO and you are able to add some very special features!
              '93 Audi S2 Avant panthero black, 412.000km
              '94 Audi S4 C4 Avant 303Tkm, KW, Brembos, BN-Pipes, Bose, S6 front (sold)
              '93 Audi S4 C4 Avant, 260Tkm
              '88 Audi 100 Avant turbo 44Q
              '84 Audi 80 quattro tornado red
              sigpic

              Comment

              • S2central.net
                Retired OG Mod
                • Jul 2003
                • 16590
                • Country: Northern Ireland

                #8
                The BIN description file is just structured text, so with time I could create a script to generate it - with correct scaling and labelling.

                Any advice on installing this PHP thing - will it give me the stand-alone parser automatically or what ?
                Paul Nugent
                Webmaster http://S2central.net
                Administrator http://S2forum.com

                1994 S2 Coupe ABY - aka Project Lazarus
                2001 A6 allroad 2.5TDi - family tank
                2003 S4 Avant 4.2 V8 - daily burble

                Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                There are only 10 kinds of people that understand binary - those that do, and those that don't

                Comment

                • KaraK
                  S2Forum Addict
                  • Feb 2006
                  • 328
                  • Country: England

                  #9
                  Searching for specific sequences in an binary file can be done quite easily in most modern languages - however as you have already determined the Mk1 Eyeball is hard to better (but it does get rather tedious) but there is no reason a well written parser couldnt do a pretty good job. Obviously without seeing an example of the sort of data you would be processing its hard to be more specific but I'd take a stab that you would be using regular expressions to identify possible matches and then confirming visually.

                  As for language choice as sonic says PHP would be a breeze for the parsing but its not really the ideal overall choice if you wanted a full on slice 'em and dice 'em app. You could do it all in C and if well written performance would be lightning but if badly written it would be a crash-happy monster, it would take longer to write and life's too short. My personal preference would be for C# as it makes both RegEx and serial comms trivial, its easy to program in and performance would be good. Oh and please don't use VB - its easy to get it working but also easy to write cr*p code that turns into a monster. Its an amateurish language that gives amateurish results!
                  Haynes Manual:As described in Chapter 7...

                  Translation:That'll teach you not to read through before you start, now you are looking at scarey photos of the inside of a gearbox.

                  Comment

                  • Sonic
                    Administrator
                    • Jul 2006
                    • 5514
                    • Home: United Kingdom Current: England

                    #10
                    Originally posted by S2central.net
                    The BIN description file is just structured text, so with time I could create a script to generate it - with correct scaling and labelling.

                    Any advice on installing this PHP thing - will it give me the stand-alone parser automatically or what ?
                    Download http://uk3.php.net/get/php-5.2.8-Win.../from/a/mirror and you can run php scripts through the php-win.exe
                    S2Forum.com Administrator

                    Comment

                    • Tonks4x4
                      Retired OG Mod
                      • Nov 2005
                      • 3062
                      • Country: United Kingdom

                      #11
                      I was a VB Programmer for 6 years and I am well interested in helping out with this one..... Did a little C++ a long while ago.

                      Brian
                      Audi Nut!!!

                      Comment

                      • Nuvo
                        S2Forum Possessed
                        • Nov 2003
                        • 3825

                        #12
                        Maybe you can draw some inpiration from this source and edit it accordingly if you want to go the C route?

                        Comment

                        • S2central.net
                          Retired OG Mod
                          • Jul 2003
                          • 16590
                          • Country: Northern Ireland

                          #13
                          Nice idea, but I think C is beyond me now - all those libraries and a compiler... Sure would create better code by a good programmer, but I just need some quick dirty scripts so I think PHP is going to be OK... Googled round some sample code sites there while DL'ing the installer and found the tricks to set path for the command line parser.

                          @Tonks - can you have a look for any VB code that simply passes short ASCII text commands to a COM port destination - then dumps to screen and/or output file the ASCII text which is returned. Its abot 20ms lag apparently. Thats how simple that app needs to be... BUt again I have not setup that environment before so any pointers for a noob ?
                          Paul Nugent
                          Webmaster http://S2central.net
                          Administrator http://S2forum.com

                          1994 S2 Coupe ABY - aka Project Lazarus
                          2001 A6 allroad 2.5TDi - family tank
                          2003 S4 Avant 4.2 V8 - daily burble

                          Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                          There are only 10 kinds of people that understand binary - those that do, and those that don't

                          Comment

                          • S2central.net
                            Retired OG Mod
                            • Jul 2003
                            • 16590
                            • Country: Northern Ireland

                            #14
                            Or maybe I just need a pre-built VB.net component like this



                            ????
                            Paul Nugent
                            Webmaster http://S2central.net
                            Administrator http://S2forum.com

                            1994 S2 Coupe ABY - aka Project Lazarus
                            2001 A6 allroad 2.5TDi - family tank
                            2003 S4 Avant 4.2 V8 - daily burble

                            Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                            There are only 10 kinds of people that understand binary - those that do, and those that don't

                            Comment

                            • S2central.net
                              Retired OG Mod
                              • Jul 2003
                              • 16590
                              • Country: Northern Ireland

                              #15
                              Hold fire on that last thought - I've found a standalone package that might just be the ticket. Fingers X'd
                              Paul Nugent
                              Webmaster http://S2central.net
                              Administrator http://S2forum.com

                              1994 S2 Coupe ABY - aka Project Lazarus
                              2001 A6 allroad 2.5TDi - family tank
                              2003 S4 Avant 4.2 V8 - daily burble

                              Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                              There are only 10 kinds of people that understand binary - those that do, and those that don't

                              Comment

                              Working...