- TrackState-Zustände (no_fix/static/moving_slow/moving_medium/moving_fast) mit je eigenem Meldeintervall mit/ohne Auftrag (lib/tools/track_state.dart) - Festes Sampling (15s) statt fixem 120s-Timer; Sofortmeldung bei Zustandswechsel, sonst nach Zustandsintervall (mqtt_core.dart) - track-JSON um state (String) und speed (m/s) erweitert - Statisch-Erkennung über GPS-Genauigkeit, aktiver Auftrag = akzeptiert und <=15min vor ordertime - chat_message.dart: Direktimport von objectbox.dart ergaenzt, behebt build_runner-Aufloesungsfehler (ChatMessage-Entity) - Release-Build-Script (build_release_apk.sh) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
59 lines
2.0 KiB
Dart
59 lines
2.0 KiB
Dart
/// Bewegungszustände für die adaptive Positionsmeldung (Tracking).
|
|
///
|
|
/// Je Zustand gibt es zwei Meldeintervalle: eines, wenn ein Auftrag aktiv ist
|
|
/// ("mit Auftrag"), und eines ohne aktiven Auftrag. Die kleinste vorkommende
|
|
/// Intervallzeit ([TrackTuning.samplingInterval]) wird als feste Sampling-Rate
|
|
/// verwendet; bei jedem Sample wird entschieden, ob eine Meldung fällig ist.
|
|
enum TrackState {
|
|
/// Keine Ortung verfügbar.
|
|
noFix('no_fix', 1800, 1800),
|
|
|
|
/// Statische Position (Positionsänderung < Ortungsradius / 2).
|
|
stationary('static', 600, 600),
|
|
|
|
/// In Bewegung, langsam (Geschwindigkeit < 1.5 m/s).
|
|
movingSlow('moving_slow', 60, 120),
|
|
|
|
/// In Bewegung, mittel (Geschwindigkeit < 17 m/s).
|
|
movingMedium('moving_medium', 15, 60),
|
|
|
|
/// In Bewegung, schnell (Geschwindigkeit >= 17 m/s).
|
|
movingFast('moving_fast', 30, 120);
|
|
|
|
const TrackState(
|
|
this.label,
|
|
this.intervalWithJobSeconds,
|
|
this.intervalWithoutJobSeconds,
|
|
);
|
|
|
|
/// Im JSON übertragenes String-Label des Zustands.
|
|
final String label;
|
|
|
|
/// Meldeintervall in Sekunden, wenn ein Auftrag aktiv ist.
|
|
final int intervalWithJobSeconds;
|
|
|
|
/// Meldeintervall in Sekunden ohne aktiven Auftrag.
|
|
final int intervalWithoutJobSeconds;
|
|
|
|
/// Liefert das passende Meldeintervall abhängig davon, ob ein Auftrag aktiv ist.
|
|
int intervalSeconds({required bool withJob}) =>
|
|
withJob ? intervalWithJobSeconds : intervalWithoutJobSeconds;
|
|
}
|
|
|
|
/// Feste Parameter für die Zustandsbestimmung des Trackings.
|
|
class TrackTuning {
|
|
TrackTuning._();
|
|
|
|
/// Feste Sampling-Rate = kleinste vorkommende Intervallzeit (15 s).
|
|
static const Duration samplingInterval = Duration(seconds: 15);
|
|
|
|
/// Obergrenze (exklusiv) für "langsam" in m/s.
|
|
static const double movingSlowMaxSpeed = 1.5;
|
|
|
|
/// Obergrenze (exklusiv) für "mittel" in m/s.
|
|
static const double movingMediumMaxSpeed = 17.0;
|
|
|
|
/// Vorlaufzeit, ab der ein akzeptierter Auftrag als aktiv gilt (15 min vor ordertime).
|
|
static const int activeJobLeadSeconds = 15 * 60;
|
|
}
|