diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-12-24 15:30:10 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-12-29 01:22:55 -0500 |
commit | fe23ca5ecdabd698917c4e84915151fc32cb335e (patch) | |
tree | e9cad647d01f546107dfa820363a80c48e33c6e2 /lib/kuksa-server | |
parent | 467221c592123125d6439871f02ef5e9ca0fe777 (diff) |
Rework temperature controls
Rework the temperature controls to use NumberPicker widgets so they
function more like a user would expect. The associated Riverpod
providers have been updated to track the temperature value directly,
and some minor layout tweaks have also been made.
Bug-AGL: SPEC-4644
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I069e0bd53c79d73cc7a60045309efdfeb9409fbc
Diffstat (limited to 'lib/kuksa-server')
-rw-r--r-- | lib/kuksa-server/on_boarding_page.dart | 10 | ||||
-rw-r--r-- | lib/kuksa-server/vehicle_methods.dart | 42 |
2 files changed, 13 insertions, 39 deletions
diff --git a/lib/kuksa-server/on_boarding_page.dart b/lib/kuksa-server/on_boarding_page.dart index a14145c..1bd3a79 100644 --- a/lib/kuksa-server/on_boarding_page.dart +++ b/lib/kuksa-server/on_boarding_page.dart @@ -24,23 +24,19 @@ class _OnBoardingPageState extends ConsumerState<OnBoardingPage> { late Timer _timer; late WebSocket _socket; - @override void initState() { super.initState(); _socket = widget.socket; - VISS.init(widget.socket,ref); + 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) { - - }, + (data) {}, onError: (e, stk) { print(e.toString()); ref.refresh(sockConnectprovider(widget.client)); @@ -58,7 +54,7 @@ class _OnBoardingPageState extends ConsumerState<OnBoardingPage> { @override Widget build(BuildContext context) { - return MyHome_Page( + return HomePage( socket: _socket, ); } diff --git a/lib/kuksa-server/vehicle_methods.dart b/lib/kuksa-server/vehicle_methods.dart index 2dda79f..387c02a 100644 --- a/lib/kuksa-server/vehicle_methods.dart +++ b/lib/kuksa-server/vehicle_methods.dart @@ -7,41 +7,21 @@ import 'package:flutter_hvac/config.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_hvac/kuksa-server/vehicle_server_path.dart'; - class VISS { static const requestId = "test-id"; - static void init(WebSocket socket,WidgetRef ref) { - authorize(socket,ref); + static void init(WebSocket socket, WidgetRef ref) { + authorize(socket, ref); - subscribe(socket,ref, VSPath.vehicleFrontLeftTier); - subscribe(socket,ref, VSPath.vehicleFrontRightTier); - subscribe(socket,ref, VSPath.vehicleRearLeftTier); - subscribe(socket,ref, VSPath.vehicleRearRightTier); - subscribe(socket,ref, VSPath.vehicleIsChildLockActiveLeft); - subscribe(socket,ref, VSPath.vehicleIsChildLockActiveRight); - subscribe(socket,ref, VSPath.vehicleCurrentLatitude); - subscribe(socket,ref, VSPath.vehicleCurrentLongitude); - subscribe(socket,ref, VSPath.vehicleInsideTemperature); - subscribe(socket,ref, VSPath.vehicleAmbientAirTemperature); + subscribe(socket, ref, VSPath.vehicleInsideTemperature); + subscribe(socket, ref, VSPath.vehicleAmbientAirTemperature); } - static void update(WebSocket socket,WidgetRef ref) { - get(socket,ref, VSPath.vehicleAmbientAirTemperature); - get(socket,ref, VSPath.vehicleTrunkLocked); - get(socket, ref,VSPath.vehicleTrunkOpen); - - get(socket,ref, VSPath.vehicleFrontLeftTier); - get(socket,ref, VSPath.vehicleFrontRightTier); - get(socket,ref, VSPath.vehicleRearLeftTier); - get(socket,ref, VSPath.vehicleRearRightTier); - get(socket,ref, VSPath.vehicleIsChildLockActiveLeft); - get(socket,ref, VSPath.vehicleIsChildLockActiveRight); - get(socket,ref, VSPath.vehicleCurrentLatitude); - get(socket,ref, VSPath.vehicleCurrentLongitude); - get(socket,ref, VSPath.vehicleInsideTemperature); + static void update(WebSocket socket, WidgetRef ref) { + get(socket, ref, VSPath.vehicleInsideTemperature); + get(socket, ref, VSPath.vehicleAmbientAirTemperature); } - static void authorize(WebSocket socket,WidgetRef ref) { + static void authorize(WebSocket socket, WidgetRef ref) { final config = ref.read(ConfigStateprovider); Map<String, dynamic> map = { "action": "authorize", @@ -51,7 +31,7 @@ class VISS { socket.add(jsonEncode(map)); } - static void get(WebSocket socket,WidgetRef ref ,String path) { + static void get(WebSocket socket, WidgetRef ref, String path) { final config = ref.read(ConfigStateprovider); Map<String, dynamic> map = { @@ -81,7 +61,7 @@ class VISS { socket.add(jsonEncode(map)); } - static void subscribe(WebSocket socket,WidgetRef ref, String path) { + static void subscribe(WebSocket socket, WidgetRef ref, String path) { final config = ref.read(ConfigStateprovider); Map<String, dynamic> map = { @@ -92,6 +72,4 @@ class VISS { }; socket.add(jsonEncode(map)); } - - } |