feat(04-01): add timestamp to ProcessedGpsData and precision/lifecycle constants
- Add timestamp field to ProcessedGpsData with copyWith support - Add precision switching thresholds: 3.33 m/s (12 km/h) up, 2.22 m/s (8 km/h) down - Add PRECISION_SWITCH_FIRST_FIX_DELAY (5s) to prevent early switching - Add BACKGROUND_GRACE_PERIOD (7s) for lifecycle-aware GPS management - Mark GPS_GRACE_PERIOD as deprecated in favor of BACKGROUND_GRACE_PERIOD - Change GpsService.positionStream to createPositionStream() with dynamic accuracy - Keep deprecated positionStream getter for backward compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ class ProcessedGpsData {
|
||||
final String displayHeading; // Formatted heading text
|
||||
final bool isSpeedValid; // True if from recent GPS
|
||||
final bool isHeadingValid; // True if from recent GPS
|
||||
final DateTime timestamp; // Timestamp for staleness detection
|
||||
|
||||
const ProcessedGpsData({
|
||||
required this.speed,
|
||||
@@ -13,6 +14,7 @@ class ProcessedGpsData {
|
||||
required this.displayHeading,
|
||||
required this.isSpeedValid,
|
||||
required this.isHeadingValid,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
ProcessedGpsData copyWith({
|
||||
@@ -22,6 +24,7 @@ class ProcessedGpsData {
|
||||
String? displayHeading,
|
||||
bool? isSpeedValid,
|
||||
bool? isHeadingValid,
|
||||
DateTime? timestamp,
|
||||
}) {
|
||||
return ProcessedGpsData(
|
||||
speed: speed ?? this.speed,
|
||||
@@ -30,6 +33,7 @@ class ProcessedGpsData {
|
||||
displayHeading: displayHeading ?? this.displayHeading,
|
||||
isSpeedValid: isSpeedValid ?? this.isSpeedValid,
|
||||
isHeadingValid: isHeadingValid ?? this.isHeadingValid,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user