summaryrefslogtreecommitdiffstats
path: root/src/hvac-service.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2023-08-24 15:39:24 -0400
committerScott Murray <scott.murray@konsulko.com>2023-08-24 15:42:30 -0400
commit0a1426d097688912188bcb59ff59d9c596e82b4d (patch)
tree8032edef0f8a6c3bbebe8f4382486f679bb2143f /src/hvac-service.cpp
parentf0ac80936b73a44131564c4f65ecc0c9a9db7d39 (diff)
Rework to switch to using KUKSA.val databroker
Rework to use the "VAL" gRPC API from the KUKSA.val databroker instead of the older server's WebSocket interface. Some source files have been renamed to match the class naming to provide a bit more consistency. Bug-AGL: SPEC-4762 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ib1ec31af439a9b2d5244e2232ea7be1ed9a2574c
Diffstat (limited to 'src/hvac-service.cpp')
-rw-r--r--src/hvac-service.cpp85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/hvac-service.cpp b/src/hvac-service.cpp
deleted file mode 100644
index ee05806..0000000
--- a/src/hvac-service.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-#include "hvac-service.hpp"
-#include <iostream>
-#include <algorithm>
-
-
-HvacService::HvacService(const VisConfig &config, net::io_context& ioc, ssl::context& ctx) :
- VisSession(config, ioc, ctx),
- m_can_helper(),
- m_led_helper()
-{
-}
-
-void HvacService::handle_authorized_response(void)
-{
- subscribe("Vehicle.Cabin.HVAC.Station.Row1.Left.Temperature");
- subscribe("Vehicle.Cabin.HVAC.Station.Row1.Left.FanSpeed");
- subscribe("Vehicle.Cabin.HVAC.Station.Row1.Right.Temperature");
- subscribe("Vehicle.Cabin.HVAC.Station.Row1.Right.FanSpeed");
-}
-
-void HvacService::handle_get_response(std::string &path, std::string &value, std::string &timestamp)
-{
- // Placeholder since no gets are performed ATM
-}
-
-void HvacService::handle_notification(std::string &path, std::string &value, std::string &timestamp)
-{
- if (path == "Vehicle.Cabin.HVAC.Station.Row1.Left.Temperature") {
- try {
- int temp = std::stoi(value);
- if (temp >= 0 && temp < 256)
- set_left_temperature(temp);
- }
- catch (std::exception ex) {
- // ignore bad value
- }
- } else if (path == "Vehicle.Cabin.HVAC.Station.Row1.Right.Temperature") {
- try {
- int temp = std::stoi(value);
- if (temp >= 0 && temp < 256)
- set_right_temperature(temp);
- }
- catch (std::exception ex) {
- // ignore bad value
- }
- } else if (path == "Vehicle.Cabin.HVAC.Station.Row1.Left.FanSpeed") {
- try {
- int speed = std::stoi(value);
- if (speed >= 0 && speed < 256)
- set_fan_speed(speed);
- }
- catch (std::exception ex) {
- // ignore bad value
- }
- } else if (path == "Vehicle.Cabin.HVAC.Station.Row1.Right.FanSpeed") {
- try {
- int speed = std::stoi(value);
- if (speed >= 0 && speed < 256)
- set_fan_speed(speed);
- }
- catch (std::exception ex) {
- // ignore bad value
- }
- }
- // else ignore
-}
-
-void HvacService::set_left_temperature(uint8_t temp)
-{
- m_can_helper.set_left_temperature(temp);
- m_led_helper.set_left_temperature(temp);
-}
-
-void HvacService::set_right_temperature(uint8_t temp)
-{
- m_can_helper.set_right_temperature(temp);
- m_led_helper.set_right_temperature(temp);
-}
-
-void HvacService::set_fan_speed(uint8_t speed)
-{
- m_can_helper.set_fan_speed(speed);
-}