From c7f8946c5be391088d7bb75da6c418a853d7fbb7 Mon Sep 17 00:00:00 2001 From: Aakash Solanki Date: Sat, 6 Aug 2022 13:49:55 +0200 Subject: Update agl-cluster-demo-platform-flutter image - Remove packagegroup and add packages to image - Add a script to set some value in Kuksa data model - Add Simple-CAN-simulator Bug-AGL: SPEC-4508 Change-Id: Ibf4f4c2b02f7860e2f93c08a5c0e064272652657 Signed-off-by: Aakash Solanki --- .../flutter-cluster-dashboard_git.bb | 17 +--- .../kuksa-vss-init/files/kuksa_vss_init.py | 98 ++++++++++++++++++++++ recipes-demo/kuksa-vss-init/kuksa-vss-init.bb | 15 ++++ .../images/agl-cluster-demo-platform-flutter.bb | 9 +- 4 files changed, 121 insertions(+), 18 deletions(-) create mode 100644 recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py create mode 100644 recipes-demo/kuksa-vss-init/kuksa-vss-init.bb 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 5e903312a..44be070ff 100644 --- a/recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb +++ b/recipes-demo/flutter-cluster-dashboard/flutter-cluster-dashboard_git.bb @@ -30,16 +30,6 @@ APP_CONFIG = "ic_on_bg-release.json" APP_CONFIG:class-runtimedebug = "ic_on_bg-debug.json" APP_CONFIG:class-runtimeprofile = "ic_on_bg-profile.json" -# To avoid conflicts with the systemd template scheme added via bbappend in -# meta-agl-demo, package the standalone systemd unit separately. This is not -# needed when meta-agl-flutter is used without meta-agl-demo, but that is not -# going to be the default usecase for most users, so this still allows them to -# build working agl-image-flutter images in the same build tree. -# -# This can be dropped if/when flutter-gallery is no longer packaged as a demo -# in meta-agl-demo. - -#SYSTEMD_SERVICE:${PN}-init = "flutter-cluster-dashboard.service" do_install:append() { install -D -m 0644 ${WORKDIR}/flutter-cluster-dashboard.service ${D}${systemd_user_unitdir}/flutter-cluster-dashboard.service @@ -49,10 +39,5 @@ do_install:append() { install -D -m 0644 ${WORKDIR}/${APP_CONFIG} ${D}${datadir}/flutter/default.json } -PACKAGE_BEFORE_PN += "${PN}-init" - -FILES:${PN} += "${datadir}" - -FILES:${PN}-init = "${systemd_user_unitdir}" -RDEPENDS:${PN}-init = "${PN}" \ No newline at end of file +FILES:${PN} += "${datadir} ${systemd_user_unitdir}" diff --git a/recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py b/recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py new file mode 100644 index 000000000..5453112c9 --- /dev/null +++ b/recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +# Copyright (c) 2022 Aakash Solanki, tech2aks@gmail.com +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +# of the Software, and to permit persons to whom the Software is furnished to do +# so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import kuksa_viss_client +import time + + +class VSS: + def __init__(self, client): + self.client = client + + self.speed = "Vehicle.Speed" + self.engineRPM = "Vehicle.Powertrain.CombustionEngine.Engine.Speed" + self.fuelLevel = "Vehicle.Powertrain.FuelSystem.Level" + self.coolantTemp = "Vehicle.Powertrain.CombustionEngine.Engine.ECT" + self.leftIndicator = "Vehicle.Body.Lights.IsLeftIndicatorOn" + self.rightIndicator = "Vehicle.Body.Lights.IsRightIndicatorOn" + # // Selected Gear output = > 0 = Neutral, 1/2/.. = Forward, -1/.. = Reverse, 126 = Park, 127 = Drive + self.selectedGear = "Vehicle.Powertrain.Transmission.SelectedGear" + self.lowBeamOn = "Vehicle.Body.Lights.IsLowBeamOn" + self.highBeamOn = "Vehicle.Body.Lights.IsHighBeamOn" + self.parkingLightOn = "Vehicle.Body.Lights.IsParkingOn" + self.hazardLightOn = "Vehicle.Body.Lights.IsHazardOn" + self.travelledDistance = "Vehicle.TravelledDistance" + self.trunkLocked = "Vehicle.Body.Trunk.IsLocked" + self.trunkOpen = "Vehicle.Body.Trunk.IsOpen" + # // \"normal\", \"sport\", \"economy\", \"snow\", \"rain\"] + self.performanceMode = "Vehicle.Powertrain.Transmission.PerformanceMode" + self.ambientAirTemperature = "Vehicle.AmbientAirTemperature" + self.mil = "Vehicle.OBD.Status.MIL" + self.cruiseControlError = "Vehicle.ADAS.CruiseControl.Error" + self.cruiseControlSpeedSet = "Vehicle.ADAS.CruiseControl.SpeedSet" + self.cruiseControlisActive = "Vehicle.ADAS.CruiseControl.IsActive" + self.batteryChargingStatus = "Vehicle.Powertrain.Battery.Charging.Status" + + def setInitialValues(self): + print("Setting values") + self.client.setValue(self.speed, '5') + self.client.setValue(self.engineRPM, '1000') + self.client.setValue(self.fuelLevel, '50') + self.client.setValue(self.coolantTemp, '70') + self.client.setValue(self.leftIndicator, "false") + self.client.setValue(self.rightIndicator, "false") + self.client.setValue(self.selectedGear, '127') + self.client.setValue(self.lowBeamOn, "true") + self.client.setValue(self.highBeamOn, "false") + self.client.setValue(self.parkingLightOn, "true") + self.client.setValue(self.hazardLightOn, "false") + self.client.setValue(self.travelledDistance, '100') + self.client.setValue(self.trunkLocked, "true") + self.client.setValue(self.trunkOpen, "false") + self.client.setValue(self.performanceMode, "normal") + self.client.setValue(self.ambientAirTemperature, '28') + self.client.setValue(self.mil, "false") + self.client.setValue(self.cruiseControlError, "false") + self.client.setValue(self.cruiseControlisActive, "false") + self.client.setValue(self.cruiseControlSpeedSet, '60') + self.client.setValue(self.batteryChargingStatus, "true") + print("All value set succesfully") + + +def main(): + config = {"ip": "localhost", "port": 8090, "insecure": False} + client = kuksa_viss_client.KuksaClientThread(config) + client.start() + token_file = open( + "/usr/lib/python3.10/site-packages/kuksa_certificates/jwt/all-read-write.json.token", "r") + token = token_file.read() + client.authorize(token, timeout=2) + + vss = VSS(client) + + time.sleep(2) + + vss.setInitialValues() + client.stop() + + +if __name__ == '__main__': + main() diff --git a/recipes-demo/kuksa-vss-init/kuksa-vss-init.bb b/recipes-demo/kuksa-vss-init/kuksa-vss-init.bb new file mode 100644 index 000000000..a2aa949af --- /dev/null +++ b/recipes-demo/kuksa-vss-init/kuksa-vss-init.bb @@ -0,0 +1,15 @@ +DESCRIPTION = "Initialize the Kuksa VSS data to some constant values" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${WORKDIR}/kuksa_vss_init.py;beginline=2;endline=20;md5=afe8bd5e80449c5209495644133c16a8" + +SRC_URI = "file://kuksa_vss_init.py" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/kuksa_vss_init.py ${D}${sbindir} +} + +RDEPENDS:${PN} = "python3" diff --git a/recipes-platform/images/agl-cluster-demo-platform-flutter.bb b/recipes-platform/images/agl-cluster-demo-platform-flutter.bb index 40aa6e864..07555fd89 100644 --- a/recipes-platform/images/agl-cluster-demo-platform-flutter.bb +++ b/recipes-platform/images/agl-cluster-demo-platform-flutter.bb @@ -10,7 +10,13 @@ IMAGE_INSTALL:append = "\ agl-compositor \ agl-compositor-init \ packagegroup-agl-profile-graphical \ - packagegroup-agl-ivi-services \ + \ + kuksa-val \ + kuksa-val-agl \ + kuksa-dbc-feeder \ + \ + kuksa-vss-init \ + simple-can-simulator \ " # flutter @@ -18,7 +24,6 @@ IMAGE_INSTALL:append = "\ weston-ini-conf-landscape \ \ flutter-cluster-dashboard-runtimerelease \ - flutter-cluster-dashboard-runtimerelease-init \ flutter-auto-runtimerelease \ " -- cgit 1.2.3-korg