summaryrefslogtreecommitdiffstats
path: root/lib/widgets
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2023-09-20 12:26:45 -0400
committerScott Murray <scott.murray@konsulko.com>2023-09-20 12:48:19 -0400
commit6a853805d2479bf7b111511b1f94907e425c607a (patch)
tree343a651a5e4a944de525f585eceb752d9ed3840a /lib/widgets
parent20d76f947ef9d4a9093df0e5ad04476963655173 (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 hvac-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 "hvac.yaml" instead of "hvac_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. - Bumped minimum SDK version to 2.18 in pubspec.yaml to enable "super" keyword support. This matches what the version was set to in flutter-homescreen. - The Vehicle and VehicleSignals classes have been reworked into a VehicleAcStatus class + provider, and users have been updated to use the Riverpod provider select functionality to attempt to reduce naive over-updating. - VSS paths have been rationalized to use the definitions in the VSSPath class so only one location will need to be updated on any signal name changes. - Added .gitignore file from flutter-homescreen to keep things clean in the future. Bug-AGL: SPEC-4762 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Idbabb54ead52bf38796f264a3c8a270aa170e2cd
Diffstat (limited to 'lib/widgets')
-rw-r--r--lib/widgets/left_climate.dart24
-rw-r--r--lib/widgets/right_climate.dart24
-rw-r--r--lib/widgets/slider.dart29
3 files changed, 29 insertions, 48 deletions
diff --git a/lib/widgets/left_climate.dart b/lib/widgets/left_climate.dart
index b45eb0b..6e9d275 100644
--- a/lib/widgets/left_climate.dart
+++ b/lib/widgets/left_climate.dart
@@ -3,16 +3,15 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:flutter_hvac/provider.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_provider.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_signal_providers.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_path.dart';
import 'package:numberpicker/numberpicker.dart';
-import '../kuksa-server/vehicle_methods.dart';
import '../size.dart';
class LeftClimateScrollWidget extends ConsumerWidget {
- LeftClimateScrollWidget({Key? key, required this.socket}) : super(key: key);
-
- WebSocket socket;
+ LeftClimateScrollWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ref) {
@@ -41,16 +40,11 @@ class LeftClimateScrollWidget extends ConsumerWidget {
},
onChanged: (value) {
ref.read(LeftClimateTempProvider.notifier).update(value);
- VISS.set(
- socket,
- ref,
- 'Vehicle.Cabin.HVAC.Station.Row1.Left.Temperature',
- value.toString());
- VISS.set(
- socket,
- ref,
- 'Vehicle.Cabin.HVAC.Station.Row2.Left.Temperature',
- value.toString());
+ var vss = ref.read(vssClientProvider);
+ if (vss != null) {
+ vss.setInt32(VSSPath.vehicleFrontLeftTemp, value);
+ vss.setInt32(VSSPath.vehicleRearLeftTemp, value);
+ }
},
selectedTextStyle: TextStyle(
color: Colors.lightBlueAccent,
diff --git a/lib/widgets/right_climate.dart b/lib/widgets/right_climate.dart
index 590b511..9b2cc39 100644
--- a/lib/widgets/right_climate.dart
+++ b/lib/widgets/right_climate.dart
@@ -3,16 +3,15 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:flutter_hvac/provider.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_provider.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_signal_providers.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_path.dart';
import 'package:numberpicker/numberpicker.dart';
-import '../kuksa-server/vehicle_methods.dart';
import '../size.dart';
class RightClimateScrollWidget extends ConsumerWidget {
- RightClimateScrollWidget({Key? key, required this.socket}) : super(key: key);
-
- WebSocket socket;
+ RightClimateScrollWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ref) {
@@ -40,16 +39,11 @@ class RightClimateScrollWidget extends ConsumerWidget {
},
onChanged: (value) {
ref.read(RightClimateTempProvider.notifier).update(value);
- VISS.set(
- socket,
- ref,
- 'Vehicle.Cabin.HVAC.Station.Row1.Right.Temperature',
- value.toString());
- VISS.set(
- socket,
- ref,
- 'Vehicle.Cabin.HVAC.Station.Row2.Right.Temperature',
- value.toString());
+ var vss = ref.read(vssClientProvider);
+ if (vss != null) {
+ vss.setInt32(VSSPath.vehicleFrontRightTemp, value);
+ vss.setInt32(VSSPath.vehicleRearRightTemp, value);
+ }
},
selectedTextStyle: TextStyle(
color: Colors.lightBlueAccent,
diff --git a/lib/widgets/slider.dart b/lib/widgets/slider.dart
index f8bd459..7ca5461 100644
--- a/lib/widgets/slider.dart
+++ b/lib/widgets/slider.dart
@@ -4,14 +4,14 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:flutter_hvac/provider.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_provider.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_signal_providers.dart';
+import 'package:flutter_hvac/vehicle-signals/vss_path.dart';
-import '../kuksa-server/vehicle_methods.dart';
import '../size.dart';
class SliderControl extends ConsumerWidget {
- WebSocket socket;
- SliderControl({Key? key, required this.socket}) : super(key: key);
+ SliderControl({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ref) {
@@ -22,20 +22,13 @@ class SliderControl extends ConsumerWidget {
value: ref.watch(fanSpeedProvider).toDouble(),
onChanged: (value) {
ref.read(fanSpeedProvider.notifier).update(value.toInt());
- VISS.set(socket, ref, 'Vehicle.Cabin.HVAC.Station.Row1.Left.FanSpeed',
- value.toInt().toString());
- VISS.set(
- socket,
- ref,
- 'Vehicle.Cabin.HVAC.Station.Row1.Right.FanSpeed',
- value.toInt().toString());
- VISS.set(socket, ref, 'Vehicle.Cabin.HVAC.Station.Row2.Left.FanSpeed',
- value.toInt().toString());
- VISS.set(
- socket,
- ref,
- 'Vehicle.Cabin.HVAC.Station.Row2.Right.FanSpeed',
- value.toInt().toString());
+ var vss = ref.read(vssClientProvider);
+ if (vss != null) {
+ vss.setUint32(VSSPath.vehicleFrontLeftFanSpeed, value.toInt());
+ vss.setUint32(VSSPath.vehicleFrontRightFanSpeed, value.toInt());
+ vss.setUint32(VSSPath.vehicleRearLeftFanSpeed, value.toInt());
+ vss.setUint32(VSSPath.vehicleRearRightFanSpeed, value.toInt());
+ }
},
min: 0,
max: 100,