Files
TelemetryMonitor/lib/session/status_snapshot.dart
2026-04-21 14:40:09 -03:00

32 lines
1.0 KiB
Dart

import '../transport/connection_state.dart';
/// Per-frame snapshot of derived state shown in the status bar.
///
/// All status-related values are *derived* from the packet buffer by walking
/// backward through up to `settings.statusLookback` packets. Fields not seen
/// within the lookback window are reported as null and rendered as "unknown".
class StatusSnapshot {
const StatusSnapshot({
required this.connection,
required this.pps,
required this.statusValues,
required this.protoPaused,
});
final WsConnectionState connection;
final double pps;
/// Length 8. Element is null = "not seen in lookback window".
final List<int?> statusValues;
/// Null = "not seen in lookback window". Treated as false for pause logic.
final bool? protoPaused;
factory StatusSnapshot.empty({
WsConnectionState connection = WsConnectionState.disconnected,
}) =>
StatusSnapshot(
connection: connection,
pps: 0,
statusValues: List<int?>.filled(8, null),
protoPaused: null,
);
}