Skip to content

Feat/761 signal bridge between backend and qml#786

Open
melaniereis wants to merge 16 commits into
masterfrom
feat/761-signal-bridge-between-backend-and-qml
Open

Feat/761 signal bridge between backend and qml#786
melaniereis wants to merge 16 commits into
masterfrom
feat/761-signal-bridge-between-backend-and-qml

Conversation

@melaniereis

@melaniereis melaniereis commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Related issue(s): closes #761

Type of change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Formatting, missing semicolons, etc (no code change)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding or updating tests
  • ci: CI configuration changes
  • chore: Maintenance tasks
  • spike: Investigation / research

Summary

Implemented the communication bridge between the C++ backend logic and the QML layer to translate validated V2X CAN signals into real-time UI state changes for emergency alerts. Also fixed deployment/cache issues preventing the new binary from running on the target.

Key Implementation Details:

  • Added HandleV2XEmergency to kuksa_feeder to decode the CAN frame (ID 0x500) and publish the priority level to the KUKSA Databroker (Vehicle.ADAS.V2X.EmergencyPriority).
  • Registered the new handler in the Feeder's O(1) CAN dispatch table.
  • Updated KuksaReader and CanReader to emit the emergencyAlertReceived signal upon detecting state changes.
  • Connected the readers to VehicleData via AppController using Qt::QueuedConnection to guarantee thread safety.
  • Updated ClusterScreen.qml with a Connections block to dynamically trigger the EmergencyAlert component based on priority levels (1 = Warning, 2 = High Priority) and added a 15-second HMI failsafe timeout.

How to test / Validation

  1. Build the updated qt-app RPM via Bitbake (bitbake -c cleansstate qt-app && bitbake qt-app) and force install it on the Raspberry Pi 5 (dnf reinstall -y /tmp/qt-app-*.rpm).
  2. Ensure the KUKSA Databroker is running and the system clock is synced (to prevent TLS cert errors).
  3. Start the KUKSA Feeder with TLS enabled:
kuksa_feeder --tls --ca /etc/kuksa/ca.crt
  1. Start the DrivaPi Dashboard (systemctl start drivapi-dashboard).
  2. In a separate terminal on the target, inject the high-priority CAN frame:
cansend can1 500#02

Expected Output: The Feeder logs [Handler] Published Vehicle.ADAS.V2X.EmergencyPriority = 2 and the red "PULL OVER - EMERGENCY" banner immediately drops down in the UI.
6. Inject the clear command:

cansend can1 500#00

Expected Output: The UI banner retracts instantly.

Checklist

  • I have run the project tests locally and they pass
  • CI checks are green for this branch (or I will fix any failures)
  • I have added or updated tests where applicable
  • I have updated documentation (if applicable)
  • I have added/updated any migration notes (if database or protocol changes)
  • I have requested appropriate reviewers and added labels if needed
  • This PR contains no secrets or sensitive data

Risks and backward compatibility

  • CAN ID Strictness: The system expects the CAN ID to be sent as Hexadecimal 0x500 (1280 Decimal) from the STM32.
  • VSS Datatype: The Feeder pushes the priority level as a Float (or matching type). Ensure the Databroker's vss.json schema matches this.

Related / dependent PRs

Depends on #760.


Approval: Requires a minimum of 2 approvals.

Action: The feature branch MUST be deleted upon successful merge.

@melaniereis melaniereis linked an issue Jun 18, 2026 that may be closed by this pull request
5 tasks
@melaniereis melaniereis self-assigned this Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

✅ STM32 CI: firmware build succeeded

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

🔍 TSF Validation Results

Check Status
trudag lint ✅ PASSED
trudag score ✅ PASSED
trudag publish ✅ PASSED

📋 Lint Output

WARNING: Unreviewed Item: HLTC-INT-PS3_DECODE_VALIDATE
WARNING: Unreviewed Item: LLTC-DC_MOTOR_UNIT
WARNING: Unreviewed Item: LLTC-SERVO_MOTOR_UNIT
WARNING: Unreviewed Item: LLTC-SPEED_SENSOR_UNIT
WARNING: Unreviewed Item: SWD-DC_MOTOR_DRIVER
WARNING: Unreviewed Item: SWD-SERVO_DRIVER
WARNING: Unreviewed Item: SWD-SPEED_CALC
WARNING: Suspect Link: SRD-ACT-MOTOR_DRIVE -> SWD-DC_MOTOR_DRIVER
WARNING: Suspect Link: SRD-ACT-SERVO_STEER -> SWD-SERVO_DRIVER
WARNING: Suspect Link: SRD-SENS-ENCODER_SPD 

📊 Traceability Graph

✅ Graph generated successfully

Download artifacts to view: TSF Validation Results

  • Traceability graph: tsf-validation-artifacts/traceability_graph.svg
  • Full TSF reports in artifact archive

🧪 Unit Test Results

Overall Status: ✅ PASSED

  • DC Motor Tests: PASSED (11/11)
  • Servo Motor Tests: PASSED (5/5)
  • Speed Sensor Tests: PASSED (16/16)
  • Total: 32 tests

📊 Coverage

Coverage report available in artifacts.

🔍 Coverage Change Validation

  • dc-motor: score=1.00 issues=[]
  • servo-motor: score=1.00 issues=[]
  • speed-sensor: score=1.00 issues=[]

Full coverage reports available in workflow artifacts


🔒 CodeQL (filtered SARIF summary)

Severity Count
High/Critical (error) 0
Warnings 0
Notes 0

🧪 Unit Test Results

Overall Status: ✅ PASSED

  • DC Motor Tests: PASSED (11/11)
  • Servo Motor Tests: PASSED (5/5)
  • Speed Sensor Tests: PASSED (16/16)
  • Total: 32 tests

📊 Coverage

Coverage report available in artifacts.

🔍 Coverage Change Validation

  • dc-motor: score=1.00 issues=[]
  • servo-motor: score=1.00 issues=[]
  • speed-sensor: score=1.00 issues=[]

Full coverage reports available in workflow artifacts

Run: https://github.com/SEAME-pt/Team04_DrivaPi/actions/runs/27942709949

@AfonsoMota-132 AfonsoMota-132 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal Bridge between Backend and QML

2 participants