diff options
author | Scott Murray <scott.murray@konsulko.com> | 2023-08-24 15:21:40 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2023-08-24 15:58:58 -0400 |
commit | e6e998428529bb788e2412e84757ad9a0b71fb32 (patch) | |
tree | 732447f581be177a0b181cb1de00c481b82bbda6 /navigation/navigation.h | |
parent | 1234b2771bc45a885df54a779dfb8a125f315f93 (diff) |
Rework vehicle signals support to use KUKSA.val databroker
Rework the VehicleSignals class and its use in the Navigation and
Hvac classes to switch from using the original KUKSA.val server
via WebSockets to the KUKSA.val databroker's gRPC "VAL" API.
Notable changes:
- The VehicleSignals API has changed a bit with respect to setting
signals, callers now need to pass the new value as the type that
matches the signal as opposed to always passing a string, and
optionally indicate if an actuator's target or value is being set.
Subscribe operations now also allow subscribing for either
actuator targets or values.
- It is possible that the values returned by get and subscribe
operations will be changed to using QVariant instead of QStrings
in a future follow up, but that has not been done in these changes.
- The connected signal from VehicleSignals still has roughly the
same meaning, but the authorize function and authorized signals
are to some degree redundant now. They have been kept for
compatibility, but may be removed in a follow up set of changes.
- The section header in the .ini files expected by the
VehicleSignalsConfig class has been changed from "vis-client" to
"kuksa-client" since the databroker is not a VIS server, and to
some degree forcing an update on the part of clients is useful
since their authorization tokens also need to change.
- The client key and certificate support has been removed from the
VehicleSignalsConfig class, as they are no longer used in either
the server or databroker as of KUKSA.val 0.4.0. A new optional
parameter, "tls-server-name", has been added to work with the new
TLS support behavior. It can be used to override the expected
host name for connecting to a non-local databroker instance.
- The Navigation constructor now takes an additional parameter to
indicate whether the instance acts as a router or a client.
The underlying need for this stems from an application acting as
a router needing to subscribe to the destination setting actuator
targets.
Bug-AGL: SPEC-4762
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I253480ae2abf068dc6e41a495454960ed5c0feaf
Diffstat (limited to 'navigation/navigation.h')
-rw-r--r-- | navigation/navigation.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/navigation/navigation.h b/navigation/navigation.h index 2c8a8ff..eb15ed3 100644 --- a/navigation/navigation.h +++ b/navigation/navigation.h @@ -1,17 +1,7 @@ /* - * Copyright (C) 2019-2022 Konsulko Group + * Copyright (C) 2019-2023 Konsulko Group * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ #ifndef NAVIGATION_H @@ -19,6 +9,7 @@ #include <QObject> #include <QVariant> +#include <QMutex> class VehicleSignals; @@ -27,7 +18,7 @@ class Navigation : public QObject Q_OBJECT public: - explicit Navigation(VehicleSignals *vs, QObject *parent = Q_NULLPTR); + explicit Navigation(VehicleSignals *vs, bool router = false, QObject *parent = Q_NULLPTR); virtual ~Navigation(); Q_INVOKABLE void broadcastPosition(double lat, double lon, double drc, double dst); @@ -44,19 +35,29 @@ signals: private slots: void onConnected(); - void onAuthorized(); - void onDisconnected(); void onSignalNotification(QString path, QString value, QString timestamp); + void onSignalNotificationRouter(QString path, QString value, QString timestamp); private: + void handlePositionUpdate(); + VehicleSignals *m_vs; - bool m_connected; + bool m_router = false; + bool m_connected = false; + + QMutex m_position_mutex; double m_latitude; + bool m_latitude_set = false; double m_longitude; + bool m_longitude_set = false; double m_heading; - double m_distance; + bool m_heading_set = false; + double m_distance = 0.0; + bool m_distance_set = false; double m_dest_latitude; + bool m_dest_latitude_set = false; double m_dest_longitude; + bool m_dest_longitude_set = false; }; #endif // NAVIGATION_H |