How giselle-nana/distributed_camera works
Project Type and Purpose
• This is a C++ component of the OpenHarmony distributed-hardware subsystem that provides “distributed camera” capabilities.
• It does not include a user-facing UI; instead it offers C++ interfaces to the distributed hardware framework, enabling one device (source) to control and use another device’s (sink) camera as if it were local.
High-Level Architectural Components
a. DistributedCameraSDK (Interfaces)
• The C++ API layer exposed to the distributed hardware management framework.
• Enables/disable virtual cameras and reports camera status.
b. DistributedCameraSourceMgr (Source Manager)
• State-machine–based lifecycle manager on the source side.
• Negotiates parameters, creates/destroys source-side objects, initiates camera commands.
c. DistributedCameraSinkMgr (Sink Manager)
• State-machine–based lifecycle manager on the sink side.
• Negotiates parameters, creates/destroys sink-side objects, receives commands, obtains local camera data.
d. Channel Module (SoftBus)
• Bi-directional IPC/transport layer between source and sink.
• Carries control commands (source→sink) and image/stream data (sink→source).
e. DataProcess Module
f. CameraClient & VirtualCameraHdf
• Sink side: CameraClient calls local multimedia APIs to open/close camera and obtain raw frames.
• VirtualCameraHdf implements a virtual HDF camera driver so that the media framework discovers and uses the distributed camera as if it were local.
g. Common & Interfaces (Inner Kits)
• Utility code (data buffers, tracing, errors) in common/.
• IPC stubs, proxies, load callbacks in interfaces/inner_kits/native_cpp/{camera_source, camera_sink}.
h. SA Profile
• Configuration files and build scripts under sa_profile/.
Relationships and Data Flows
• The distributed-hardware framework calls DistributedCameraSDK APIs → SourceMgr.
• SourceMgr sends control commands over Channel → SinkMgr.
• SinkMgr invokes CameraClient → local camera driver → raw frames → DataProcess → Channel → SourceMgr.
• SourceMgr or VirtualCameraHdf publishes frames into the local multimedia framework → application.
Architectural Patterns and Principles
• State-machine for lifecycle management (source and sink managers)
• Layered separation: SDK interface → managers → channel/process → hardware driver
• IPC decoupling via SoftBus Channel module
• Plugin-style virtual driver in HDF