Complete raspberry pi cpp implementation#25
Conversation
This commit introduces several key features: - A robust HTTP client using libcurl for network communication. - MQTT integration for hardware control and status updates. - Enhanced UI adapters (Web, Mobile, Voice, Text) with basic functionality. - Improved TCP socket handling and error management. Co-authored-by: dallheimal <dallheimal@gmail.com>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: dallheimal <dallheimal@gmail.com>
Co-authored-by: dallheimal <dallheimal@gmail.com>
This commit consolidates multiple GitHub Actions workflows into a single `main.yml` file, simplifying the CI/CD process and improving maintainability. The new workflow includes comprehensive security scanning, code quality checks, multi-platform builds, testing, and deployment. Co-authored-by: dallheimal <dallheimal@gmail.com>
Co-authored-by: dallheimal <dallheimal@gmail.com>
Update docker tag format to use short sha and upgrade upload-artifact to v4. Co-authored-by: dallheimal <dallheimal@gmail.com>
Co-authored-by: dallheimal <dallheimal@gmail.com>
Co-authored-by: dallheimal <dallheimal@gmail.com>
Co-authored-by: dallheimal <dallheimal@gmail.com>
… build steps, fix security report paths
…le paths from config
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| uses: aquasecurity/trivy-action@master | ||
| with: | ||
| image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/core-orchestrator:latest' | ||
| image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/core-orchestrator:sha-${{ github.sha }}' |
There was a problem hiding this comment.
Bug: SHA format mismatch causes image scans to fail
The Trivy vulnerability scans reference images using sha-${{ github.sha }} (full 40-character SHA), but the docker/metadata-action creates tags with type=sha,prefix=sha-,format=short which produces only 7 characters (e.g., sha-a1b2c3d). This mismatch means the security scans will never find the images they're supposed to scan, silently defeating the purpose of vulnerability scanning.
Additional Locations (1)
.github/workflows/main.yml
Outdated
| name: 📱 Android Build | ||
| runs-on: ubuntu-latest | ||
| needs: [security] | ||
| if: contains(github.event.head_commit.message, '[android]') || contains(join(github.event.commits.*.message), 'android/') || github.event_name == 'workflow_dispatch' |
There was a problem hiding this comment.
Bug: Conditional builds check messages instead of modified files
The android-build and esp32-build jobs use contains(join(github.event.commits.*.message), 'android/') which checks commit messages for the string android/, not whether files in the android/ directory were modified. The documentation and the docs job pattern suggest the intent is to trigger on file changes using *.modified. As written, these builds will only trigger if developers literally write android/ or esp32/ in their commit message, not when they actually change files in those directories.
Additional Locations (1)
🔧 Comprehensive Fix for PR #25 IssuesI've analyzed the Cursor Bugbot findings and identified the following issues to fix: 1. ❌
|
| Issue | File(s) | Priority | Impact |
|---|---|---|---|
.directory file |
.directory, .gitignore |
High | Repository hygiene |
| Build trigger logic | .github/workflows/main.yml |
Critical | Builds not running correctly |
| SHA format mismatch | .github/workflows/docker-multiplatform.yml |
Critical | Security scans silently failing |
| Error masking | .github/workflows/main.yml |
Medium | Hidden failures |
Would you like me to create a branch with all these fixes applied? I can prepare the exact changes needed for all workflow files.
|
@cursor Please apply the following fixes to this PR:
Please commit these changes with the message: |
|
All requested fixes applied. Summary: Applied fixes1. Removed
|
Co-authored-by: dallheimal <dallheimal@gmail.com>
…build tooling - Add sparetools as git submodule for zero-copy Python/Conan bootstrap - Add Arduino LED MCP bridge for hardware control via serial - Add tools directory with bootstrap.sh, env.sh, and build helper scripts - Add comprehensive RASPBERRY_PI_SETUP.md documentation - Update README with new zero-copy bootstrap instructions - Improve build-hardware-server.sh to auto-detect bundled environment - Add pyserial to hardware-bridge requirements for Arduino support - Update .gitignore for new build directories
- Remove external/sparetools git submodule (use Cloudsmith packages instead) - Simplify tools/bootstrap.sh - remove submodule fallback - Simplify tools/init.sh - remove submodule checks - Update documentation to reflect Cloudsmith-only approach - Add MILESTONE_COMPLETE.md documenting completed features The sparetools packages (sparetools-cpython/3.12.7) are available from Cloudsmith remote: https://dl.cloudsmith.io/public/sparesparrow-conan/openssl-conan/conan/ This removes unnecessary complexity while maintaining zero-copy Python environment functionality.
- zlib: 1.2.13 → 1.3.1 (fixes cmake_minimum_required < 3.5 error) - openssl: 3.0.8 → 3.4.0 - libcurl: 8.5.0 → 8.11.1 - jsoncpp: 1.9.5 → 1.9.6 - flatbuffers: 23.5.26 → 24.3.25 - libgpiod: 1.6.3 → 2.1.3 The Raspberry Pi has CMake 4.x which removed compatibility with cmake_minimum_required < 3.5. Older package versions fail to build.
| integration-tests: | ||
| name: 🧪 Integration Tests | ||
| runs-on: ubuntu-latest | ||
| needs: [python-tests, cpp-builds, docker-builds] |
There was a problem hiding this comment.
Bug: Integration tests skipped on PRs due to unnecessary dependency
The integration-tests job specifies needs: [python-tests, cpp-builds, docker-builds], but docker-builds only runs on push events to main/develop branches (line 362). When a job in needs is skipped, dependent jobs are also skipped by GitHub Actions. This means integration-tests will never run on pull requests. However, the integration tests use docker-compose -f docker-compose.dev.yml and don't actually consume any artifacts from docker-builds, making this dependency incorrect. The job should likely only depend on python-tests and cpp-builds.
sparetools-cpython is not available on Cloudsmith.
- conanfile.py: Use package versions that exist on Conan Center - libcurl: 8.11.1 → 8.10.1 (8.11.1 not available) - openssl: 3.4.0 → 3.3.2 (3.4.0 not available) - libgpiod: 2.1.3 → 2.0.2 (2.1.3 not available) - install-deps-rpi.sh: Fix package names for Debian Trixie - Remove libgpiod2 (doesn't exist, libgpiod3 is installed via libgpiod-dev) - Add flatbuffers-compiler and libflatbuffers-dev - CMakeLists.txt: Fix pkg-config module name - mosquitto → libmosquitto (correct name on Debian) - tools/build.sh: Add missing build script - Supports system libraries and Conan toolchain - Auto-detects Ninja or Make - Supports --clean, --debug, --release flags
- FlatBuffersRequestReader.cpp: Use flatbuffers::GetRoot<T>() and Message union - FlatBuffersResponseReader.cpp: Use flatbuffers::GetRoot<T>() for all response types - FlatBuffersResponseWriter.cpp: Fix DownloadStatusResponse type - IResponseWriter.h: Use DownloadStatusResponse (matches schema) The FlatBuffers 24.x API no longer generates GetXxx() functions. Use flatbuffers::GetRoot<Type>() instead.
- Move DownloadResponse, StatusResponse, ErrorResponse structs to IResponseWriter.h - IResponseReader.h now includes IResponseWriter.h for these types - FlatBuffersResponseWriter uses local structs and converts to FlatBuffers - Fixes duplicate definition issues
- CMakeLists-rpi-minimal.txt: Standalone CMake config for hardware-server - No FlatBuffers dependency - Only requires jsoncpp, libgpiod, and optionally libmosquitto - build-hardware-server-rpi.sh: Build script for the minimal config - Supports --clean flag - Auto-detects Ninja or Make This allows building just the hardware-server on Raspberry Pi without the complex FlatBuffers infrastructure that has compatibility issues.
- HardwareControlServer.h: Use gpiod.h C API instead of gpiod.hpp C++ bindings - HardwareControlServer.cpp: Rewrite GPIO code for libgpiod 2.x C API - Uses gpiod_chip_request_lines() for line requests - Uses gpiod_line_request_set_value/get_value for I/O - Proper cleanup with gpiod_line_request_release() - Thread-safe with gpioMutex - Supports both gpiochip0 and gpiochip4 (Raspberry Pi 5) The C API is more stable across libgpiod versions and provides better compatibility than the C++ bindings which changed significantly between 1.x and 2.x.
| needs: [security] | ||
| if: | | ||
| contains(join(github.event.commits.*.message), 'docs/') || | ||
| contains(join(github.event.commits.*.message), 'mkdocs.yml') || |
There was a problem hiding this comment.
Bug: Docs job incorrectly triggers on commit message text
The documentation job condition checks if commit messages contain the strings 'docs/' or 'mkdocs.yml' using contains(join(github.event.commits.*.message), ...). This causes false triggers when developers mention these strings in commit messages without actually modifying documentation files. The intended behavior is to trigger on file changes, not commit message content. Lines 486-487 correctly check modified files; lines 484-485 appear to be erroneous and would cause unintended documentation builds.
Phase 1: Core Manager Implementations - BLEManager: Nordic BLE Library integration with device scanning, connection state management, auto-reconnect with exponential backoff - OBDManager: ELM327 protocol with PID polling (fuel, RPM, speed, coolant, engine load), DTC reading/clearing, adaptive sampling modes - ANPRManager: CameraX + ML Kit text recognition, region-specific heuristics (CZ/EU), privacy-preserving plate hashing, confidence filtering - VoiceManager: TTS with Czech/English locales, priority queue, audio focus handling - DVRManager: CameraX video recording with rolling buffer, event clip extraction, storage management Phase 2: Enhanced UI Components - CameraPreviewScreen: Camera preview with ANPR detection overlay - OBDPairingScreen: BLE device scanner with signal indicators - Enhanced Gauges: Circular speedometer/RPM with animations, compact gauges for fuel/coolant/load Phase 3: Testing Implementation - Unit tests: OBDManager, BLEManager, VoiceManager, DVRManager, SystemPolicyManager, Backoff - Integration tests: Database, EventRepository - UI tests: DashboardScreen, SettingsScreen Phase 4: Build and CI Enhancements - Updated build.gradle with test coverage configuration - Enhanced build-in-docker.sh with --test, --lint, --coverage options - Created android-ci.yml GitHub Actions workflow Phase 5: Documentation - Comprehensive README.md with architecture, features, setup, building, testing, and contribution guidelines
- Remove unused kotlinx.coroutines.tasks.await import in ANPRManager - Fix return type mismatches for suspend functions using withContext - Change VIDEO_QUALITY from const val to val (Quality is not primitive)
Completes pending C++ features for Raspberry Pi, implementing HTTP client, FlatBuffers I/O, MQTT, TTS/STT, and a basic HTTP server to finalize platform functionality.
Note
Finalizes Raspberry Pi C++ platform (HTTP, FlatBuffers, GPIO/MQTT, TTS/STT, web server), adds hardware bridge with Arduino LED control, introduces build/deploy scripts and docs, updates Dockerfiles, and consolidates CI into a main workflow.
CoreOrchestratorHTTP calls (libcurl), robust FlatBuffers I/O, and fixedTcpSocket/TcpListener.HardwareControlServerusinglibgpiodC API and MQTT (mosquitto) with status/cleanup.main_raspberry_pientrypoint and comprehensive unit tests..tool-versions,.gitignoreupdates.core-orchestrator,ai-audio-assistant,hardware-bridge,ai-security), edge image..github/workflows/main.yml; enhancedocker-multiplatformtagging/context.Written by Cursor Bugbot for commit 9c03f93. This will update automatically on new commits. Configure here.