Skip to content

Function calls

On this page we describe how an openOBD session can be used to run functions, and how function calls can be made. For a better understanding of the definition and use of an openOBD function, please read this page first.

Note

The states interrupted and failed are final states and do not allow any transitions anymore. They all indicate the end of an openOBD session. Therefore, we can leave those two states out of the diagrams described on this page.

Default context

An openOBD session in its most simple form has one default function context. By function context we mean a piece of memory that is managed by the openOBD session.

Default context

Context

It is possible to create new function contexts. An openOBD session can stack multiple function contexts, and every function context follows the same state diagram with the two main operative states available and active.

Function context transitions

The following diagram shows which gRPC function calls are allowed in which state of the openOBD function context. It also indicates which function calls result in a state transition.

gRPC Call
Allowed in state \({c}^{n}_{\text{available}}\) Allowed in state \({c}^{n}_{\text{active}}\) Remarks
authenticate() yes no Transitions to state \({c}^{n}_{\text{active}}\)
assertAuthenticationPossible() yes yes Asserts that authenticate() is allowed (without actually authenticating)
openSessionTokenStream() no yes -
getConfigurationList() no yes -
finish() yes yes Transitions to state \(\begin{cases}{c}^{n-1}_{\text{available}} &\text{if } n > 0 \\\text{finished} &\text{if } n = 0\end{cases}\)
startFunctionContext() yes no Transitions to state \({c}^{n+1}_{\text{available}}\)
monitorFunctionContext() yes yes When context \({c}^{n}\) finishes (finish() is being called), this stream returns a fresh authentication token for \({c}^{n-1}_{\text{available}}\)
registerFunctionDetails() yes no Store function information in context \({c}^{n}\)
getFunctionDetails() yes yes -
setFunctionArgument() yes no Store arguments in context \({c}^{n}\)
setFunctionResult() no yes Store results in context \({c}^{n-1}\)
getVariableList() yes yes -
setVariable() yes yes -
getVariable() yes yes -
deleteVariable() yes yes -

Calling a function from the ticket dashboard

To make it easy for operators to run openOBD functions, it is possible to call a function from the ticket dashboard. To do this, simply open a ticket and press the Add button under Automation in the right sidebar, as shown in the image below.

Automation section in sidebar
Automation section in the sidebar

Pressing the Add button will open up the automation menu in which you can select the openOBD function to run by clicking on it. A function will first have to be registered before it is visible here. More information on how to register a function can be found on the function hosting and function broker pages.

Function selection menu
Function selection menu

When a function has been run, a pink line will appear at the top of the ticket, indicating that an openOBD session is running. A pink button showing the openOBD icon will also appear next to the ticket number. Clicking this button opens a list showing the openOBD functions that have been run on this ticket.

openOBD session indication
openOBD session indication