Skip to content

Commit 5becd81

Browse files
authored
Initial implementation of camera-controller app (#37835)
* Initial implemenation of camera-controller app * Fix build errors * Remove ICD stuff since it is not needed for camera
1 parent e7a2952 commit 5becd81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+8790
-2
lines changed

.github/workflows/examples-linux-standalone.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,17 @@ jobs:
238238
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
239239
linux debug camera-app \
240240
out/linux-x64-camera/chip-camera-app \
241-
/tmp/bloat_reports/
241+
/tmp/bloat_reports/
242+
- name: Build example Camera Controller App
243+
run: |
244+
./scripts/run_in_build_env.sh \
245+
"./scripts/build/build_examples.py \
246+
--target linux-x64-camera-controller \
247+
build"
248+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
249+
linux debug camera-controller \
250+
out/linux-x64-camera-controller/camera-controller \
251+
/tmp/bloat_reports/
242252
- name: Uploading Size Reports
243253
uses: ./.github/actions/upload-size-reports
244254
if: ${{ !env.ACT }}

docs/examples/camera_controller.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Camera
2+
3+
```{toctree}
4+
:glob:
5+
:maxdepth: 1
6+
7+
camera-controller/README
8+
```

examples/camera-controller/.gn

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
import("//args.gni")
25+
}

examples/camera-controller/BUILD.gn

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
18+
import("//build_overrides/editline.gni")
19+
import("${chip_root}/build/chip/tools.gni")
20+
import("${chip_root}/examples/camera-controller/camera-controller.gni")
21+
import("${chip_root}/src/lib/core/core.gni")
22+
23+
assert(chip_build_tools)
24+
25+
config("config") {
26+
include_dirs = [
27+
".",
28+
"${chip_root}/examples/common",
29+
"${chip_root}/zzz_generated/app-common/app-common",
30+
"${chip_root}/zzz_generated/chip-tool",
31+
"${chip_root}/src/lib",
32+
]
33+
34+
defines = [ "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop}" ]
35+
36+
# Note: CONFIG_USE_LOCAL_STORAGE is tested for via #ifdef, not #if.
37+
if (config_use_local_storage) {
38+
defines += [ "CONFIG_USE_LOCAL_STORAGE" ]
39+
}
40+
}
41+
42+
static_library("camera-controller-utils") {
43+
sources = [
44+
"${chip_root}/src/controller/ExamplePersistentStorage.cpp",
45+
"${chip_root}/src/controller/ExamplePersistentStorage.h",
46+
"${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp",
47+
"${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp",
48+
"commands/clusters/ModelCommand.cpp",
49+
"commands/clusters/ModelCommand.h",
50+
"commands/clusters/ReportCommand.cpp",
51+
"commands/clusters/ReportCommand.h",
52+
"commands/common/CHIPCommand.cpp",
53+
"commands/common/CHIPCommand.h",
54+
"commands/common/Command.cpp",
55+
"commands/common/Command.h",
56+
"commands/common/Commands.cpp",
57+
"commands/common/Commands.h",
58+
"commands/common/CredentialIssuerCommands.h",
59+
"commands/common/HexConversion.h",
60+
"commands/common/RemoteDataModelLogger.cpp",
61+
"commands/common/RemoteDataModelLogger.h",
62+
"commands/pairing/OpenCommissioningWindowCommand.cpp",
63+
"commands/pairing/OpenCommissioningWindowCommand.h",
64+
"commands/pairing/PairingCommand.cpp",
65+
"commands/pairing/ToTLVCert.cpp",
66+
]
67+
68+
deps = [ "${chip_root}/src/app:events" ]
69+
70+
sources += [ "commands/interactive/InteractiveCommands.cpp" ]
71+
deps += [
72+
"${chip_root}/src/platform/logging:headers",
73+
"${editline_root}:editline",
74+
]
75+
76+
if (chip_device_platform == "darwin") {
77+
sources += [ "commands/common/DeviceScanner.cpp" ]
78+
}
79+
80+
public_deps = [
81+
"${chip_root}/examples/common/tracing:commandline",
82+
"${chip_root}/src/app/server",
83+
"${chip_root}/src/app/tests/suites/commands/interaction_model",
84+
"${chip_root}/src/controller/data_model",
85+
"${chip_root}/src/credentials:file_attestation_trust_store",
86+
"${chip_root}/src/lib",
87+
"${chip_root}/src/lib/core:types",
88+
"${chip_root}/src/lib/support/jsontlv",
89+
"${chip_root}/src/platform",
90+
"${chip_root}/third_party/inipp",
91+
"${chip_root}/third_party/jsoncpp",
92+
]
93+
94+
public_configs = [ ":config" ]
95+
96+
if (chip_enable_transport_trace) {
97+
public_deps +=
98+
[ "${chip_root}/examples/common/tracing:trace_handlers_decoder" ]
99+
}
100+
101+
output_dir = root_out_dir
102+
}
103+
104+
executable("camera-controller") {
105+
sources = [ "main.cpp" ]
106+
107+
deps = [
108+
":camera-controller-utils",
109+
"${chip_root}/src/platform/logging:stdio",
110+
]
111+
112+
output_dir = root_out_dir
113+
}
114+
115+
group("default") {
116+
deps = [ ":camera-controller" ]
117+
}

examples/camera-controller/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Matter Camera Controller Example
2+
3+
This example application demonstrates the CHIP Camera Controller running on a
4+
Linux platform and explains how to build and run the Camera Controller Example
5+
on Linux.
6+
7+
In a typical setup, the Camera Controller app manages a CameraDevice app running
8+
on a Raspberry Pi. The CameraDevice captures and encodes the video feed before
9+
streaming it through a WebRTC track, while the CameraController receives this
10+
video stream and displays it, creating a complete end-to-end camera solution.
11+
12+
---
13+
14+
- [Building the Example Application](#building-the-example-application)
15+
16+
---
17+
18+
## Building the Example Application
19+
20+
For Linux host example:
21+
22+
```
23+
source scripts/activate.sh
24+
./scripts/build/build_examples.py --target linux-x64-camera-controller build
25+
```

examples/camera-controller/args.gni

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
17+
import("${chip_root}/config/standalone/args.gni")
18+
19+
chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
20+
chip_project_config_include = "<CHIPProjectAppConfig.h>"
21+
chip_system_project_config_include = "<SystemProjectConfig.h>"
22+
23+
chip_project_config_include_dirs =
24+
[ "${chip_root}/examples/camera-controller/include" ]
25+
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
26+
27+
matter_enable_tracing_support = true
28+
29+
matter_log_json_payload_hex = true
30+
matter_log_json_payload_decode_full = true
31+
32+
# make camera-controller very strict by default
33+
chip_tlv_validate_char_string_on_read = true
34+
chip_tlv_validate_char_string_on_write = true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../build_overrides
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
18+
declare_args() {
19+
# Use a separate eventloop for CHIP tasks
20+
config_use_separate_eventloop = true
21+
config_use_local_storage = true
22+
}

0 commit comments

Comments
 (0)