summaryrefslogtreecommitdiffstats
path: root/recipes-demo
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-12-07 19:21:16 +0900
committerScott Murray <scott.murray@konsulko.com>2022-12-10 07:48:43 +0000
commit65ac0bfdce938aa98b232cbdf42cb84c41257488 (patch)
treed637715483ac557ac7dc8c33b1bae64bb806a7da /recipes-demo
parentdc0117b9ccf34fb2a833a866f4048d1f5de2d986 (diff)
flutter-cluster-dashboard: Add demo configuration
Add a demo configuration yaml file to point at the KUKSA.val server on the IVI board that can be installed as an alternative to the default. Bug-AGL: SPEC-4636 Change-Id: I75f91ad620e33ef7cbd7c6de4ef7ccae9b17cdf4 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'recipes-demo')
-rw-r--r--recipes-demo/flutter-cluster-dashboard/files/flutter-cluster-dashboard.yaml.demo6
-rw-r--r--recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb27
2 files changed, 29 insertions, 4 deletions
diff --git a/recipes-demo/flutter-cluster-dashboard/files/flutter-cluster-dashboard.yaml.demo b/recipes-demo/flutter-cluster-dashboard/files/flutter-cluster-dashboard.yaml.demo
new file mode 100644
index 000000000..2b01da660
--- /dev/null
+++ b/recipes-demo/flutter-cluster-dashboard/files/flutter-cluster-dashboard.yaml.demo
@@ -0,0 +1,6 @@
+hostname: 192.168.10.2
+port: 8090
+homeLat: 31.708643
+homeLng: 76.931882
+orsPathParam: driving-car
+kuskaAuthToken: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJrdWtzYS52YWwiLCJpc3MiOiJFY2xpcHNlIEtVS1NBIERldiIsImFkbWluIjp0cnVlLCJpYXQiOjE1MTYyMzkwMjIsImV4cCI6MTc2NzIyNTU5OSwia3Vrc2EtdnNzIjp7IioiOiJydyJ9fQ.QQcVR0RuRJIoasPXYsMGZhdvhLjUalk4GcRaxhh3-0_j3CtVSZ0lTbv_Z3As5BfIYzaMlwUzFGvCVOq2MXVjRK81XOAZ6wIsyKOxva16zjbZryr2V_m3yZ4twI3CPEzJch11_qnhInirHltej-tGg6ySfLaTYeAkw4xYGwENMBBhN5t9odANpScZP_xx5bNfwdW1so6FkV1WhpKlCywoxk_vYZxo187d89bbiu-xOZUa5D-ycFkd1-1rjPXLGE_g5bc4jcQBvNBc-5FDbvt4aJlTQqjpdeppxhxn_gjkPGIAacYDI7szOLC-WYajTStbksUju1iQCyli11kPx0E66me_ZVwOX07f1lRF6D2brWm1LcMAHM3bQUK0LuyVwWPxld64uSAEsvSKsRyJERc7nZUgLf7COnUrrkxgIUNjukbdT2JVN_I-3l3b4YXg6JVD7Y5g0QYBKgXEFpZrDbBVhzo7PXPAhJD6-c3DcUQyRZExbrnFV56RwWuExphw8lYnbMvxPWImiVmB9nRVgFKD0TYaw1sidPSSlZt8Uw34VZzHWIZQAQY0BMjR33fefg42XQ1YzIwPmDx4GYXLl7HNIIVbsRsibKaJnf49mz2qnLC1K272zXSPljO11Ke1MNnsnKyUH7mcwEs9nhTsnMgEOx_TyMLRYo-VEHBDLuEOiBo
diff --git a/recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb b/recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb
index aa5343da9..6bd797a9a 100644
--- a/recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb
+++ b/recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb
@@ -14,6 +14,7 @@ SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/flutter-instrument-clust
file://flutter_cluster_dashboard_on_bg-profile.json \
file://flutter_cluster_dashboard_on_bg-release.json \
file://flutter-cluster-dashboard.yaml \
+ file://flutter-cluster-dashboard.yaml.demo \
"
PV = "1.0+git${SRCPV}"
@@ -27,13 +28,12 @@ FLUTTER_APPLICATION_INSTALL_PREFIX = "/flutter"
OPENROUTE_API_KEY ??= "YOU_NEED_TO_SET_IT_IN_LOCAL_CONF"
-inherit flutter-app
+inherit flutter-app update-alternatives
APP_CONFIG = "flutter_cluster_dashboard_on_bg-release.json"
APP_CONFIG:class-runtimedebug = "flutter_cluster_dashboard_on_bg-debug.json"
APP_CONFIG:class-runtimeprofile = "flutter_cluster_dashboard_on_bg-profile.json"
-
do_configure:prepend() {
if [ "${OPENROUTE_API_KEY}" = "YOU_NEED_TO_SET_IT_IN_LOCAL_CONF" ]; then
bbwarn "WARNING: You should set openrouteservice API key to OPENROUTE_API_KEY variable in local.conf."
@@ -48,11 +48,30 @@ do_install:append() {
install -D -m 0644 ${WORKDIR}/${APP_CONFIG} ${D}${datadir}/flutter/default.json
install -d ${D}${sysconfdir}/xdg/AGL
- install -m 0644 ${WORKDIR}/flutter-cluster-dashboard.yaml ${D}${sysconfdir}/xdg/AGL/
+ install -m 0644 ${WORKDIR}/flutter-cluster-dashboard.yaml \
+ ${D}${sysconfdir}/xdg/AGL/flutter-cluster-dashboard.yaml.default
+ install -m 0644 ${WORKDIR}/flutter-cluster-dashboard.yaml.demo ${D}${sysconfdir}/xdg/AGL/
install -m 0755 -d ${D}${sysconfdir}/default/
echo 'OPENROUTE_API_KEY:${OPENROUTE_API_KEY}' >> ${D}${sysconfdir}/default/openroutekey
}
+ALTERNATIVE_LINK_NAME[flutter-cluster-dashboard.yaml] = "${sysconfdir}/xdg/AGL/flutter-cluster-dashboard.yaml"
+
+FILES:${PN} += "${datadir} ${systemd_user_unitdir} ${sysconfdir}/default/"
+
+PACKAGE_BEFORE_PN += "${PN}-conf ${PN}-conf-demo"
+
+FILES:${PN}-conf += "${sysconfdir}/xdg/AGL/flutter-cluster-dashboard.yaml.default"
+RDEPENDS:${PN}-conf = "${PN}"
+RPROVIDES:${PN}-conf = "flutter-cluster-dashboard.yaml"
+RCONFLICTS:${PN}-conf = "${PN}-conf-demo"
+ALTERNATIVE:${PN}-conf = "flutter-cluster-dashboard.yaml"
+ALTERNATIVE_TARGET_${PN}-conf = "${sysconfdir}/xdg/AGL/flutter-cluster-dashboard.yaml.default"
-FILES:${PN} += "${datadir} ${systemd_user_unitdir} ${sysconfdir}/xdg/AGL ${sysconfdir}/default/"
+FILES:${PN}-conf-demo += "${sysconfdir}/xdg/AGL/flutter-cluster-dashboard.yaml.demo"
+RDEPENDS:${PN}-conf-demo = "${PN}"
+RPROVIDES:${PN}-conf-demo = "flutter-cluster-dashboard.yaml"
+RCONFLICTS:${PN}-conf-demo = "${PN}-conf"
+ALTERNATIVE:${PN}-conf-demo = "flutter-cluster-dashboard.yaml"
+ALTERNATIVE_TARGET_${PN}-conf-demo = "${sysconfdir}/xdg/AGL/flutter-cluster-dashboard.yaml.demo"
ight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (C) 2015, 2016 "IoT.bzh"
 * Author "Romain Forlot" <romain.forlot@iot.bzh>
 *
 * 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.
 */

#pragma once

#include <vector>

#include "uds/uds.h"
#include "can/can-bus.hpp"
#include "can/can-message.hpp"

#include "low-can-binding.hpp"

enum UNIT {
	POURCENT,
	DEGREES_CELSIUS,
	KPA,
	RPM,
	GRAMS_SEC,
	SECONDS,
	KM,
	KM_H,
	PA,
	NM,
	INVALID
};

/**
 *	@brief A representation of an OBD-II PID.
 *
 * pid - The 1 byte PID.
 * name - A human readable name to use for this PID when published.
 * min - minimum value for this pid
 * max - maximum value for this pid
 * unit - unit used
 * frequency - The frequency to request this PID if supported by the vehicle
 *		when automatic, recurring OBD-II requests are enabled.
 *	supported - is it supported by the vehicle. Initialized after scan
 */
typedef struct _Obd2Pid {
	uint8_t pid;
	const char* generic_name;
	const int min;
	const int max;
	enum UNIT unit;
	int frequency;
	bool supported;
} Obd2Pid;

/**
 * @brief - Object to handle obd2 session with pre-scan of supported pid
 * then request them regularly
 */
class obd2_signal_t {
	private:
		uint8_t pid_; /*!< pid - The 1 byte PID.*/
		std::string generic_name_; /*!< generic_name_ - A human readable name to use for this PID when published.*/
		int min_; /*!< min_ - Minimum value that can take this pid */
		int max_; /*!< max_ - Maximum value that can take this pid */
		enum UNIT unit_; /*!< unit_ : Which unit system is used by that pid. See enum UNIT above.*/
		int frequency_; /*!< frequency - The frequency to request this PID if supported by the vehicle when automatic, recurring OBD-II requests are enabled.*/
		bool supported_; /*!< supported_ - boolean indicating whether this pid is supported by the vehicle or not.*/

	public:
		const char* generic_name = generic_name_.c_str();
		obd2_signal_t(uint8_t pid, const char* generic_name, const int min_, const int max_, enum UNIT unit, int frequency, bool supported);

		uint32_t get_pid();

		void add_request(int pid);


		bool is_obd2_response(can_message_t can_message);
		bool is_obd2_request(DiagnosticRequest *request);
		bool is_obd2_signal(const char *name);

		float decode_obd2_response(const DiagnosticResponse* response, float parsedPayload);
};