Skip to content

Implement Native C++ gRPC Reader in Qt #238

Description

@melaniereis

1 - Short description

Modify the existing Qt Dashboard (myqtapp) to support dual data ingestion modes: direct CAN Bus (via SocketCAN) and KUKSA Databroker (via gRPC). The application must determine which mode to use at runtime via command-line arguments. This involves linking against native Google gRPC libraries and implementing a threaded KuksaReader class.

2 - Tasks

  • Update CMakeLists.txt to find and link gRPC::grpc++, Protobuf::protobuf, and absl libraries.

  • Configure CMake to auto-generate C++ source code from val.proto and types.proto using protoc.

  • Create KuksaReader class (inheriting QObject) to handle gRPC communication.

  • Implement the gRPC Subscribe loop in a worker thread to prevent blocking the Qt UI.

  • Implement QCommandLineParser in main.cpp to handle the --kuksa / -k flag.

  • Wire up VehicleData slots to either CANReader or KuksaReader signals based on the runtime flag.

  • Linking: Application starts on the target without "Symbol Lookup Error" (verifying absl and grpc linking).

  • Default Mode: Running the app without arguments (./myqtapp) starts in CAN Mode (opens vcan0 socket).

  • KUKSA Mode: Running the app with ./myqtapp --kuksa starts in KUKSA Mode and attempts to connect to localhost:55555.

  • Data Flow: In KUKSA mode, incoming gRPC speed updates successfully trigger the speedometer animation in QML.

4 - Implementation Notes

  • Architecture: We are using native libgrpc++ to ensure Apache 2.0 compliance and better compatibility with AGL layers compared to QtGrpc.
  • Threading: The gRPC Read() loop is blocking, so the KuksaReader must be moved to a QThread to keep the GUI responsive.
  • Verification: Latency testing logs are included to verify performance differences between direct CAN and KUKSA paths.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions