vss_crash_event
Pure-Dart, zero-dependency typed data classes for vehicle crash / impact events, modelled on the COVESA Vehicle Signal Specification (VSS) vocabulary.
VSS exposes the individual sensor primitives (airbag deployment, time-to-impact, brake-assist engagement) but has no single "crash event" signal. This package is the small aggregation layer edge developers consume: immutable value types, JSON round-trip, and an advisory derived severity — with no rendering or platform dependencies, so it runs anywhere Dart runs (Flutter, server, CLI, edge).
It is a Layer-0 parser/model package: it does not read VSS files or talk to a data broker; you map your data source into these types.
Install
dependencies:
vss_crash_event: ^0.1.0
Usage
import 'package:vss_crash_event/vss_crash_event.dart';
final event = CrashEvent(
timestamp: DateTime.now().toUtc(),
obstacleDetection: ObstacleDetection(
distanceMeters: 3.2,
timeGapMs: 250, // time-to-impact
warningType: ObstacleWarningType.crossTraffic,
),
airbags: const [
AirbagStatus(position: 'Row1.Pos1', isEnabled: true, isDeployed: true),
AirbagStatus(position: 'Row1.Pos2', isEnabled: true, isDeployed: false),
],
brakeAssist: const BrakeAssistStatus(absEngaged: true, ebaEngaged: true),
);
// Severity is derived from the readings unless you pass it explicitly.
print(event.severity); // CrashSeverity.severe
print(event.deployedAirbagCount); // 1
// Serialize / deserialize.
final json = event.toJson();
final restored = CrashEvent.fromJson(json);
assert(restored == event);
VSS provenance
Each field is derived from a VSS signal. Field naming follows VSS conventions (units in the names) while staying idiomatic Dart.
| Dart | VSS signal | Type |
|---|---|---|
ObstacleDetection.distanceMeters |
Vehicle.ADAS.ObstacleDetection.Distance |
float, m, min 0.0 |
ObstacleDetection.timeGapMs |
Vehicle.ADAS.ObstacleDetection.TimeGap |
uint32, ms |
ObstacleDetection.warningType |
Vehicle.ADAS.ObstacleDetection.WarningType |
string (enum) |
AirbagStatus.isEnabled |
Vehicle.Cabin.Seat.RowN.PosM.Airbag.IsEnabled |
boolean |
AirbagStatus.isDeployed |
Vehicle.Cabin.Seat.RowN.PosM.Airbag.IsDeployed |
boolean |
BrakeAssistStatus.absEngaged |
Vehicle.ADAS.ABS.IsEngaged |
boolean |
BrakeAssistStatus.ebaEngaged |
Vehicle.ADAS.EBA.IsEngaged |
boolean |
CrashEvent and CrashSeverity are not native VSS signals — they are the
aggregation and a derived convenience classification. CrashSeverity is
advisory only; see CrashEvent.classifySeverity for the heuristic.
License
BSD 3-Clause. See LICENSE.
Libraries
- vss_crash_event
- Pure-Dart typed data classes for vehicle crash/impact events, modelled on COVESA Vehicle Signal Specification (VSS) vocabulary.