How mehdiabidri/vision works
1. Overall shape
- This repo is a small Adaptive AUTOSAR-inspired platform split into clear layers:
- runtime/ for boot and orchestration,
- core/ for messaging and service lifecycle abstractions,
- services/ for platform services,
- hal/ for hardware-specific adapters,
- apps/ for adaptive applications.
- The architecture is event-driven and service-oriented rather than request/response or UI-centric.
2. Startup and boot pipeline
- main.cpp likely enters runtime::Startup / runtime::Runtime.
- Boot progression is modeled explicitly with BootStageEvent and ExecutionStateEvent.
- The README indicates a simulated chain such as BootROM → XBL → ABL → Kernel → Foundation Platform → Adaptive startup.
- This makes boot a first-class data flow, not just a one-time initialization step.
3. Runtime orchestration boundary
- runtime/Runtime, RuntimeContext, Startup, and HardwareInfo define the platform’s top-level execution context.
- RuntimeContext likely holds shared references to the event bus, service manager, configuration, and discovered hardware state.
- HardwareInfo acts as the dynamic “machine manifest” produced at runtime rather than baked into the build.
4. Core communication backbone
- core/EventBus.hpp is the central message bus used by all services and applications.
- Events are typed: BootStageEvent, ExecutionStateEvent, PlatformDiscoveredEvent, CameraStateEvent, Frame.
- This is the main decoupling boundary: producers publish events, consumers subscribe without direct dependencies.
5. Service lifecycle and orchestration
- core/ServiceManager.hpp and core/IService.hpp define the lifecycle contract for services.
- The service manager is responsible for initialize/start/stop sequencing and platform orchestration.
- ExecutionManager.hpp and ExecutionStateEvent.hpp suggest a separate execution-state coordination layer, similar to Adaptive exec management.
6. Foundation-platform style services
- services/PlatformDiscoveryService is the key foundation service.
- It discovers hardware at runtime and publishes PlatformDiscoveredEvent carrying HardwareInfo.
- services/LoggerService, EventMonitor, and FailureManager act as cross-cutting platform services: logging, observability, and fault handling.
7. Hardware abstraction layer
- hal/ contains adapters for environment-specific behavior:
- UsbCameraSource.hpp for real camera input,
- SimulatedBootProvider.hpp and QualcommBootProvider.hpp for boot-stage sourcing,
- IBootProvider.hpp and ICameraSource.hpp as abstraction interfaces.
- This boundary lets the same service logic run against real Linux hardware or simulated inputs.
8. Platform discovery data flow
- The README states PlatformDiscoveryService reads the real EDID from /sys/class/drm/card1-eDP-1/edid.
- That data comes from Linux GPU driver exposure, is parsed into vendor/model/resolution/year, and then published as PlatformDiscoveredEvent.
- So the flow is: Linux sysfs hardware source → discovery service → event bus → consumers.
9. Camera pipeline
- core/Frame.hpp, core/ICameraSource.hpp, services/CameraService.hpp, and hal/UsbCameraSource.hpp indicate a camera capture path.
- config/camera.yaml suggests camera parameters are externalized.
- The likely flow is: config → camera source selection/setup → frames → camera service → event bus → app consumers.
10. Adaptive application layer
- apps/DisplayApp.hpp is the main adaptive application in the tree.
- It likely subscribes to platform discovery and camera/frame events, then renders or displays current state.
- The app layer is intentionally thin and depends on services/events rather than directly touching hardware.
11. Configuration and platform utilities
- platform/ConfigurationManager.* centralizes config loading.
- platform/Logger.hpp and platform/TimeService.hpp provide shared infrastructure used by multiple services.
- These are utility boundaries, not business logic; they support services and runtime coordination.
12. External dependencies and runtime environment
- The project targets Linux and relies on real OS-exposed hardware interfaces such as /sys/class/drm/.../edid and USB webcam devices.
- CMake is the build system, which fits a native C++ runtime rather than a managed application stack.
- The architecture is therefore “embedded-style on PC Linux”: hardware-adjacent services with an AUTOSAR-like runtime model.
13. What to show in an architecture diagram
- Draw main → Startup/Runtime → ServiceManager.
- Place EventBus as the central hub connecting services and apps.
- Show hal as the hardware adapter layer feeding services.
- Show PlatformDiscoveryService consuming Linux hardware data and publishing PlatformDiscoveredEvent.
- Show CameraService consuming ICameraSource and publishing Frame/camera state.
- Show DisplayApp consuming events from the bus, not calling hardware directly.
14. Key design intent
- The repo’s main purpose is to demonstrate an AUTOSAR Adaptive-style separation of concerns:
- boot/execution management,
- service-oriented communication,
- runtime hardware discovery,
- application/service decoupling.
- The architecture is deliberately modular so individual services, boot providers, or camera sources can be swapped without changing the rest of the platform.
Main entry points: ServiceManager.hpp ServiceManager · PlatformDiscoveryService.hpp Discovery · CameraService.hpp CameraSvc · EventBus.hpp EventBus
Components 27
Runtime
Boot, orchestration, and shared execution context
- main · Program entry that starts the platform runtime
main.cpp - Startup · Coordinates boot progression and initial platform bring-up
runtime/Startup.hpp - Runtime · Top-level runtime container for services and context
runtime/Runtime.hpp - Context · Runtime context carrying config, hardware, and service references
runtime/RuntimeContext.hpp - HardwareInfo · Runtime-discovered hardware manifest
runtime/HardwareInfo.hpp
Core
Messaging and lifecycle contracts
- EventBus · Typed event backbone used by services and apps
core/EventBus.hpp - ServiceManager · Initializes, starts, and stops platform services
core/ServiceManager.hpp - ExecManager · Coordinates execution-state transitions across the platform
core/ExecutionManager.hpp - PlatformEvent · Published when hardware/platform discovery completes
core/PlatformDiscoveredEvent.hpp - BootEvent · Represents boot-stage progression through startup
core/BootStageEvent.hpp - ExecState · Represents platform execution-state changes
core/ExecutionStateEvent.hpp - CameraEvent · Carries camera state changes through the bus
core/CameraStateEvent.hpp - Frame · Camera frame payload passed to consumers
core/Frame.hpp
Services
Platform services built on the core
- Discovery · Detects hardware and publishes platform information
services/PlatformDiscoveryService.hpp - CameraSvc · Acquires camera frames and emits camera-related events
services/CameraService.hpp - LoggerSvc · Centralizes runtime logging output
services/LoggerService.hpp - Monitor · Watches platform events and runtime behavior
services/EventMonitor.hpp - FailureMgr · Handles failures and platform fault reporting
services/FailureManager.hpp
HAL
Hardware and environment adapters
- BootProvider · Abstracts boot-stage sourcing for different environments
core/IBootProvider.hpp - SimBoot · Simulated boot-stage provider
hal/SimulatedBootProvider.hpp - QualcommBoot · Target-specific boot-stage provider
hal/QualcommBootProvider.hpp - CameraSource · Abstract camera input source contract
core/ICameraSource.hpp - USB Camera · USB webcam-backed camera source
hal/UsbCameraSource.hpp
Apps
Adaptive application layer
- DisplayApp · Consumes platform and camera events to present state
apps/DisplayApp.hpp
Platform
Shared utilities and configuration
- ConfigMgr · Loads and provides platform configuration
platform/ConfigurationManager.hpp - Logger · Shared logging support used across the platform
platform/Logger.hpp - TimeService · Shared time and timing support
platform/TimeService.hpp
Connections 37
- main → Startup: starts · Entry point begins startup orchestration
- Startup → Runtime: creates · Startup initializes the runtime container
- Runtime → Context: uses · Runtime is built around shared execution context
- Context → ConfigMgr: loads · Context carries configuration into services
- Context → EventBus: provides · Event bus is shared across the platform
- Context → ServiceManager: provides · Service manager is stored in runtime context
- Startup → BootEvent: publishes · Startup reports boot progression as events
- BootProvider → SimBoot: implemented by · Simulated provider fulfills the boot contract
- BootProvider → QualcommBoot: implemented by · Target-specific provider fulfills the boot contract
- BootProvider → BootEvent: sources · Boot providers emit boot-stage events
- ServiceManager → Discovery: manages · Service manager orchestrates platform discovery
- ServiceManager → CameraSvc: manages · Service manager orchestrates camera service lifecycle
- ServiceManager → LoggerSvc: manages · Service manager orchestrates logging service lifecycle
- ServiceManager → Monitor: manages · Service manager orchestrates monitoring service lifecycle
- ServiceManager → FailureMgr: manages · Service manager orchestrates failure handling lifecycle
- Discovery → EventBus: publishes · Discovery publishes platform information to the bus
- Discovery → PlatformEvent: emits · Discovery produces platform-discovered events
- PlatformEvent → HardwareInfo: carries · Platform event transports discovered hardware info
- Discovery → HardwareInfo: builds · Discovery constructs runtime hardware manifest
- CameraSvc → EventBus: publishes · Camera service publishes frames and camera state
- CameraSvc → Frame: emits · Camera service produces frames
- CameraSvc → CameraEvent: emits · Camera service produces camera-state events
- CameraSvc → CameraSource: uses · Camera service depends on abstract camera source
- CameraSource → USB Camera: implemented by · USB camera source fulfills the input contract
- LoggerSvc → Logger: uses · Logging service relies on shared logging utility
- DisplayApp → EventBus: subscribes · Application consumes events from the bus
- DisplayApp → PlatformEvent: consumes · Application reacts to platform discovery
- DisplayApp → CameraEvent: consumes · Application reacts to camera state
- DisplayApp → Frame: consumes · Application may render or inspect frames
- ExecManager → EventBus: coordinates · Execution manager uses events to drive state transitions
- ExecManager → ExecState: publishes · Execution manager emits execution-state events
- Startup → ExecManager: hands off · Startup transfers control into execution coordination
- Discovery → ConfigMgr: reads · Discovery may use configuration to locate hardware sources
- CameraSvc → ConfigMgr: reads · Camera service uses external camera configuration
- Discovery → TimeService: timestamps · Discovery can attach timing information to events
- Monitor → EventBus: subscribes · Monitoring observes platform activity on the bus
- FailureMgr → EventBus: subscribes · Failure manager observes errors and state changes