Skip to content

openOBD function

An openOBD function is an autonomous procedure that can be executed in the context of an openOBD session. An openOBD function can be described as a self-contained functional procedure block that can be used to build complex diagnostic procedures on openOBD. Reuse of functionalities and isolated testing of these openOBD functions contribute to the quality and reliability of openOBD procedures.

Function information

Every function can be assigned some details that describes and uniquely identifies this function. These function details can be set just before any diagnostic operations are carried out.

FunctionDetails

id     47305693-9e0a-444e-b675-60d933c8ca9a
version   2.3
name    ExampleFunction
descriptionDemonstrate the concept of an openOBD function defintion

Stand-alone functions

An openOBD session in its most simple form is just an automated process that controls the bus communication and user interaction within the context of a ticket in the Jifeline infrastructure. This openOBD session is created on the ticket. The process receives an authentication token that is used to authenticate() and start controlling the openOBD session. This basic use of an openOBD session can be described as a stand-alone function. A function in its most basic form.

sequenceDiagram
    autonumber
    participant DEFAULT as Default function
box lightgray
    participant OS as openOBD session
end

    note over OS: default context<br/>available

    DEFAULT->>OS: authenticate()
    activate OS
    note over OS: default context<br/>active
    OS-->>DEFAULT: session_token
    activate DEFAULT
    rect rgb(200, 150, 255)
    DEFAULT-->OS: OBD communication
    end

    DEFAULT->>OS: finish()
    deactivate OS
    deactivate DEFAULT  

Composite functions

It is possible to construct openOBD sessions using functional building blocks. Every building block can be seen on its own as a separate function. A function call within the context of openOBD means that the control over the openOBD session is temporarily handed over to another function. Once this function finishes its execution, the calling function is getting back the control over the openOBD session. These separate functions (or functional blocks) do not necessarily need to be hosted at the same location. It is possible to combine functions from 3rd parties that are hosted at different locations.

Here we will illustrate how this technically works.

sequenceDiagram
    autonumber
    participant DEFAULT as Default function
    participant F1 as Function x<br/>Towbar coding
    participant F2 as Function y<br/>Unlock ECU
box lightgray
    participant OS as openOBD session
end

 note over OS: default context<br/>available
 DEFAULT->>OS: createFunctionContext(x)
 note over OS: context x<br/>available 
 OS->>DEFAULT: sessionInfo_x
 DEFAULT->>F1: runFunction(x, sessionInfo_x)
 F1->>OS: createFunctionContext(y)
 note over OS: context y<br/>available
 OS->>F1: sessionInfo_y
 F1->>F2: runFunction(y, sessionInfo_y)
 F2->>OS: authenticate(y)
 activate OS
 note over OS: context y<br/>active
 OS-->>F2: session_token
        activate F2
        rect rgb(200, 150, 255)
        Note right of F2: OBD communication<br/>to unlock ECU
        F2-->OS: OBD communication
        end
        F2->>OS: finish(y)
        deactivate OS
        deactivate F2
        OS-->>F1: authentication_token
        note over OS: context x<br/>available
    F1->>OS: authenticate(x)
    activate OS
    note over OS: context x<br/>active    
    OS-->>F1: session_token
    activate F1
    rect rgb(200, 150, 255)
    Note right of F1: OBD communication<br/>to code towbar
    F1-->OS: OBD communication
    end
    F1->>OS: finish()
    deactivate OS
    deactivate F1
    OS-->>DEFAULT: authentication_token
    note over OS: default context<br/>available
    Note right of DEFAULT: Evaluate results<br/>and finish session
    DEFAULT->>OS: finish()