summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonan Le Martret <ronan.lemartret@iot.bzh>2023-01-03 16:33:38 +0100
committerRonan Le Martret <ronan.lemartret@iot.bzh>2023-01-04 18:24:32 +0100
commitdae2afcd153bb10cfed942ad3a9aa998d254c02a (patch)
treea3095e7cfc7f94e2fbf87923a88aab81c34c60a3
parent137144c447d8adb618f5acbcbafd65f50264d6eb (diff)
Add rcar demo signalsandbox/ronan/dev_new_signal
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
-rw-r--r--app/ValueSource.qml172
-rw-r--r--app/cluster-gauges.qml14
2 files changed, 179 insertions, 7 deletions
diff --git a/app/ValueSource.qml b/app/ValueSource.qml
index 511a2a1..4339ed2 100644
--- a/app/ValueSource.qml
+++ b/app/ValueSource.qml
@@ -92,6 +92,30 @@ Item {
property bool laneDepartureWarnEnabled: false
property bool displayNumericSpeeds: true
+ // Rcar signal
+ property bool parkingBrakeIsEngaged: false
+ property bool engineOn: false
+ property bool oilLevelWarning: false
+ property real oilLevel: 0
+ property bool batteryLevelWarning: false
+
+ property bool is_Seat_Row1_Pos1_IsBelted: false
+ property bool is_Seat_Row1_Pos2_IsBelted: false
+ property bool is_Seat_Row2_Pos1_IsBelted: false
+ property bool is_Seat_Row2_Pos2_IsBelted: false
+ property bool is_Seat_NotIsBelted: false
+
+ property bool is_HighBeamOn: false
+ property bool is_LowBeamOn: false
+ property bool is_BeamOn: false
+
+ property bool is_Row1_Left_IsOpen: false
+ property bool is_Row1_Right_IsOpen: false
+ property bool is_Row2_Left_IsOpen: false
+ property bool is_Row2_Right_IsOpen: false
+ property bool is_Door_IsOpen: false
+
+
function randomDirection() {
return Math.random() > 0.5 ? Qt.LeftArrow : Qt.RightArrow;
}
@@ -112,16 +136,38 @@ Item {
onAuthorized: {
VehicleSignals.subscribe("Vehicle.Speed")
VehicleSignals.subscribe("Vehicle.Powertrain.CombustionEngine.Speed")
+
VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.CruiseEnable")
VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.CruiseSet")
VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.CruiseResume")
VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.CruiseCancel")
+
VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.LaneDepartureWarning")
VehicleSignals.subscribe("Vehicle.Cabin.SteeringWheel.Switches.Info")
+
VehicleSignals.get("Vehicle.Cabin.Infotainment.HMI.DistanceUnit")
VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.HMI.DistanceUnit")
+
+ // Rcar signal
+ VehicleSignals.subscribe("Vehicle.Chassis.ParkingBrake.IsEngaged")
+ VehicleSignals.subscribe("Vehicle.Private.OBD.OilLevel")
+ VehicleSignals.subscribe("Vehicle.Powertrain.Battery.GrossCapacity")
+
+ VehicleSignals.subscribe('Vehicle.Cabin.Seat.Row1.Pos1.IsBelted')
+ VehicleSignals.subscribe('Vehicle.Cabin.Seat.Row1.Pos2.IsBelted')
+ VehicleSignals.subscribe('Vehicle.Cabin.Seat.Row2.Pos1.IsBelted')
+ VehicleSignals.subscribe('Vehicle.Cabin.Seat.Row2.Pos2.IsBelted')
+
+ VehicleSignals.subscribe('Vehicle.Body.Lights.IsHighBeamOn')
+ VehicleSignals.subscribe('Vehicle.Body.Lights.IsLowBeamOn')
+
+ VehicleSignals.subscribe('Vehicle.Cabin.Door.Row1.Left.IsOpen')
+ VehicleSignals.subscribe('Vehicle.Cabin.Door.Row1.Right.IsOpen')
+ VehicleSignals.subscribe('Vehicle.Cabin.Door.Row2.Left.IsOpen')
+ VehicleSignals.subscribe('Vehicle.Cabin.Door.Row2.Right.IsOpen')
}
+
onGetSuccessResponse: {
//console.log("response path = " + path + ", value = " + value)
if (path === "Vehicle.Cabin.Infotainment.HMI.DistanceUnit") {
@@ -145,6 +191,12 @@ Item {
} else if (path === "Vehicle.Powertrain.CombustionEngine.Speed") {
if(!runAnimation) {
valueSource.rpm = parseFloat(value) / 1000
+
+ if (valueSource.rpm > 0) {
+ valueSource.engineOn = true
+ } else {
+ valueSource.engineOn = false
+ }
}
} else if (path === "Vehicle.Cabin.SteeringWheel.Switches.CruiseEnable" && value === "true") {
if(valueSource.cruiseEnabled) {
@@ -171,6 +223,126 @@ Item {
} else if (value === "mi") {
valueSource.mphDisplay = true
}
+ } else if (path === "Vehicle.Chassis.ParkingBrake.IsEngaged") {
+ if (value === "true") {
+ valueSource.parkingBrakeIsEngaged = true
+ } else if (value === "false") {
+ valueSource.parkingBrakeIsEngaged = false
+ }
+
+ } else if (path === "Vehicle.Private.OBD.OilLevel") {
+ if (value < 10) {
+ valueSource.oilLevelWarning = true
+ } else {
+ valueSource.oilLevelWarning = false
+ }
+ } else if (path === "Vehicle.Powertrain.Battery.GrossCapacity") {
+ if (value < 10) {
+ valueSource.batteryLevelWarning = true
+ } else {
+ valueSource.batteryLevelWarning = false
+ }
+ } else if (path === 'Vehicle.Cabin.Seat.Row1.Pos1.IsBelted' ||
+ path === 'Vehicle.Cabin.Seat.Row1.Pos2.IsBelted' ||
+ path === 'Vehicle.Cabin.Seat.Row2.Pos1.IsBelted' ||
+ path === 'Vehicle.Cabin.Seat.Row2.Pos2.IsBelted' ) {
+
+ if ( path === 'Vehicle.Cabin.Seat.Row1.Pos1.IsBelted' ) {
+ if (value === "true") {
+ valueSource.is_Seat_Row1_Pos1_IsBelted = true
+ } else if (value === "false") {
+ valueSource.is_Seat_Row1_Pos1_IsBelted = false
+ }
+ } else if ( path === 'Vehicle.Cabin.Seat.Row1.Pos2.IsBelted' ) {
+ if (value === "true") {
+ valueSource.is_Seat_Row1_Pos2_IsBelted = true
+ } else if (value === "false") {
+ valueSource.is_Seat_Row1_Pos2_IsBelted = false
+ }
+ } else if ( path === 'Vehicle.Cabin.Seat.Row2.Pos1.IsBelted' ) {
+ if (value === "true") {
+ valueSource.is_Seat_Row2_Pos1_IsBelted = true
+ } else if (value === "false") {
+ valueSource.is_Seat_Row2_Pos1_IsBelted = false
+ }
+ } else if ( path === 'Vehicle.Cabin.Seat.Row2.Pos2.IsBelted' ) {
+ if (value === "true") {
+ valueSource.is_Seat_Row2_Pos2_IsBelted = true
+ } else if (value === "false") {
+ valueSource.is_Seat_Row2_Pos2_IsBelted = false
+ }
+ }
+
+ if (valueSource.is_Seat_Row1_Pos1_IsBelted &&
+ valueSource.is_Seat_Row1_Pos2_IsBelted &&
+ valueSource.is_Seat_Row2_Pos1_IsBelted &&
+ valueSource.is_Seat_Row2_Pos2_IsBelted ) {
+ valueSource.is_Seat_NotIsBelted = false
+ } else{
+ valueSource.is_Seat_NotIsBelted = true
+ }
+
+ } else if (path === 'Vehicle.Body.Lights.IsHighBeamOn' ||
+ path === 'Vehicle.Body.Lights.IsLowBeamOn' ) {
+ if ( path === 'Vehicle.Body.Lights.IsHighBeamOn' ) {
+ if (value === "true") {
+ valueSource.is_HighBeamOn = true
+ } else if (value === "false") {
+ valueSource.is_HighBeamOn = false
+ }
+ } else if ( path === 'Vehicle.Body.Lights.IsLowBeamOn' ) {
+ if (value === "true") {
+ valueSource.is_LowBeamOn = true
+ } else if (value === "false") {
+ valueSource.is_LowBeamOn = false
+ }
+ }
+
+ if (valueSource.is_HighBeamOn ||
+ valueSource.is_LowBeamOn ) {
+ valueSource.is_BeamOn = true
+ } else{
+ valueSource.is_BeamOn = false
+ }
+ } else if (path === 'Vehicle.Cabin.Door.Row1.Left.IsOpen' ||
+ path === 'Vehicle.Cabin.Door.Row1.Right.IsOpen' ||
+ path === 'Vehicle.Cabin.Door.Row2.Left.IsOpen' ||
+ path === 'Vehicle.Cabin.Door.Row2.Right.IsOpen') {
+ if ( path === 'Vehicle.Cabin.Door.Row1.Left.IsOpen' ) {
+ if (value === "true") {
+ valueSource.is_Row1_Left_IsOpen = true
+ } else if (value === "false") {
+ valueSource.is_Row1_Left_IsOpen = false
+ }
+ } else if ( path === 'Vehicle.Cabin.Door.Row1.Right.IsOpen' ) {
+ if (value === "true") {
+ valueSource.is_Row1_Right_IsOpen = true
+ } else if (value === "false") {
+ valueSource.is_Row1_Right_IsOpen = false
+ }
+ } else if ( path === 'Vehicle.Cabin.Door.Row2.Left.IsOpen' ) {
+ if (value === "true") {
+ valueSource.is_Row2_Left_IsOpen = true
+ } else if (value === "false") {
+ valueSource.is_Row2_Left_IsOpen = false
+ }
+ } else if ( path === 'Vehicle.Cabin.Door.Row2.Right.IsOpen' ) {
+ if (value === "true") {
+ valueSource.is_Row2_Right_IsOpen = true
+ } else if (value === "false") {
+ valueSource.is_Row2_Right_IsOpen = false
+ }
+ }
+
+ if (valueSource.is_Row1_Left_IsOpen ||
+ valueSource.is_Row1_Right_IsOpen ||
+ valueSource.is_Row2_Left_IsOpen ||
+ valueSource.is_Row2_Right_IsOpen ) {
+ valueSource.is_Door_IsOpen = true
+ } else {
+ valueSource.is_Door_IsOpen = false
+ }
+
}
}
}
diff --git a/app/cluster-gauges.qml b/app/cluster-gauges.qml
index e4c299b..d53eb99 100644
--- a/app/cluster-gauges.qml
+++ b/app/cluster-gauges.qml
@@ -131,7 +131,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_Engine_yellow.svg' : './images/AGL_Icons_Engine.svg'
+ source: valueSource.engineOn ? './images/AGL_Icons_Engine_yellow.svg' : './images/AGL_Icons_Engine.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height
@@ -150,7 +150,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_Oil_red.svg' : './images/AGL_Icons_Oil.svg'
+ source: valueSource.oilLevelWarning ? './images/AGL_Icons_Oil_red.svg' : './images/AGL_Icons_Oil.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height
@@ -169,7 +169,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_Battery_red.svg' : './images/AGL_Icons_Battery.svg'
+ source: valueSource.batteryLevelWarning ? './images/AGL_Icons_Battery_red.svg' : './images/AGL_Icons_Battery.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height
@@ -207,7 +207,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_ParkingBrake_red.svg' : './images/AGL_Icons_ParkingBrake.svg'
+ source: valueSource.parkingBrakeIsEngaged ? './images/AGL_Icons_ParkingBrake_red.svg' : './images/AGL_Icons_ParkingBrake.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height
@@ -269,7 +269,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_Seatbelt_red.svg' : './images/AGL_Icons_Seatbelt.svg'
+ source: valueSource.is_Seat_NotIsBelted ? './images/AGL_Icons_Seatbelt_red.svg' : './images/AGL_Icons_Seatbelt.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height
@@ -288,7 +288,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_OpenDoor_red.svg' : './images/AGL_Icons_OpenDoor.svg'
+ source: valueSource.is_Door_IsOpen ? './images/AGL_Icons_OpenDoor_red.svg' : './images/AGL_Icons_OpenDoor.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height
@@ -307,7 +307,7 @@ ApplicationWindow {
border.color: "grey"
Image {
- source: valueSource.startUp ? './images/AGL_Icons_Lights_red.svg' : './images/AGL_Icons_Lights.svg'
+ source: valueSource.is_BeamOn ? './images/AGL_Icons_Lights_red.svg' : './images/AGL_Icons_Lights.svg'
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: height