diff options
Diffstat (limited to 'lib/kuksa-server/vehicle_methods.dart')
-rw-r--r-- | lib/kuksa-server/vehicle_methods.dart | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/lib/kuksa-server/vehicle_methods.dart b/lib/kuksa-server/vehicle_methods.dart deleted file mode 100644 index 387c02a..0000000 --- a/lib/kuksa-server/vehicle_methods.dart +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -import 'dart:convert'; -import 'dart:io'; - -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); - - subscribe(socket, ref, VSPath.vehicleInsideTemperature); - subscribe(socket, ref, VSPath.vehicleAmbientAirTemperature); - } - - static void update(WebSocket socket, WidgetRef ref) { - get(socket, ref, VSPath.vehicleInsideTemperature); - get(socket, ref, VSPath.vehicleAmbientAirTemperature); - } - - 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)); - } -} |