Table of Contents

Core Concepts

Events and States

Every diagnostic event has an Id (a stable numeric identifier), a Name, an Origin (a free-text grouping label, e.g. "User Defined Events"), and a State:

State Meaning
None No opinion reported yet
Passed Committed passing
Prepassed Trending toward passing, not yet committed (debounce in progress)
Prefailed Trending toward failing, not yet committed (debounce in progress)
Failed Committed failing

Application and service code reports a candidate state via DiagnosticServiceClient.SetEventStatus (typically Prepassed/Prefailed, or Failed/Passed directly for events with no debounce). The service decides — based on the event's configured DebounceMode — whether that candidate actually changes the event's committed State, and only raises NotifyEventChanged when it does.

Debounce Modes

Configured per event in DiagnosticConfiguration.json (mode):

  • Manual — the reported state becomes the committed state immediately, with no debounce. Reporting Failed commits Failed on the next call.
  • Counter — a running counter moves toward FailedValue (by StepUp, or JumpUp when crossing from the passed side) each time Prefailed/Failed-range states are reported, and toward PassedValue (by StepDown/JumpDown) on Prepassed/passed-range reports. The committed state only flips to Failed once the counter reaches FailedValue, or to Passed once it reaches PassedValue — isolated blips don't commit a state change.
  • Timer — the first Prepassed or Prefailed report starts a hold timer (TimeoutPassed/TimeoutFailed milliseconds). If the same trend is still being reported when the timer elapses, the state commits to Passed/Failed; a report of the opposite trend before the timer elapses cancels it. A report of an unrelated state (not Prepassed/Prefailed) while a timer is pending commits immediately.

Both Counter and Timer exist so a single noisy or transient report doesn't flip a fault light — only a sustained trend does.

The Client/Service Relationship

DiagnosticService is AutoStart, so it is already running by the time your application code executes. DiagnosticServiceClient.EnableEvents() is effectively a handshake call — it ensures the service instance backing your events exists and is ready, and is only necessary if you are not already relying on another component's AutoStart sequencing to have done so.

Once connected, a client can:

  • Report a state with SetEventStatus
  • Query one event's current state with GetEventStatus, or search/filter across all configured events with SearchEvents (by OriginFilter/NameFilter, optionally inverted)
  • React to state changes as they happen via the NotifyEventChanged notification, delivered through Ahsoka.Core.Dispatch like any other Ahsoka service notification

Because DiagnosticService is shared across every service and application component in the package, it is the common place other extensions (e.g. a CAN diagnostic trouble code decoder) can report a fault without every component needing its own ad hoc status tracking.