Table of Contents
OOBDcmd - OOBD on the Command line
OOBDcmd is a little tool especially made to communicate easily with a vehicle during automated test runs via an OOBD dongle like the CAN-Invader.
To allow this, OOBDcmd acts like a command line tool:
At start it connects itself to a dongle by the given Bluetooth MAC address. When the connection is made, OOBDcmd checks if the bluetooth device is really a OOBD dongle. If yes, it transmits the optional given command sequence. At the end it returns an optional error code and the last received answer from the dongle.
OOBDcmd is not a program as such, it's just a python script. So it needs to have Python Version >=3.4 installed on the computer. To install
- Download and install Python from one of it's Download Servers
For example https://www.python.org/ftp/python/3.4.1/python-3.4.1.msi
- For windows, install also the PyBluez driver *after* installing python first: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pybluez PyBluez-0.20.win32-py3.4.exe
- goto the OOBDcmd source code
- in your browser, choose “Save as…” and save the source code as “oobdcmd.py” in a directory of your choise
As OOBDcmd is a command line tool, it needs to be started from a Command Prompt. If you don't know what this is, you won't need OOBDcmd at all…
Make sure the python interpreter is in your search path for executable programs. In case of problems please follow the Python documentation.
- Open the Command Prompt
- “cd” to the directory in which you've saved the oobdcmd.py script
Now you can call the script
python oobdcmd.py Usage: oobdcmd.py BT-MAC-Address ['cmdset[,cmdset]'] for detailed information goto http://www.oobd.org/doku.php?id=doc:tools_oobdcmd
OOBDcmd can be called with the MAC Adress of the bluetooth dongle and optional with one or more cmdsets.
When called without cmdsets, it just tests the connection and the correct answer from the dongle.
if successful, the returned errorcode is 0, otherways 1 (bluetooth error) or 2 (dongle identification error)
The power of OOBDcmd comes from its capability to go through a complete command sequence, the so called cmdsets.
Cmdsets: Command Sets
A command sequence consists of one or more cmdsets, separated by , . The whole command sequence needs to be enclosed in ' '
A Command Set consist of a OOBD input line (cmd) and a regular expression (regex), seperated by a |
The OOBD input line cmd is explained in the OOBD firmware syntax. Please do not forget to end the input command with a trailing “\r”
The regex format is explained in the Python regex tutorial
When OOBDcmd goes through the command sequence, it takes each cmdset and sends the cmd to the dongle. After receiving an answer, it compares the answer against the regex. If the regex is valid, it continues with the next cmdset. If the regex is invalid, OOBDcmd writes the received answer to stdout and finish with program exit code 3 (failure through command sequence)
If the last cmdset is successfully done, OOBDcms writes the last received answer to stdout and finishes with program exit code 0 (=no errors)
Here are some examples. Please note, that for confidential reason the IDs and DIDs are faked and to not show real values, so using this examples 1:1 won't work
Reading the Dongle firmware version string
python3.4 oobdcmd.py 00:12:6F:2B:F0:84 'p 0 0 0\r|.*(OBD).*' >echo $? # get program exit code 0
again the firmware version string, but now with a non matching regex, which creates a error code
python3.4 oobdcmd.py 00:12:6F:2B:F0:84 'p 0 0 0\r|.*(O-D).*' >echo $? # get program exit code 2
Write a result in a file
python3.4 oobdcmd.py 00:12:6F:2B:F0:84 'p 0 0 0\r|.*(OBD).*' > version.txt >echo $? # get program exit code 0 >more version.txt OOBD D2a 715 Lux-Wolf CAN-Invader Fri, 15 Nov 2013 17:37:58 +0100
Now something more exiting: Selecting the High- speed bus, configure it, set the filters and and module ids and test via tester present, if the module is there
python3.4 oobdcmd.py 00:12:6F:2B:F0:84 'p 8 2 0\r|\.,p 8 3 0\r|\.,p 8 2 3\r|\.,p 6 5 $620\r|\.,p 8 10 1 $7FE\r|\.,p 8 11 1 $0000\r|\.,2002\r|^(60)' >echo $? # get program exit code 0
And now full size: Initialize and request the vehicle configuration
python3.4 oobdcmd.py 00:12:6F:2B:F0:84 'p 8 2 0\r|\.,p 8 3 0\r|\.,p 8 2 3\r|\.,p 6 5 $620\r|\.,p 8 10 1 $7FE\r|\.,p 8 11 1 $0000\r|\.,32F106\r|^(62)' 62f106fccc04020100600204011101080100000001000200000201020200040200000100010100000000000200000307010000010000000000000000000302000101020100030102001366310002010400000100000100010001000202000000000100000100000000000000000704000200010000020001000100000000000000000000000000000000000002000000000300040001000000020000000000000001000000000000000000000000020003000000000000000000000000000002000001000100000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e >echo $? # get program exit code 0
Input / Output
All status informations are written to stderr, the last received answer is written to stdout (multiple lines are concated into one single line, the trailing .\r> sequence is truncated), also OBBDcmd returns a proper program exit code