summaryrefslogtreecommitdiffstats
path: root/lib/vehicle-signals
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vehicle-signals')
-rw-r--r--lib/vehicle-signals/intial_connection.dart38
-rw-r--r--lib/vehicle-signals/onBoarding_page.dart61
-rw-r--r--lib/vehicle-signals/vehicle_config.dart39
-rw-r--r--lib/vehicle-signals/vehicle_methods.dart183
-rw-r--r--lib/vehicle-signals/vehicle_server_path.dart44
-rw-r--r--lib/vehicle-signals/vss_providers.dart402
6 files changed, 767 insertions, 0 deletions
diff --git a/lib/vehicle-signals/intial_connection.dart b/lib/vehicle-signals/intial_connection.dart
new file mode 100644
index 0000000..8e79979
--- /dev/null
+++ b/lib/vehicle-signals/intial_connection.dart
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: Apache-2.0
+import 'dart:io';
+import 'package:dashboard_app/vehicle-signals/vehicle_config.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import 'onBoarding_page.dart';
+
+class InitialScreen extends ConsumerWidget {
+ InitialScreen({Key? key, required this.client}) : super(key: key);
+ final HttpClient client;
+ late WebSocket socket;
+
+ @override
+ Widget build(BuildContext context, ref) {
+ final sockConnect = ref.watch(sockConnectprovider(client));
+
+ return sockConnect.when(
+ data: (socket) {
+ this.socket = socket;
+ this.socket.pingInterval = const Duration(seconds: 2);
+ return OnBoardingPage(client: client, socket: this.socket);
+ },
+ error: (e, stk) {
+ print(e);
+ ref.refresh(sockConnectprovider(client));
+ return const Scaffold(
+ backgroundColor: Colors.black,
+ body: Center(child: Text('error',style: TextStyle(color: Colors.white),)),
+ );
+ },
+ loading: () => const Scaffold(
+ backgroundColor: Colors.black,
+ body: Center(child: Text('loading',style: TextStyle(color: Colors.white))),
+ ),
+ );
+ }
+} \ No newline at end of file
diff --git a/lib/vehicle-signals/onBoarding_page.dart b/lib/vehicle-signals/onBoarding_page.dart
new file mode 100644
index 0000000..6009c54
--- /dev/null
+++ b/lib/vehicle-signals/onBoarding_page.dart
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: Apache-2.0
+import 'dart:async';
+import 'dart:io';
+
+import 'package:dashboard_app/vehicle-signals/vehicle_config.dart';
+import 'package:dashboard_app/vehicle-signals/vehicle_methods.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../HomePage.dart';
+
+class OnBoardingPage extends ConsumerStatefulWidget {
+ const OnBoardingPage({Key? key, required this.client, required this.socket})
+ : super(key: key);
+ final WebSocket socket;
+ final HttpClient client;
+
+ @override
+ ConsumerState<OnBoardingPage> createState() => _OnBoardingPageState();
+}
+
+class _OnBoardingPageState extends ConsumerState<OnBoardingPage> {
+ late Timer _timer;
+
+
+ @override
+ void initState() {
+ super.initState();
+ VISS.init(widget.socket,ref);
+ _timer = Timer.periodic(const Duration(seconds: 2), (timer) {
+
+ if (widget.socket.readyState == 3) {
+ ref.refresh(sockConnectprovider(widget.client));
+ }
+ });
+ WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
+ widget.socket.listen(
+ (data) {
+ VISS.parseData(ref, data);
+
+ },
+ onError: (e, stk) {
+ print(e.toString());
+ ref.refresh(sockConnectprovider(widget.client));
+ },
+ );
+ });
+ }
+
+ @override
+ void dispose() {
+ super.dispose();
+ _timer.cancel();
+ widget.socket.close(786887, "Connection lost with server!");
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return const HomePage();
+ }
+} \ No newline at end of file
diff --git a/lib/vehicle-signals/vehicle_config.dart b/lib/vehicle-signals/vehicle_config.dart
new file mode 100644
index 0000000..59682c4
--- /dev/null
+++ b/lib/vehicle-signals/vehicle_config.dart
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:dashboard_app/config.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:http/http.dart' as http;
+
+
+
+final sockConnectprovider = FutureProvider.family<WebSocket, HttpClient>(
+ (ref, client) => connect(client,ref));
+
+
+
+Future<HttpClient> initializeClient() async {
+
+
+ SecurityContext ctx = SecurityContext.defaultContext;
+
+ HttpClient client = HttpClient(context: ctx)
+ ..findProxy = null
+ ..badCertificateCallback = (cert, host, port) {
+ return true;
+ };
+ return client;
+}
+
+
+
+Future<WebSocket> connect(HttpClient client, ref) async {
+ final config = ref.read(ConfigStateprovider);
+ WebSocket socket = await WebSocket.connect(
+ "wss://${config.hostname}:${config.port}",
+ customClient: client);
+ return socket;
+}
+
+
diff --git a/lib/vehicle-signals/vehicle_methods.dart b/lib/vehicle-signals/vehicle_methods.dart
new file mode 100644
index 0000000..8259450
--- /dev/null
+++ b/lib/vehicle-signals/vehicle_methods.dart
@@ -0,0 +1,183 @@
+// SPDX-License-Identifier: Apache-2.0
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:dashboard_app/vehicle-signals/vss_providers.dart';
+import 'package:dashboard_app/vehicle-signals/vehicle_server_path.dart';
+import 'package:dashboard_app/config.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+class VISS {
+ static const requestId = "test-id";
+ static void init(WebSocket socket, WidgetRef ref) {
+ authorize(socket, ref);
+ subscribe(socket, ref, VSSPath.vehicleSpeed);
+ subscribe(socket, ref, VSSPath.vehicleEngineSpeed);
+ subscribe(socket, ref, VSSPath.vehicleFuelLevel);
+ subscribe(socket, ref, VSSPath.vehicleFrontLeftTire);
+ subscribe(socket, ref, VSSPath.vehicleFrontRightTire);
+ subscribe(socket, ref, VSSPath.vehicleRearLeftTire);
+ subscribe(socket, ref, VSSPath.vehicleRearRightTire);
+ subscribe(socket, ref, VSSPath.vehicleIsChildLockActiveLeft);
+ subscribe(socket, ref, VSSPath.vehicleIsChildLockActiveRight);
+ subscribe(socket, ref, VSSPath.vehicleFuelRate);
+ subscribe(socket, ref, VSSPath.vehicleInsideTemperature);
+ subscribe(socket, ref, VSSPath.vehicleOutsideTemperature);
+ }
+
+ static void update(WebSocket socket, WidgetRef ref) {
+ get(socket, ref, VSSPath.vehicleSpeed);
+ get(socket, ref, VSSPath.vehicleEngineSpeed);
+ get(socket, ref, VSSPath.vehicleFuelLevel);
+ get(socket, ref, VSSPath.vehicleOutsideTemperature);
+ get(socket, ref, VSSPath.vehicleFrontLeftTire);
+ get(socket, ref, VSSPath.vehicleFrontRightTire);
+ get(socket, ref, VSSPath.vehicleRearLeftTire);
+ get(socket, ref, VSSPath.vehicleRearRightTire);
+ get(socket, ref, VSSPath.vehicleIsChildLockActiveLeft);
+ get(socket, ref, VSSPath.vehicleIsChildLockActiveRight);
+ get(socket, ref, VSSPath.vehicleFuelRate);
+ get(socket, ref, VSSPath.vehicleInsideTemperature);
+ }
+
+ static void authorize(WebSocket socket, WidgetRef ref) {
+ final config = ref.read(ConfigStateprovider);
+
+ Map<String, dynamic> map = {
+ "action": "authorize",
+ "tokens": config.kuksaAuthToken,
+ "requestId": requestId
+ };
+ socket.add(jsonEncode(map));
+ }
+
+ static void get(WebSocket socket, WidgetRef ref, String path) {
+ final config = ref.read(ConfigStateprovider);
+
+ Map<String, dynamic> map = {
+ "action": "get",
+ "tokens": config.kuksaAuthToken,
+ "path": path,
+ "requestId": requestId
+ };
+ socket.add(jsonEncode(map));
+ }
+
+ static void set(WebSocket socket, WidgetRef ref, String path, String value) {
+ final config = ref.read(ConfigStateprovider);
+ Map<String, dynamic> map = {
+ "action": "set",
+ "tokens": config.kuksaAuthToken,
+ "path": path,
+ "requestId": requestId,
+ "value": value
+ };
+ socket.add(jsonEncode(map));
+ }
+
+ static void subscribe(WebSocket socket, WidgetRef ref, String path) {
+ final config = ref.read(ConfigStateprovider);
+
+ Map<String, dynamic> map = {
+ "action": "subscribe",
+ "tokens": config.kuksaAuthToken,
+ "path": path,
+ "requestId": requestId
+ };
+ socket.add(jsonEncode(map));
+ }
+
+ static void parseData(WidgetRef ref, String data) {
+ Map<String, dynamic> dataMap = jsonDecode(data);
+ if (dataMap["action"] == "subscription" || dataMap["action"] == "get") {
+ if (dataMap.containsKey("data")) {
+ if ((dataMap["data"] as Map<String, dynamic>).containsKey("dp") &&
+ (dataMap["data"] as Map<String, dynamic>).containsKey("path")) {
+ String path = dataMap["data"]["path"];
+ Map<String, dynamic> dp = dataMap["data"]["dp"];
+ if (dp.containsKey("value")) {
+ if (dp["value"] != "---") {
+ switch (path) {
+ case VSSPath.vehicleSpeed:
+ ref
+ .read(vehicleSignalSpeedProvider.notifier)
+ .update(speed: dp["value"]);
+ break;
+ case VSSPath.vehicleEngineSpeed:
+ ref
+ .read(vehicleSignalEngineSpeedProvider.notifier)
+ .update(speed: dp["value"].toDouble());
+ break;
+ case VSSPath.vehicleFuelLevel:
+ ref
+ .read(vehicleSignalFuelLevelProvider.notifier)
+ .update(level: dp["value"]);
+ break;
+ case VSSPath.vehicleFuelRate:
+ ref
+ .read(vehicleSignalFuelRateProvider.notifier)
+ .update(rate: dp["value"]);
+ break;
+ case VSSPath.vehicleFrontLeftTire:
+ ref
+ .read(vehicleSignalFrontLeftTirePressureProvider.notifier)
+ .update(pressure: dp["value"]);
+ break;
+ case VSSPath.vehicleFrontRightTire:
+ ref
+ .read(
+ vehicleSignalFrontRightTirePressureProvider.notifier)
+ .update(pressure: dp["value"]);
+ break;
+ case VSSPath.vehicleRearLeftTire:
+ ref
+ .read(vehicleSignalRearLeftTirePressureProvider.notifier)
+ .update(pressure: dp["value"]);
+ break;
+ case VSSPath.vehicleRearRightTire:
+ ref
+ .read(vehicleSignalRearRightTirePressureProvider.notifier)
+ .update(pressure: dp["value"]);
+ break;
+ case VSSPath.vehicleIsChildLockActiveLeft:
+ ref
+ .read(vehicleSignalLeftChildLockActiveProvider.notifier)
+ .update(engaged: dp["value"]);
+ break;
+ case VSSPath.vehicleIsChildLockActiveRight:
+ ref
+ .read(vehicleSignalRightChildLockActiveProvider.notifier)
+ .update(engaged: dp["value"]);
+ break;
+ case VSSPath.vehicleInsideTemperature:
+ ref
+ .read(vehicleSignalInsideTempProvider.notifier)
+ .update(temp: dp["value"]);
+ break;
+ case VSSPath.vehicleOutsideTemperature:
+ ref
+ .read(vehicleSignalOutsideTempProvider.notifier)
+ .update(temp: dp["value"]);
+ break;
+ default:
+ print("$path Not Available yet!");
+ }
+ } else {
+ print("ERROR:Value not available yet! Set Value of $path");
+ }
+ } else {
+ print("ERROR:'value': Key not found!");
+ }
+ } else if ((!dataMap["data"] as Map<String, dynamic>)
+ .containsKey("path")) {
+ print("ERROR:'path':key not found !");
+ } else if ((dataMap["data"] as Map<String, dynamic>)
+ .containsKey("dp")) {
+ print("ERROR:'dp':key not found !");
+ }
+ } else {
+ print("ERROR:'data':key not found!");
+ }
+ }
+ }
+}
diff --git a/lib/vehicle-signals/vehicle_server_path.dart b/lib/vehicle-signals/vehicle_server_path.dart
new file mode 100644
index 0000000..822e304
--- /dev/null
+++ b/lib/vehicle-signals/vehicle_server_path.dart
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: Apache-2.0
+class VSSPath {
+ static const String vehicleSpeed = "Vehicle.Speed";
+
+ static const String vehicleEngineSpeed =
+ "Vehicle.Powertrain.CombustionEngine.Speed";
+
+ static const String vehicleFuelLevel = "Vehicle.Powertrain.FuelSystem.Level";
+
+ static const String vehicleInsideTemperature =
+ "Vehicle.Cabin.HVAC.AmbientAirTemperature";
+
+ static const String vehicleOutsideTemperature =
+ "Vehicle.Exterior.AirTemperature";
+
+ static const String vehicleFrontLeftTire =
+ "Vehicle.Chassis.Axle.Row1.Wheel.Left.Tire.Pressure";
+
+ static const String vehicleFrontRightTire =
+ "Vehicle.Chassis.Axle.Row1.Wheel.Right.Tire.Pressure";
+
+ static const String vehicleRearLeftTire =
+ "Vehicle.Chassis.Axle.Row2.Wheel.Left.Tire.Pressure";
+
+ static const String vehicleRearRightTire =
+ "Vehicle.Chassis.Axle.Row2.Wheel.Right.Tire.Pressure";
+
+ static const String vehicleIsChildLockActiveLeft =
+ "Vehicle.Cabin.Door.Row2.Left.IsChildLockActive";
+
+ static const String vehicleIsChildLockActiveRight =
+ "Vehicle.Cabin.Door.Row2.Right.IsChildLockActive";
+
+ static const String vehicleCurrentLongitude =
+ "Vehicle.CurrentLocation.Longitude";
+
+ static const String vehicleCurrentLatitude =
+ "Vehicle.CurrentLocation.Latitude";
+
+ static const String vehicleFuelRate = "Vehicle.OBD.FuelRate";
+
+ static const String vehicleMediaVolume =
+ "Vehicle.Cabin.Infotainment.Media.Volume";
+}
diff --git a/lib/vehicle-signals/vss_providers.dart b/lib/vehicle-signals/vss_providers.dart
new file mode 100644
index 0000000..6900bdc
--- /dev/null
+++ b/lib/vehicle-signals/vss_providers.dart
@@ -0,0 +1,402 @@
+// SPDX-License-Identifier: Apache-2.0
+//import 'dart:ffi';
+//import 'dart:io';
+import 'package:meta/meta.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+// Vehicle Speed
+
+@immutable
+class VehicleSignalSpeed {
+ const VehicleSignalSpeed({required this.speed});
+
+ final double speed;
+
+ VehicleSignalSpeed copyWith({double? speed}) {
+ return VehicleSignalSpeed(speed: speed ?? this.speed);
+ }
+}
+
+class VehicleSignalSpeedNotifier extends StateNotifier<VehicleSignalSpeed> {
+ VehicleSignalSpeedNotifier() : super(_initialValue);
+
+ static final VehicleSignalSpeed _initialValue = VehicleSignalSpeed(speed: 60);
+
+ void update({double? speed}) {
+ state = state.copyWith(speed: speed);
+ }
+}
+
+final vehicleSignalSpeedProvider =
+ StateNotifierProvider<VehicleSignalSpeedNotifier, VehicleSignalSpeed>(
+ (ref) => VehicleSignalSpeedNotifier(),
+);
+
+// Engine Speed
+
+@immutable
+class VehicleSignalEngineSpeed {
+ const VehicleSignalEngineSpeed({required this.speed});
+
+ final double speed;
+
+ VehicleSignalEngineSpeed copyWith({double? speed}) {
+ return VehicleSignalEngineSpeed(speed: speed ?? this.speed);
+ }
+}
+
+class VehicleSignalEngineSpeedNotifier
+ extends StateNotifier<VehicleSignalEngineSpeed> {
+ VehicleSignalEngineSpeedNotifier() : super(_initialValue);
+
+ static final VehicleSignalEngineSpeed _initialValue =
+ VehicleSignalEngineSpeed(speed: 2000);
+
+ void update({double? speed}) {
+ state = state.copyWith(speed: speed);
+ }
+}
+
+final vehicleSignalEngineSpeedProvider = StateNotifierProvider<
+ VehicleSignalEngineSpeedNotifier, VehicleSignalEngineSpeed>(
+ (ref) => VehicleSignalEngineSpeedNotifier(),
+);
+
+// Fuel Level
+
+@immutable
+class VehicleSignalFuelLevel {
+ const VehicleSignalFuelLevel({required this.level});
+
+ final double level;
+
+ VehicleSignalFuelLevel copyWith({double? level}) {
+ return VehicleSignalFuelLevel(level: level ?? this.level);
+ }
+}
+
+class VehicleSignalFuelLevelNotifier
+ extends StateNotifier<VehicleSignalFuelLevel> {
+ VehicleSignalFuelLevelNotifier() : super(_initialValue);
+
+ static final VehicleSignalFuelLevel _initialValue =
+ VehicleSignalFuelLevel(level: 90);
+
+ void update({double? level}) {
+ state = state.copyWith(level: level);
+ }
+}
+
+final vehicleSignalFuelLevelProvider = StateNotifierProvider<
+ VehicleSignalFuelLevelNotifier, VehicleSignalFuelLevel>(
+ (ref) => VehicleSignalFuelLevelNotifier(),
+);
+
+// Fuel Rate
+
+@immutable
+class VehicleSignalFuelRate {
+ const VehicleSignalFuelRate({required this.rate});
+
+ final double rate;
+
+ VehicleSignalFuelRate copyWith({double? rate}) {
+ return VehicleSignalFuelRate(rate: rate ?? this.rate);
+ }
+}
+
+class VehicleSignalFuelRateNotifier
+ extends StateNotifier<VehicleSignalFuelRate> {
+ VehicleSignalFuelRateNotifier() : super(_initialValue);
+
+ static final VehicleSignalFuelRate _initialValue =
+ VehicleSignalFuelRate(rate: 21);
+
+ void update({double? rate}) {
+ state = state.copyWith(rate: rate);
+ }
+}
+
+final vehicleSignalFuelRateProvider =
+ StateNotifierProvider<VehicleSignalFuelRateNotifier, VehicleSignalFuelRate>(
+ (ref) => VehicleSignalFuelRateNotifier(),
+);
+
+// Front Left Tire Pressure
+
+@immutable
+class VehicleSignalFrontLeftTirePressure {
+ const VehicleSignalFrontLeftTirePressure({required this.pressure});
+
+ final double pressure;
+
+ VehicleSignalFrontLeftTirePressure copyWith({double? pressure}) {
+ return VehicleSignalFrontLeftTirePressure(
+ pressure: pressure ?? this.pressure);
+ }
+}
+
+class VehicleSignalFrontLeftTirePressureNotifier
+ extends StateNotifier<VehicleSignalFrontLeftTirePressure> {
+ VehicleSignalFrontLeftTirePressureNotifier() : super(_initialValue);
+
+ static final VehicleSignalFrontLeftTirePressure _initialValue =
+ VehicleSignalFrontLeftTirePressure(pressure: 32);
+
+ void update({double? pressure}) {
+ state = state.copyWith(pressure: pressure);
+ }
+}
+
+final vehicleSignalFrontLeftTirePressureProvider = StateNotifierProvider<
+ VehicleSignalFrontLeftTirePressureNotifier,
+ VehicleSignalFrontLeftTirePressure>(
+ (ref) => VehicleSignalFrontLeftTirePressureNotifier(),
+);
+
+// Front Right Tire Pressure
+
+@immutable
+class VehicleSignalFrontRightTirePressure {
+ const VehicleSignalFrontRightTirePressure({required this.pressure});
+
+ final double pressure;
+
+ VehicleSignalFrontRightTirePressure copyWith({double? pressure}) {
+ return VehicleSignalFrontRightTirePressure(
+ pressure: pressure ?? this.pressure);
+ }
+}
+
+class VehicleSignalFrontRightTirePressureNotifier
+ extends StateNotifier<VehicleSignalFrontRightTirePressure> {
+ VehicleSignalFrontRightTirePressureNotifier() : super(_initialValue);
+
+ static final VehicleSignalFrontRightTirePressure _initialValue =
+ VehicleSignalFrontRightTirePressure(pressure: 32);
+
+ void update({double? pressure}) {
+ state = state.copyWith(pressure: pressure);
+ }
+}
+
+final vehicleSignalFrontRightTirePressureProvider = StateNotifierProvider<
+ VehicleSignalFrontRightTirePressureNotifier,
+ VehicleSignalFrontRightTirePressure>(
+ (ref) => VehicleSignalFrontRightTirePressureNotifier(),
+);
+
+// Rear Left Tire Pressure
+
+@immutable
+class VehicleSignalRearLeftTirePressure {
+ const VehicleSignalRearLeftTirePressure({required this.pressure});
+
+ final double pressure;
+
+ VehicleSignalRearLeftTirePressure copyWith({double? pressure}) {
+ return VehicleSignalRearLeftTirePressure(
+ pressure: pressure ?? this.pressure);
+ }
+}
+
+class VehicleSignalRearLeftTirePressureNotifier
+ extends StateNotifier<VehicleSignalRearLeftTirePressure> {
+ VehicleSignalRearLeftTirePressureNotifier() : super(_initialValue);
+
+ static final VehicleSignalRearLeftTirePressure _initialValue =
+ VehicleSignalRearLeftTirePressure(pressure: 33);
+
+ void update({double? pressure}) {
+ state = state.copyWith(pressure: pressure);
+ }
+}
+
+final vehicleSignalRearLeftTirePressureProvider = StateNotifierProvider<
+ VehicleSignalRearLeftTirePressureNotifier,
+ VehicleSignalRearLeftTirePressure>(
+ (ref) => VehicleSignalRearLeftTirePressureNotifier(),
+);
+
+// Rear Right Tire Pressure
+
+@immutable
+class VehicleSignalRearRightTirePressure {
+ const VehicleSignalRearRightTirePressure({required this.pressure});
+
+ final double pressure;
+
+ VehicleSignalRearRightTirePressure copyWith({double? pressure}) {
+ return VehicleSignalRearRightTirePressure(
+ pressure: pressure ?? this.pressure);
+ }
+}
+
+class VehicleSignalRearRightTirePressureNotifier
+ extends StateNotifier<VehicleSignalRearRightTirePressure> {
+ VehicleSignalRearRightTirePressureNotifier() : super(_initialValue);
+
+ static final VehicleSignalRearRightTirePressure _initialValue =
+ VehicleSignalRearRightTirePressure(pressure: 34);
+
+ void update({double? pressure}) {
+ state = state.copyWith(pressure: pressure);
+ }
+}
+
+final vehicleSignalRearRightTirePressureProvider = StateNotifierProvider<
+ VehicleSignalRearRightTirePressureNotifier,
+ VehicleSignalRearRightTirePressure>(
+ (ref) => VehicleSignalRearRightTirePressureNotifier(),
+);
+
+// Left Child Lock Active
+
+@immutable
+class VehicleSignalLeftChildLockActive {
+ const VehicleSignalLeftChildLockActive({required this.engaged});
+
+ final bool engaged;
+
+ VehicleSignalLeftChildLockActive copyWith({bool? engaged}) {
+ return VehicleSignalLeftChildLockActive(engaged: engaged ?? this.engaged);
+ }
+}
+
+class VehicleSignalLeftChildLockActiveNotifier
+ extends StateNotifier<VehicleSignalLeftChildLockActive> {
+ VehicleSignalLeftChildLockActiveNotifier() : super(_initialValue);
+
+ static final VehicleSignalLeftChildLockActive _initialValue =
+ VehicleSignalLeftChildLockActive(engaged: true);
+
+ void update({bool? engaged}) {
+ state = state.copyWith(engaged: engaged);
+ }
+}
+
+final vehicleSignalLeftChildLockActiveProvider = StateNotifierProvider<
+ VehicleSignalLeftChildLockActiveNotifier, VehicleSignalLeftChildLockActive>(
+ (ref) => VehicleSignalLeftChildLockActiveNotifier(),
+);
+
+// Right Child Lock Active
+
+@immutable
+class VehicleSignalRightChildLockActive {
+ const VehicleSignalRightChildLockActive({required this.engaged});
+
+ final bool engaged;
+
+ VehicleSignalRightChildLockActive copyWith({bool? engaged}) {
+ return VehicleSignalRightChildLockActive(engaged: engaged ?? this.engaged);
+ }
+}
+
+class VehicleSignalRightChildLockActiveNotifier
+ extends StateNotifier<VehicleSignalRightChildLockActive> {
+ VehicleSignalRightChildLockActiveNotifier() : super(_initialValue);
+
+ static final VehicleSignalRightChildLockActive _initialValue =
+ VehicleSignalRightChildLockActive(engaged: true);
+
+ void update({bool? engaged}) {
+ state = state.copyWith(engaged: engaged);
+ }
+}
+
+final vehicleSignalRightChildLockActiveProvider = StateNotifierProvider<
+ VehicleSignalRightChildLockActiveNotifier,
+ VehicleSignalRightChildLockActive>(
+ (ref) => VehicleSignalRightChildLockActiveNotifier(),
+);
+
+// Battery Charging
+
+@immutable
+class VehicleSignalBatteryCharging {
+ const VehicleSignalBatteryCharging({required this.charging});
+
+ final bool charging;
+
+ VehicleSignalBatteryCharging copyWith({bool? charging}) {
+ return VehicleSignalBatteryCharging(charging: charging ?? this.charging);
+ }
+}
+
+class VehicleSignalBatteryChargingNotifier
+ extends StateNotifier<VehicleSignalBatteryCharging> {
+ VehicleSignalBatteryChargingNotifier() : super(_initialValue);
+
+ static final VehicleSignalBatteryCharging _initialValue =
+ VehicleSignalBatteryCharging(charging: true);
+
+ void update({bool? charging}) {
+ state = state.copyWith(charging: charging);
+ }
+}
+
+final vehicleSignalBatteryChargingProvider = StateNotifierProvider<
+ VehicleSignalBatteryChargingNotifier, VehicleSignalBatteryCharging>(
+ (ref) => VehicleSignalBatteryChargingNotifier(),
+);
+
+// Inside Temperature
+
+@immutable
+class VehicleSignalInsideTemp {
+ const VehicleSignalInsideTemp({required this.temp});
+
+ final double temp;
+
+ VehicleSignalInsideTemp copyWith({double? temp}) {
+ return VehicleSignalInsideTemp(temp: temp ?? this.temp);
+ }
+}
+
+class VehicleSignalInsideTempNotifier
+ extends StateNotifier<VehicleSignalInsideTemp> {
+ VehicleSignalInsideTempNotifier() : super(_initialValue);
+
+ static final VehicleSignalInsideTemp _initialValue =
+ VehicleSignalInsideTemp(temp: 25);
+
+ void update({double? temp}) {
+ state = state.copyWith(temp: temp);
+ }
+}
+
+final vehicleSignalInsideTempProvider = StateNotifierProvider<
+ VehicleSignalInsideTempNotifier, VehicleSignalInsideTemp>(
+ (ref) => VehicleSignalInsideTempNotifier(),
+);
+
+// Outside Temperature
+
+@immutable
+class VehicleSignalOutsideTemp {
+ const VehicleSignalOutsideTemp({required this.temp});
+
+ final double temp;
+
+ VehicleSignalOutsideTemp copyWith({double? temp}) {
+ return VehicleSignalOutsideTemp(temp: temp ?? this.temp);
+ }
+}
+
+class VehicleSignalOutsideTempNotifier
+ extends StateNotifier<VehicleSignalOutsideTemp> {
+ VehicleSignalOutsideTempNotifier() : super(_initialValue);
+
+ static final VehicleSignalOutsideTemp _initialValue =
+ VehicleSignalOutsideTemp(temp: 32);
+
+ void update({double? temp}) {
+ state = state.copyWith(temp: temp);
+ }
+}
+
+final vehicleSignalOutsideTempProvider = StateNotifierProvider<
+ VehicleSignalOutsideTempNotifier, VehicleSignalOutsideTemp>(
+ (ref) => VehicleSignalOutsideTempNotifier(),
+);