Skip to content

Feat/238 implement native c grpc reader in qt - #285

Merged
Zahhask45 merged 26 commits into
masterfrom
feat/238-implement-native-c-grpc-reader-in-qt
Dec 16, 2025
Merged

Feat/238 implement native c grpc reader in qt#285
Zahhask45 merged 26 commits into
masterfrom
feat/238-implement-native-c-grpc-reader-in-qt

Conversation

@melaniereis

@melaniereis melaniereis commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Pull Request

Related issue(s): closes #24

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

This PR implements a hybrid data ingestion architecture for the Qt Dashboard, allowing it to consume vehicle speed data from either the direct CAN bus (via SocketCAN) or the KUKSA Databroker (via gRPC).

Key Changes:

  • CMake Build System: Updated CMakeLists.txt to find and link native gRPC, Protobuf, and absl libraries. Added custom commands to auto-generate C++ sources from val.proto and types.proto.
  • KuksaReader Class: Implemented a new KUKSAReader class inheriting from QObject. It manages the gRPC channel and subscription loop.
  • Worker Threading: The gRPC Subscribe loop is blocking, so KUKSAReader is moved to a dedicated QThread in main.cpp to prevent freezing the UI.
  • Runtime Switching: Implemented QCommandLineParser in main.cpp. Users can now switch modes at runtime using the --kuksa or -k flag.
  • Wiring: Signals from either CANReader or KUKSAReader are dynamically connected to VehicleData slots based on the startup arguments.

How to test / Validation

1. Setup (Virtual CAN)
If running locally, ensure vcan0 is up:

sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0

2. Test Default Mode (CAN)
Run the application without arguments. It should attempt to open vcan0:

./myqtapp
# Expected output: "Starting in CAN mode" ... "CAN device opened on interface vcan0"

Send CAN frames (e.g., using cangen vcan0) and verify the dashboard updates.

3. Test KUKSA Mode (gRPC)
Run the application with the flag. Ensure a Databroker instance is running on localhost:55555.

./myqtapp --kuksa
# Expected output: "Starting in KUKSA mode" ... "KuksaReader: Connected and Subscribed"

Publish speed updates to the broker and verify the dashboard updates.

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

  • Linker Issues: This PR introduces dependencies on grpc, protobuf, and abseil-cpp. The Yocto recipe must be updated to include these packages (DEPENDS and RDEPENDS) to avoid "Symbol Lookup Errors" on the target hardware.
  • Backward Compatibility: Fully compatible. The default behavior remains CAN mode, so existing startup scripts will continue to work unchanged.

Related / dependent PRs

  • Requires the corresponding update to the Yocto recipe qt-app_git.bb to add grpc dependencies.

Approval: Requires a minimum of 2 approvals.

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

…start method with connection and subscription logic
@melaniereis melaniereis self-assigned this Dec 16, 2025
@melaniereis melaniereis added the enhancement New feature or request label Dec 16, 2025
@melaniereis melaniereis linked an issue Dec 16, 2025 that may be closed by this pull request
6 tasks
@github-actions

Copy link
Copy Markdown

✅ STM32 CI: Threadx.elf was built successfully.

@github-actions

Copy link
Copy Markdown

🔍 TSF Validation Results

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

📋 Lint Output (first 500 chars)

@Zahhask45 Zahhask45 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything looks great! I don't see any issues.

@Hugofslopes Hugofslopes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks ok, a lot of comments that help to understand the new code added. Good job Melanie!

@Zahhask45
Zahhask45 merged commit 141d090 into master Dec 16, 2025
8 checks passed
@Zahhask45
Zahhask45 deleted the feat/238-implement-native-c-grpc-reader-in-qt branch December 16, 2025 13:29
melaniereis pushed a commit that referenced this pull request May 13, 2026
…c-reader-in-qt

Feat/238 implement native c grpc reader in qt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Native C++ gRPC Reader in Qt

3 participants