@mojro/react-native-gnss-tracking-health 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,245 @@
1
+ import { DeviceEventEmitter, Platform } from "react-native";
2
+ import { getLogger } from "./utils/logger";
3
+
4
+ /**
5
+ * Thin Android-only wrapper around peer dep react-native-gnss-status-checker.
6
+ * iOS returns unsupported snapshots so consumers stay cross-platform safe.
7
+ */
8
+ class GnssMonitor {
9
+ #listening = false;
10
+ #latestStatus = null;
11
+ #listeners = [];
12
+ #module = null;
13
+ #moduleLoadAttempted = false;
14
+ #lastCn0LogAt = 0;
15
+
16
+ #loadModule() {
17
+ if (this.#moduleLoadAttempted) {
18
+ return this.#module;
19
+ }
20
+ this.#moduleLoadAttempted = true;
21
+ if (Platform.OS !== "android") {
22
+ return null;
23
+ }
24
+ try {
25
+ // eslint-disable-next-line global-require
26
+ this.#module = require("react-native-gnss-status-checker");
27
+ } catch (error) {
28
+ getLogger().warn("GNSS module unavailable:", error?.message);
29
+ this.#module = null;
30
+ }
31
+ return this.#module;
32
+ }
33
+
34
+ get isSupported() {
35
+ return Platform.OS === "android" && !!this.#loadModule();
36
+ }
37
+
38
+ get isListening() {
39
+ return this.#listening;
40
+ }
41
+
42
+ getLatestStatus() {
43
+ return this.#latestStatus;
44
+ }
45
+
46
+ async getSnapshot() {
47
+ const mod = this.#loadModule();
48
+ if (!mod?.getGNSSStatus) {
49
+ return this.#unsupportedSnapshot();
50
+ }
51
+ try {
52
+ const status = await mod.getGNSSStatus();
53
+ this.#latestStatus = this.#normalizeStatus(status, "getGNSSStatus");
54
+ return this.#latestStatus;
55
+ } catch (error) {
56
+ getLogger().warn("getGNSSStatus failed:", error?.message);
57
+ return {
58
+ ...this.#unsupportedSnapshot(),
59
+ error: error?.message || "getGNSSStatus failed",
60
+ };
61
+ }
62
+ }
63
+
64
+ async start() {
65
+ if (this.#listening) {
66
+ return true;
67
+ }
68
+ const mod = this.#loadModule();
69
+ if (!mod?.startListening) {
70
+ getLogger().warn("GNSS start skipped — module missing");
71
+ return false;
72
+ }
73
+
74
+ try {
75
+ await mod.startListening();
76
+ this.#listening = true;
77
+
78
+ const satelliteListener = DeviceEventEmitter.addListener(
79
+ "onSatelliteStatusChanged",
80
+ (data) => {
81
+ this.#latestStatus = {
82
+ ...(this.#latestStatus || {}),
83
+ ...this.#normalizeStatus(data, "onSatelliteStatusChanged"),
84
+ updatedAt: Date.now(),
85
+ };
86
+ this.#emitStatus();
87
+ }
88
+ );
89
+
90
+ const measurementListener = DeviceEventEmitter.addListener(
91
+ "onMeasurementsChanged",
92
+ (data) => {
93
+ this.#latestStatus = {
94
+ ...(this.#latestStatus || {}),
95
+ carrierFrequencies: data?.carrierFrequencies || [],
96
+ isDualFrequencySupported: !!data?.isDualFrequencySupported,
97
+ updatedAt: Date.now(),
98
+ };
99
+ this.#emitStatus();
100
+ }
101
+ );
102
+
103
+ this.#listeners = [satelliteListener, measurementListener];
104
+ this.getSnapshot().catch(() => {});
105
+ return true;
106
+ } catch (error) {
107
+ this.#listening = false;
108
+ getLogger().warn("startListening failed:", error?.message);
109
+ return false;
110
+ }
111
+ }
112
+
113
+ async stop() {
114
+ if (!this.#listening) {
115
+ return;
116
+ }
117
+ this.#listeners.forEach((sub) => {
118
+ try {
119
+ sub?.remove?.();
120
+ } catch (e) {}
121
+ });
122
+ this.#listeners = [];
123
+ this.#listening = false;
124
+
125
+ const mod = this.#loadModule();
126
+ if (mod?.stopListening) {
127
+ try {
128
+ await mod.stopListening();
129
+ } catch (error) {
130
+ getLogger().warn("stopListening failed:", error?.message);
131
+ }
132
+ }
133
+ }
134
+
135
+ onStatus(callback) {
136
+ if (typeof callback !== "function") {
137
+ return () => {};
138
+ }
139
+ const subscription = DeviceEventEmitter.addListener(
140
+ "TrackingQuality:gnssMonitor",
141
+ callback
142
+ );
143
+ return () => subscription.remove();
144
+ }
145
+
146
+ #emitStatus() {
147
+ DeviceEventEmitter.emit("TrackingQuality:gnssMonitor", this.#latestStatus);
148
+ }
149
+
150
+ #resolveAverageCn0(raw = {}, source = "unknown") {
151
+ const satellites = Array.isArray(raw.satellites) ? raw.satellites : [];
152
+ const cn0Values = satellites
153
+ .map((sat) => Number(sat?.cn0DbHz))
154
+ .filter((n) => Number.isFinite(n) && n > 0);
155
+
156
+ const reported = Number(raw.averageSignalToNoiseRatio);
157
+ const computedFromSats =
158
+ cn0Values.length > 0
159
+ ? cn0Values.reduce((sum, n) => sum + n, 0) / cn0Values.length
160
+ : null;
161
+
162
+ let helperAverage = null;
163
+ try {
164
+ const mod = this.#loadModule();
165
+ if (mod?.getSatelliteStatistics && satellites.length > 0) {
166
+ const stats = mod.getSatelliteStatistics(satellites);
167
+ helperAverage = Number(stats?.averageSignalStrength);
168
+ if (!Number.isFinite(helperAverage) || helperAverage <= 0) {
169
+ helperAverage = null;
170
+ }
171
+ }
172
+ } catch (e) {}
173
+
174
+ const resolved =
175
+ (Number.isFinite(reported) && reported > 0 && reported) ||
176
+ helperAverage ||
177
+ computedFromSats ||
178
+ 0;
179
+
180
+ const now = Date.now();
181
+ if (resolved === 0 || now - this.#lastCn0LogAt > 5000) {
182
+ this.#lastCn0LogAt = now;
183
+ getLogger().log("C/N0 diagnostic", {
184
+ source,
185
+ reported,
186
+ helperAverage,
187
+ computedFromSats,
188
+ resolved,
189
+ satsWithCn0: cn0Values.length,
190
+ });
191
+ }
192
+
193
+ return resolved;
194
+ }
195
+
196
+ #normalizeStatus(raw = {}, source = "unknown") {
197
+ const satellitesVisible = Number(
198
+ raw.satellitesVisible ?? raw.satellites?.length ?? 0
199
+ );
200
+ const satellitesUsedInFix = Number(raw.satellitesUsedInFix ?? 0);
201
+ const averageSignalToNoiseRatio = this.#resolveAverageCn0(raw, source);
202
+
203
+ return {
204
+ isGNSSSupported: raw.isGNSSSupported !== false,
205
+ isDualFrequencySupported: !!raw.isDualFrequencySupported,
206
+ isNavICSupported: !!raw.isNavICSupported,
207
+ satellitesVisible: Number.isFinite(satellitesVisible)
208
+ ? satellitesVisible
209
+ : 0,
210
+ satellitesUsedInFix: Number.isFinite(satellitesUsedInFix)
211
+ ? satellitesUsedInFix
212
+ : 0,
213
+ averageSignalToNoiseRatio,
214
+ supportedConstellations: raw.supportedConstellations || [],
215
+ carrierFrequencies: raw.carrierFrequencies || [],
216
+ satellites: raw.satellites || [],
217
+ apiLevel: raw.apiLevel,
218
+ supportsCn0: raw.supportsCn0,
219
+ supportsCarrierFreq: raw.supportsCarrierFreq,
220
+ platform: Platform.OS,
221
+ updatedAt: Date.now(),
222
+ };
223
+ }
224
+
225
+ #unsupportedSnapshot() {
226
+ return {
227
+ isGNSSSupported: false,
228
+ isDualFrequencySupported: false,
229
+ isNavICSupported: false,
230
+ satellitesVisible: 0,
231
+ satellitesUsedInFix: 0,
232
+ averageSignalToNoiseRatio: 0,
233
+ supportedConstellations: [],
234
+ carrierFrequencies: [],
235
+ satellites: [],
236
+ platform: Platform.OS,
237
+ unsupported: true,
238
+ updatedAt: Date.now(),
239
+ };
240
+ }
241
+ }
242
+
243
+ const gnssMonitor = new GnssMonitor();
244
+ export default gnssMonitor;
245
+ export { GnssMonitor };
@@ -0,0 +1,65 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import trackingQualityMonitor from "../TrackingQualityMonitor";
3
+ import { assessDeviceFitness, getAndroidApiLevel } from "../deviceFitness";
4
+ import { collectSystemHealth } from "../systemHealth";
5
+ import GnssMonitor from "../gnssMonitor";
6
+
7
+ /**
8
+ * Independent device-fitness hook (no continuous GNSS required).
9
+ */
10
+ export function useDeviceFitness({ evaluateOnMount = true } = {}) {
11
+ const [fitness, setFitness] = useState(null);
12
+ const [loading, setLoading] = useState(!!evaluateOnMount);
13
+ const [error, setError] = useState(null);
14
+
15
+ const evaluate = useCallback(async () => {
16
+ setLoading(true);
17
+ setError(null);
18
+ try {
19
+ const result = await trackingQualityMonitor.evaluateDeviceFitness();
20
+ setFitness(result);
21
+ return result;
22
+ } catch (e) {
23
+ // Fallback without monitor orchestration
24
+ try {
25
+ const systemHealth = await collectSystemHealth();
26
+ const snapshot = await GnssMonitor.getSnapshot();
27
+ const snapshotFailed =
28
+ !!snapshot?.error || snapshot?.unsupported === true;
29
+ const result = assessDeviceFitness({
30
+ apiLevel: getAndroidApiLevel(),
31
+ systemHealth,
32
+ gnssCapabilityFlags: {
33
+ isGNSSSupported: snapshotFailed ? null : snapshot?.isGNSSSupported,
34
+ supportsCn0: snapshot?.supportsCn0,
35
+ supportsCarrierFreq: snapshot?.supportsCarrierFreq,
36
+ isDualFrequencySupported: snapshot?.isDualFrequencySupported,
37
+ },
38
+ });
39
+ setFitness(result);
40
+ return result;
41
+ } catch (inner) {
42
+ setError(inner);
43
+ throw inner;
44
+ }
45
+ } finally {
46
+ setLoading(false);
47
+ }
48
+ }, []);
49
+
50
+ useEffect(() => {
51
+ if (evaluateOnMount) {
52
+ evaluate().catch(() => {});
53
+ }
54
+ }, [evaluateOnMount, evaluate]);
55
+
56
+ return {
57
+ fitness,
58
+ loading,
59
+ error,
60
+ evaluate,
61
+ apiLevel: fitness?.apiLevel ?? getAndroidApiLevel(),
62
+ capableForTracking: !!fitness?.capableForTracking,
63
+ settingsIssues: fitness?.settingsIssues || [],
64
+ };
65
+ }
@@ -0,0 +1,54 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { collectSystemHealth } from "../systemHealth";
3
+
4
+ /**
5
+ * Independent system-health hook.
6
+ */
7
+ export function useSystemHealth({ refreshOnMount = true, intervalMs = 0 } = {}) {
8
+ const [health, setHealth] = useState(null);
9
+ const [loading, setLoading] = useState(!!refreshOnMount);
10
+ const [error, setError] = useState(null);
11
+
12
+ const refresh = useCallback(async () => {
13
+ setLoading(true);
14
+ setError(null);
15
+ try {
16
+ const result = await collectSystemHealth();
17
+ setHealth(result);
18
+ return result;
19
+ } catch (e) {
20
+ setError(e);
21
+ throw e;
22
+ } finally {
23
+ setLoading(false);
24
+ }
25
+ }, []);
26
+
27
+ useEffect(() => {
28
+ if (refreshOnMount) {
29
+ refresh().catch(() => {});
30
+ }
31
+ }, [refreshOnMount, refresh]);
32
+
33
+ useEffect(() => {
34
+ if (!intervalMs || intervalMs < 1000) {
35
+ return undefined;
36
+ }
37
+ const id = setInterval(() => {
38
+ refresh().catch(() => {});
39
+ }, intervalMs);
40
+ return () => clearInterval(id);
41
+ }, [intervalMs, refresh]);
42
+
43
+ return {
44
+ health,
45
+ loading,
46
+ error,
47
+ refresh,
48
+ batteryLevel: health?.batteryLevel,
49
+ lowPowerMode: !!health?.lowPowerMode,
50
+ batteryOptimizationEnabled: !!health?.batteryOptimizationEnabled,
51
+ backgroundTrackingRestricted: !!health?.backgroundTrackingRestricted,
52
+ badTimeOrTimezone: !!health?.badTimeOrTimezone,
53
+ };
54
+ }
@@ -0,0 +1,42 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { validateTimeAndTimezone } from "../timeValidation";
3
+
4
+ /**
5
+ * Standalone time / timezone validation hook.
6
+ */
7
+ export function useTimeValidation({ validateOnMount = true } = {}) {
8
+ const [result, setResult] = useState(null);
9
+ const [loading, setLoading] = useState(!!validateOnMount);
10
+ const [error, setError] = useState(null);
11
+
12
+ const validate = useCallback(async (options) => {
13
+ setLoading(true);
14
+ setError(null);
15
+ try {
16
+ const next = await validateTimeAndTimezone(options);
17
+ setResult(next);
18
+ return next;
19
+ } catch (e) {
20
+ setError(e);
21
+ throw e;
22
+ } finally {
23
+ setLoading(false);
24
+ }
25
+ }, []);
26
+
27
+ useEffect(() => {
28
+ if (validateOnMount) {
29
+ validate().catch(() => {});
30
+ }
31
+ }, [validateOnMount, validate]);
32
+
33
+ return {
34
+ result,
35
+ loading,
36
+ error,
37
+ validate,
38
+ autoDateTimeEnabled: result?.autoDateTimeEnabled,
39
+ clockSkewed: !!result?.clockSkewed,
40
+ badTimeOrTimezone: !!result?.badTimeOrTimezone,
41
+ };
42
+ }
@@ -0,0 +1,265 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ import trackingQualityMonitor from "../TrackingQualityMonitor";
3
+
4
+ const DEFAULT_MAX_LOG_LINES = 200;
5
+ const DEFAULT_GNSS_LOG_THROTTLE_MS = 2000;
6
+
7
+ /**
8
+ * Full tracking-quality monitoring hook for screens / host apps.
9
+ *
10
+ * Mirrors the driver-app TrackingQualityPoc surface:
11
+ * - live status (fitness, GNSS, system, trip window)
12
+ * - alerts + actions
13
+ * - throttled GNSS / system live log lines
14
+ * - Start / Stop / trip / fitness / tracking-active controls
15
+ *
16
+ * Host still owns BGGeolocation; call `setLocationTrackingActive` when
17
+ * native tracking starts/stops, and `ingestLocation` / `heartbeat` from
18
+ * the tracker (or wire those in your BGGeolocation wrapper).
19
+ */
20
+ export function useTrackingMonitor({
21
+ autoStart = false,
22
+ tripId = null,
23
+ maxLogLines = DEFAULT_MAX_LOG_LINES,
24
+ gnssLogThrottleMs = DEFAULT_GNSS_LOG_THROTTLE_MS,
25
+ } = {}) {
26
+ const [status, setStatus] = useState(() =>
27
+ trackingQualityMonitor.getStatus()
28
+ );
29
+ const [lastAlert, setLastAlert] = useState(null);
30
+ const [lastAction, setLastAction] = useState(null);
31
+ const [logs, setLogs] = useState([]);
32
+
33
+ const lastGnssLogAtRef = useRef(0);
34
+ const lastGnssSigRef = useRef("");
35
+ const lastSystemSigRef = useRef("");
36
+ const lastTripWindowSigRef = useRef("");
37
+
38
+ const appendLog = useCallback(
39
+ (level, message) => {
40
+ setLogs((prev) => {
41
+ const next = [
42
+ {
43
+ id: `${Date.now()}-${prev.length}`,
44
+ at: Date.now(),
45
+ level,
46
+ message,
47
+ },
48
+ ...prev,
49
+ ];
50
+ return next.slice(0, maxLogLines);
51
+ });
52
+ },
53
+ [maxLogLines]
54
+ );
55
+
56
+ useEffect(() => {
57
+ appendLog(
58
+ "info",
59
+ "Tracking monitor hook active — start monitor / tracking for live data"
60
+ );
61
+
62
+ const unsubStatus = trackingQualityMonitor.onStatus((next) => {
63
+ setStatus(next);
64
+
65
+ const gnss = next?.latestGnss;
66
+ if (gnss && !gnss.unsupported) {
67
+ const cn0 =
68
+ gnss.averageSignalToNoiseRatio != null
69
+ ? Number(gnss.averageSignalToNoiseRatio).toFixed(1)
70
+ : "n/a";
71
+ const sig = [
72
+ gnss.satellitesVisible,
73
+ gnss.satellitesUsedInFix,
74
+ cn0,
75
+ (gnss.supportedConstellations || []).join("|"),
76
+ gnss.isDualFrequencySupported ? 1 : 0,
77
+ gnss.isNavICSupported ? 1 : 0,
78
+ ].join(":");
79
+
80
+ const now = Date.now();
81
+ const changed = sig !== lastGnssSigRef.current;
82
+ const due = now - lastGnssLogAtRef.current >= gnssLogThrottleMs;
83
+ if (changed && due) {
84
+ lastGnssSigRef.current = sig;
85
+ lastGnssLogAtRef.current = now;
86
+ appendLog(
87
+ "gnss",
88
+ `sats ${gnss.satellitesVisible ?? "?"} visible / ${
89
+ gnss.satellitesUsedInFix ?? "?"
90
+ } used | C/N0 ${cn0} | ${
91
+ (gnss.supportedConstellations || []).join(",") || "—"
92
+ } | dual=${!!gnss.isDualFrequencySupported} navic=${!!gnss.isNavICSupported}`
93
+ );
94
+ }
95
+ }
96
+
97
+ const system = next?.latestSystem;
98
+ if (system?.checkedAt) {
99
+ const sysSig = [
100
+ system.batteryLevel,
101
+ system.powerSaveMode ? 1 : 0,
102
+ system.lowPowerMode ? 1 : 0,
103
+ system.batteryOptimizationEnabled ? 1 : 0,
104
+ system.backgroundTrackingRestricted ? 1 : 0,
105
+ system.clockSkewed ? 1 : 0,
106
+ system.autoDateTimeEnabled,
107
+ ].join(":");
108
+ if (sysSig !== lastSystemSigRef.current) {
109
+ lastSystemSigRef.current = sysSig;
110
+ appendLog(
111
+ "system",
112
+ `batt ${system.batteryLevel ?? "?"}% | LPM=${!!system.lowPowerMode} powerSave=${!!system.powerSaveMode} battOpt=${!!system.batteryOptimizationEnabled} bgRestricted=${!!system.backgroundTrackingRestricted} clockSkew=${!!system.clockSkewed} autoTime=${
113
+ system.autoDateTimeEnabled == null
114
+ ? "n/a"
115
+ : String(system.autoDateTimeEnabled)
116
+ }`
117
+ );
118
+ }
119
+ }
120
+
121
+ const tripSig = `${next?.tripId || ""}:${next?.tripStartMaxSats ?? 0}:${
122
+ next?.tripStartSatWindowFired ? 1 : 0
123
+ }:${next?.running ? 1 : 0}:${next?.locationTrackingActive ? 1 : 0}`;
124
+ if (tripSig !== lastTripWindowSigRef.current) {
125
+ const prev = lastTripWindowSigRef.current;
126
+ lastTripWindowSigRef.current = tripSig;
127
+ if (prev) {
128
+ appendLog(
129
+ "info",
130
+ `trip=${next?.tripId || "—"} running=${!!next?.running} tracking=${!!next?.locationTrackingActive} maxSats=${
131
+ next?.tripStartMaxSats ?? 0
132
+ } windowFired=${!!next?.tripStartSatWindowFired}`
133
+ );
134
+ }
135
+ }
136
+ });
137
+
138
+ const unsubAlert = trackingQualityMonitor.onAlert((alert) => {
139
+ setLastAlert(alert);
140
+ appendLog(
141
+ "alert",
142
+ `${alert?.type || "ALERT"} [${alert?.severity || "?"}] ${
143
+ alert?.message || ""
144
+ }`
145
+ );
146
+ });
147
+
148
+ const unsubAction = trackingQualityMonitor.onAction((action) => {
149
+ setLastAction(action);
150
+ appendLog(
151
+ "action",
152
+ `[${action?.type || "ACTION"}] ${action?.message || ""}`
153
+ );
154
+ });
155
+
156
+ setStatus(trackingQualityMonitor.getStatus());
157
+
158
+ let cancelled = false;
159
+ if (autoStart) {
160
+ trackingQualityMonitor
161
+ .start({ tripId })
162
+ .then((s) => {
163
+ if (!cancelled) setStatus(s);
164
+ })
165
+ .catch(() => {});
166
+ }
167
+
168
+ return () => {
169
+ cancelled = true;
170
+ unsubStatus();
171
+ unsubAlert();
172
+ unsubAction();
173
+ };
174
+ }, [appendLog, autoStart, gnssLogThrottleMs, tripId]);
175
+
176
+ const clearLogs = useCallback(() => {
177
+ setLogs([]);
178
+ lastGnssSigRef.current = "";
179
+ lastSystemSigRef.current = "";
180
+ lastTripWindowSigRef.current = "";
181
+ lastGnssLogAtRef.current = 0;
182
+ appendLog("info", "Logs cleared");
183
+ }, [appendLog]);
184
+
185
+ const refresh = useCallback(() => {
186
+ setStatus(trackingQualityMonitor.getStatus());
187
+ appendLog("info", "Manual refresh");
188
+ }, [appendLog]);
189
+
190
+ const start = useCallback(async (opts = {}) => {
191
+ const s = await trackingQualityMonitor.start(opts);
192
+ setStatus(s);
193
+ return s;
194
+ }, []);
195
+
196
+ const stop = useCallback(async (opts = {}) => {
197
+ await trackingQualityMonitor.stop(opts);
198
+ setStatus(trackingQualityMonitor.getStatus());
199
+ }, []);
200
+
201
+ const onTripStarted = useCallback((id) => {
202
+ trackingQualityMonitor.onTripStarted(id);
203
+ setStatus(trackingQualityMonitor.getStatus());
204
+ }, []);
205
+
206
+ const ingestLocation = useCallback((location) => {
207
+ trackingQualityMonitor.ingestLocation(location);
208
+ }, []);
209
+
210
+ const evaluateDeviceFitness = useCallback(async (opts) => {
211
+ const fit = await trackingQualityMonitor.evaluateDeviceFitness(opts);
212
+ setStatus(trackingQualityMonitor.getStatus());
213
+ return fit;
214
+ }, []);
215
+
216
+ const evaluateDeviceFitnessOnLogin = useCallback(async (opts) => {
217
+ const fit = await trackingQualityMonitor.evaluateDeviceFitnessOnLogin(opts);
218
+ setStatus(trackingQualityMonitor.getStatus());
219
+ return fit;
220
+ }, []);
221
+
222
+ const setLocationTrackingActive = useCallback((active) => {
223
+ trackingQualityMonitor.setLocationTrackingActive(active);
224
+ setStatus(trackingQualityMonitor.getStatus());
225
+ }, []);
226
+
227
+ const heartbeat = useCallback(() => {
228
+ trackingQualityMonitor.heartbeat();
229
+ }, []);
230
+
231
+ return {
232
+ status,
233
+ running: !!status?.running,
234
+ locationTrackingActive: !!status?.locationTrackingActive,
235
+ platform: status?.platform,
236
+ apiLevel: status?.apiLevel,
237
+ gnssSupported: !!status?.gnssSupported,
238
+ gnssListening: !!status?.gnssListening,
239
+ tripId: status?.tripId,
240
+ tripStartMaxSats: status?.tripStartMaxSats,
241
+ tripStartSatWindowFired: !!status?.tripStartSatWindowFired,
242
+ deviceFitness: status?.deviceFitness,
243
+ latestGnss: status?.latestGnss,
244
+ latestSystem: status?.latestSystem,
245
+ lastLocation: status?.lastLocation,
246
+ recentAlerts: status?.recentAlerts || [],
247
+ thresholds: status?.thresholds,
248
+ lastAlert,
249
+ lastAction,
250
+ logs,
251
+ appendLog,
252
+ clearLogs,
253
+ refresh,
254
+ start,
255
+ stop,
256
+ onTripStarted,
257
+ ingestLocation,
258
+ evaluateDeviceFitness,
259
+ evaluateDeviceFitnessOnLogin,
260
+ setLocationTrackingActive,
261
+ heartbeat,
262
+ getStatus: () => trackingQualityMonitor.getStatus(),
263
+ monitor: trackingQualityMonitor,
264
+ };
265
+ }