User Tools

Site Tools

Translations of this page:


OOBD Quick Script

When going through Make your own OOBD Scripts you might find that writing Lua Scripts for OOBD is not so easy. You need to install the build environment, understand how its all works, understand Lua as such, write you first scripts, compile it and debug it to finally have your first script in hands.

To make this easier, OOBD QuickScript was invented.

With the mouse you select the elements you want to have, drag and drop your program flow, fill in the parameters and finally download the compiled script ready to run.

All this runs in all modern browsers (except the Internet Explorer, as it seems :-( ), so you only need to go to OOBD QuickScript to have your first script ready in about five minutes.

Here is

How it Works

When opening the page, you'll find a menu bar and a initial template. When clicking onto the items in the menu bar, another menu opens where you can select the functionality you need. While all the other menu items only contain standard lua function, we'll concentrate on the OOBD menu with its related functions here.

The Buttons

In the upper right corner you find some buttons. These are

  • Clear Canvas : This cleans the whole drawing area
  • Import QS-Template : Loads a template from a file. Please note This loads the file into the existing content to allow to merge several templates into one program without deleting something before. But by importing things twice you can easily overlay one block with the same, which would cause faulty programs. So make sure that unwanted content is deleted first. When start from scratch, you should clean everything with the “Clear Canvas” button first
  • Save QS Template : Saves the actual content as a Template file
  • View Lua Source : Shows the actual content in its Lua representation
  • Download as compiled OOBD Script : This takes the actual content in its Lua representation, starts the build in Lua compiler, links it with the integrated runtime library and downloads the compiled lua file. This file can directly run in OOBD.

The OOBD Fuctions

The Main Menu

This is the starting point for your program. The program execution starts here, so here you can put the initialisation stuff in here (like setting the bus- and module parameters). Here you also need to place your main menu (in case you want to have one) with its menu items.

The Menu

Whenever you want to have a visible menu where the user can select some item from, you'll put these items into this menu structure. The menu title is that what is placed as header into the OOBD UI and helps the user to identify where he is.

The Menu Item

Inside the above mentioned menu you can have as many menu items as you like. Its parameters are

  • Content: That is what appears as item description
  • Icons: Here you can select which action flags (Update and Timer) this item should have
  • ID: This parameter is handed over to the related function call, where it can be used to control that behavior, e.g. using the same function on different items, but with different parameters

The Item Procedure

As said above, when a user selects a menu item, its related function is called. Such functions are defined here as an item procedure. When called, the variable id contains the ID parameter which is given in the menu item.

The return value of this function is shown as the result of the menu item call. So whatever you want to show as result, assign that value inside your program flow to the variable result as its content will be returned and shown as result.

Set the Dongle

This command you'll need at least once at the beginning to initialize the OOBD dongle hardware. The parameters and their meanings are:

  • Bus Mode: Here you can define if the Dongle CAN controller should be off, just listen or active. For the RTC mode listening is good enough, while for UDS with it's sending messages an active bus is recommended :-)
  • Channel: Here you select the 500kb High- Speed or the 125kb Mid Speed bus of the Dongle
  • Protocol: Here you decide between the Real Time Data (RDT) listening or the UDS communication protocol

Define the Module

This tells which module address to be used and how much time in milliseconds we'll give for a module answer.

Request a Service

After so much configuration stuff we come to the first real data communication. With the request service you can send your own service request or, in case of the RDT protocol, fill the listening tables.

If the program receives a positive answer from the module, means a service + 0x40 reply, the “success” branch is executed, where you place your own processing code. The variable udsLen contains the number of received bytes, the byte array udsBuffer the received bytes itself (don't forget: Lua arrays starts with 1 , not 0)

Any failure is handled by the routine itself and the actual running code is left with a return. As return value a error code is returned 1)

Evaluate a Result

And here now finally the probably most exiting routine: Requesting a value and get the clear text result in a single call. These are the parameters to make it work:

  • Service (hex): The service you want to call
  • Parameters (hex): The parameter you need to address the correct value of that service
  • Type: The format the answer is in:
    • ASCII: The answer is Text
    • Bit: The answer is handled as a single (on/of) Bit
    • numeric: a numeric Value (hard coded as UNSIGNED)
  • Startbit: On which bit (not byte!) the result is stored in the returned byte sequence
  • Length (Bits): How many bits (again: not bytes) the result occupies in the returned byte sequence. The length of a Bit value is always 1
  • Offset & Multiplier: Used in case of a numeric value: First the received bit sequence (defined by Startbit and Length) is transformed into an integer value. Then this value is multiplied with the multiplier and finally added by the offset.
  • Unit: In case of a numeric value, the Unit is attached to the numeric value to define its unit. In case of a bit value, the unit contains the textual description of the low ans high value of that bit, seperated by an |
1) I'm just struggling if it's a good idea to always straight return here -maybe I should change that..
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
doc/tools_quickscript.txt · Last modified: 2015/02/21 09:15 by admin