Files
gps-speedo/lib/config/gps_constants.dart
T
Mikkeli Matlock c4d4032b6b 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>
2026-02-12 09:00:10 +09:00

32 lines
1.3 KiB
Dart

// GPS behavioral constants — SCREAMING_SNAKE per project convention
/// GPS configuration constants for data validation and timeouts
abstract class GpsConfig {
/// Time threshold after which GPS data is considered stale
static const Duration STALE_DATA_THRESHOLD = Duration(seconds: 4);
/// Timeout for initial GPS fix acquisition (outdoor/cold start)
static const Duration INITIAL_FIX_TIMEOUT = Duration(seconds: 20);
/// Timeout for ongoing GPS updates (indoor/signal loss detection)
static const Duration UPDATE_TIMEOUT = Duration(seconds: 2);
/// Minimum valid heading value in degrees
static const double VALID_HEADING_MIN = 0.0;
/// Maximum valid heading value in degrees
static const double VALID_HEADING_MAX = 360.0;
/// Speed threshold below which heading is considered unreliable (m/s)
static const double LOW_SPEED_THRESHOLD = 1.0;
/// Speed threshold for switching to HIGH precision (m/s) - 12 km/h
static const double PRECISION_UP_THRESHOLD_MPS = 3.33;
/// Speed threshold for switching to BALANCED precision (m/s) - 8 km/h
static const double PRECISION_DOWN_THRESHOLD_MPS = 2.22;
/// Minimum time after first fix before precision switching starts
static const Duration PRECISION_SWITCH_FIRST_FIX_DELAY = Duration(seconds: 5);
}