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 function 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

A new context \({c}^{n+1}\) can be started from the parent context \({c}^{n}\). If the parent context is in state active, the new context will be a communication-only mode. This means that the new context cannot access the user interface, but can access other functionality. If the parent context is in state available, the new context will have full access to all functionality.

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 yes 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}\), if that context is in AVAILABLE state.
registerFunctionDetails() yes yes Store function information in context \({c}^{n}\)
getFunctionDetails() yes yes -
setFunctionArgument() yes yes 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 -