Architecture¶
The SDK exists to make one firmware's HMI programmable without letting a plugin take the unit down. That goal explains nearly every design choice: a narrow API, a filtered class loader, one worker per plugin, declarative hooks and a firmware adapter.
The layers¶
flowchart TB
subgraph plugin["Plugin (your code)"]
P["Java, class-file v48"]
end
subgraph sdk["SDK"]
API["mibsdk.api<br/>stable, firmware-neutral"]
RT["mibsdk.runtime<br/>loader, lifecycle, permissions, UI"]
SPI["mibsdk.platform<br/>adapter SPI"]
AD["adapter-hqc<br/>firmware-specific"]
end
subgraph stock["Stock HMI"]
LSD["lsd.jar on IBM J9 2.3"]
DSI["DSI services"]
JNI["JNI / native"]
end
P --> API --> RT --> SPI --> AD --> LSD
LSD --> DSI --> JNI
| Layer | Responsibility | Sees stock classes? |
|---|---|---|
| Plugin | Your feature | No |
mibsdk.api |
The contract | No |
mibsdk.runtime |
Discovery, enable/disable, permissions, storage, scheduler, UI table, boot guard | No |
mibsdk.platform |
The adapter contract and UI snapshot model | No |
adapter-hqc |
Bundle activator, configurator chain, DSI bridges, HMI drawing | Yes |
| Stock HMI | The manufacturer's classes, J9, DSI | — |
A plugin is compiled against mibsdk.api only. The class loader it runs in exposes java.*, javax.*,
mibsdk.api.*, mibsdk.compat.* and the Retrotranslator runtime; everything else is hidden. That is
why a plugin cannot call a stock HMI class even by accident.
Boot¶
lsd.shputs the SDK jars on the boot classpath.- The SDK bundle activator starts.
- The configurator checks
/ifs/version_info.txtand selects an adapter. No matching adapter means the SDK stops and loads no plugins. - The
BootGuardreadsboot.state. If the previous boots were unhealthy, this is a safe-mode boot: pending overrides are restored and no plugins load. - After the configured delay (30 s by default), the runtime discovers
plugins/*.jar, validates eachplugin.json, checks grants and enables the plugins in dependency order. healthyAfterMs(60 s) after loading, the boot is marked healthy.
sequenceDiagram
participant Boot as HMI boot
participant Guard as BootGuard
participant RT as Runtime
participant Plugin
Boot->>Guard: read boot.state
alt safe mode
Guard-->>RT: no plugins
RT->>RT: restore pending overrides
else normal
Guard-->>RT: continue
RT->>RT: discover and validate jars
RT->>Plugin: onEnable(ctx) on worker
RT->>Guard: mark healthy after 60 s
end
Lifecycle¶
stateDiagram-v2
[*] --> DISCOVERED
DISCOVERED --> BLOCKED_INVALID: bad jar/manifest
DISCOVERED --> BLOCKED_PERMISSIONS: grant missing
DISCOVERED --> BLOCKED_DEPENDENCY: dependency not enabled
DISCOVERED --> ENABLED: onEnable returns
DISCOVERED --> FAILED: load/onEnable throws
ENABLED --> QUARANTINED: 3 failures/60s or 30s hang
ENABLED --> DISABLED: user/reload/stop
QUARANTINED --> DISABLED
DISABLED --> ENABLED: re-enable/reload
FAILED --> DISABLED
Disabling always cancels registrations, releases overrides, flushes storage and then runs onDisable().
A plugin is constructed fresh for each run, so fields do not survive a reload; persistent state belongs
in storage.
Threads¶
| Thread | Runs |
|---|---|
| HMI dispatcher and stock threads | Never plugin code |
| Runtime control thread | Load, enable, disable, reload, quarantine |
| One worker per plugin | onEnable, onDisable, actions, timers, events, dialog answers |
| Ledger thread | Applying and restoring overrides |
| Dev-channel thread | Reload markers and log mirroring |
One worker per plugin gives plugins a simple concurrency model: callbacks never overlap, so shared
fields need no locks. It also means a slow callback delays that plugin only. The worker is a daemon at
NORM_PRIORITY - 1.
UI¶
Plugins describe UI; the runtime and adapter draw it.
- A plugin builds a
PageSpecand callsui.page. - The runtime stores the page in a
UiTablesnapshot. - The adapter reads the snapshot and builds stock HMI widgets or list cells.
- Input comes back as a
UiInput, is mapped to aUiAction, and is queued on the plugin's worker. - Missing features produce inert handles rather than exceptions.
The same UiTable is used by the fake car, which is why host tests exercise the real UI model without
the HMI.
Permissions¶
Permissions are declared in the manifest, approved by the user and enforced at the API boundary. The build scans code for known permissioned calls; the runtime refuses a call whose permission is not granted. A plugin missing any declared permission does not start.
This is a seat belt, not a sandbox. platform.unrestricted is the explicit escape hatch, and the SDK
cannot contain a plugin that uses it.
Overrides¶
Vehicle writes go through an OverrideLedger:
- only one plugin may hold an override;
- the ledger records the prior value in
ledger.properties; - it restores on disable, uninstall,
UNTIL_IGNITION_OFFand safe-mode boot; - a failed restore is retried with backoff.
That is why a plugin can mute parking tones without leaving the car muted after a crash.
The Java/native boundary¶
Everything above adapter-hqc is Java. adapter-hqc is also Java, but compiled against the stock jars
and allowed to use stock HMI classes. Below it, the stock HMI talks to DSI services and native code
(ealswig, Kanzi, the parking ECU) through JNI.
A plugin cannot cross that boundary directly. It reaches native daemons over TCP with ctx.net()
(loopback by default, outbound with network.outbound), and stock behaviour through declarative hooks. This keeps plugins portable across firmware
adapters and keeps a plugin from depending on a native ABI that may change.
Why the build is unusual¶
The car loads only v48 class files and has a Java 1.4 library. The build therefore:
- compiles with JDK 17 and
--release 8; - lowers syntax with Retrolambda and Retrotranslator;
- checks every class is v48;
- checks every reference against a signature list of the car's class library;
- checks permissions, API level and forbidden constructs;
- stamps the jar so mibpkg can verify it.
A plugin developer sees ordinary Gradle tasks. The unusual parts are hidden behind mibsdk.plugin.