aboutsummaryrefslogtreecommitdiffstats
path: root/lib/vehicle-signals/vss_providers.dart
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2023-09-14 14:01:24 -0400
committerScott Murray <scott.murray@konsulko.com>2023-09-14 14:37:02 -0400
commitcbbb9f40e283d12f6c52ad28609516f390316f7a (patch)
treed8d2cd8f4641299dd35a3138c0e28f11443928d6 /lib/vehicle-signals/vss_providers.dart
parent5ce59ba69f1451ec18c565b7b18301856553f574 (diff)
Rework to use KUKSA.val databroker gRPC API
Rework to move from the WebSocket API with the older KUKSA.val server to the gRPC "VAL" API of the databroker. Changes include: - All VISS WebSocket API code has been removed, and the signal providers replumbed to be driven by a new VssClient class with a homescreen-specific child class to hold all the gRPC API handling. - The generated code for the VAL API and its dependencies has been checked in under lib/generated, as there still does not seem to be a good way to generate it during the Flutter build. - The configuration file is now expected to be "homescreen.yaml" instead of "homescreen_config.yaml". The authorization token field name has been renamed to "authorization", and there are new "use-tls" and "ca-certificate" configuration fields. TLS is disabled by default for now, and the default CA certificate is /etc/kuksa.val/CA.pem. - Updated .gitignore to cover a couple of generated files that weren't included. Bug-AGL: SPEC-4762, SPEC-4903 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I1b95ed27a72435364d54ec846f2be88e3d8bb092
Diffstat (limited to 'lib/vehicle-signals/vss_providers.dart')
-rw-r--r--lib/vehicle-signals/vss_providers.dart130
1 files changed, 0 insertions, 130 deletions
diff --git a/lib/vehicle-signals/vss_providers.dart b/lib/vehicle-signals/vss_providers.dart
deleted file mode 100644
index 630a273..0000000
--- a/lib/vehicle-signals/vss_providers.dart
+++ /dev/null
@@ -1,130 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-//import 'dart:ffi';
-import 'dart:io';
-import 'package:meta/meta.dart';
-import 'package:flutter_riverpod/flutter_riverpod.dart';
-
-@immutable
-class VISServerSocket {
- const VISServerSocket({required this.socket});
-
- final WebSocket? socket;
-
- VISServerSocket copyWith({WebSocket? socket}) {
- return VISServerSocket(socket: socket ?? this.socket);
- }
-}
-
-class VISServerSocketNotifier extends StateNotifier<VISServerSocket> {
- VISServerSocketNotifier() : super(_initialValue);
-
- static final VISServerSocket _initialValue = VISServerSocket(socket: null);
-
- void update(WebSocket socket) {
- state = state.copyWith(socket: socket);
- }
-}
-
-final VISServerSocketProvider =
- StateNotifierProvider<VISServerSocketNotifier, VISServerSocket>((ref) {
- return VISServerSocketNotifier();
-});
-
-// Media Volume
-
-@immutable
-class VehicleSignalMediaVolume {
- const VehicleSignalMediaVolume({required this.volume});
-
- final int volume;
-
- VehicleSignalMediaVolume copyWith({int? volume}) {
- return VehicleSignalMediaVolume(volume: volume ?? this.volume);
- }
-}
-
-class VehicleSignalMediaVolumeNotifier
- extends StateNotifier<VehicleSignalMediaVolume> {
- VehicleSignalMediaVolumeNotifier() : super(_initialValue);
-
- static final VehicleSignalMediaVolume _initialValue =
- VehicleSignalMediaVolume(volume: 50);
-
- void update({int? volume}) {
- int? n = volume;
- if (n != null) {
- n = n.toUnsigned(8);
- if (n > 100) n = 100;
- }
- state = state.copyWith(volume: n);
- }
-}
-
-//final vehicleSignalMediaVolumeProvider = StateNotifierProvider<
-// VehicleSignalMediaVolumeNotifier, VehicleSignalMediaVolume>((ref) {
-// return VehicleSignalMediaVolumeNotifier();
-//});
-
-final vehicleSignalMediaVolumeProvider = StateNotifierProvider<
- VehicleSignalMediaVolumeNotifier,
- VehicleSignalMediaVolume>((ref) => VehicleSignalMediaVolumeNotifier());
-
-// 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(),
-);