lte service (backend) and ui handling

This commit is contained in:
Mikkeli Matlock
2026-02-09 02:36:03 +09:00
parent 12a0d58800
commit 47b3427e63
5 changed files with 261 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
// WebSocket stream subscriptions
StreamSubscription<ArduinoData>? _arduinoSub;
StreamSubscription<GpsData>? _gpsSub;
StreamSubscription<LteData>? _lteSub;
StreamSubscription<WsConnectionState>? _connectionSub;
// Pi temperature - direct file read (safety critical)
@@ -114,6 +115,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
});
});
// Subscribe to LTE data stream
_lteSub = WebSocketService.instance.lteStream.listen((data) {
setState(() {
_lteSignal = data.signal;
});
});
// Subscribe to connection state
_connectionSub = WebSocketService.instance.connectionStream.listen((state) {
setState(() {
@@ -151,8 +159,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
_wsState = WebSocketService.instance.connectionState;
// Placeholder: LTE signal (TODO: wire up when LTE service exists)
_lteSignal = null;
// Init from cached LTE data
final cachedLte = WebSocketService.instance.latestLte;
if (cachedLte != null) {
_lteSignal = cachedLte.signal;
}
// DEBUG: flip-flop theme + navigator every 2s
TestFlipFlopService.instance.start(navigatorKey: _navigatorKey);
@@ -163,6 +174,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
_piTempTimer?.cancel();
_arduinoSub?.cancel();
_gpsSub?.cancel();
_lteSub?.cancel();
_connectionSub?.cancel();
TestFlipFlopService.instance.stop();
super.dispose();