Skip to content

Commit

Permalink
[Fabric-Sync] Initial version of fabric-sync example
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Oct 18, 2024
1 parent 3a6c545 commit f23a1c3
Show file tree
Hide file tree
Showing 10 changed files with 6,866 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/fabric-sync/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
import("//args.gni")
}
45 changes: 45 additions & 0 deletions examples/fabric-sync/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/lib/lib.gni")

assert(chip_build_tools)

executable("fabric-sync") {
cflags = [ "-Wconversion" ]

include_dirs = [
".",
"${chip_root}/src/lib",
]

sources = [ "main.cpp" ]

deps = [
"${chip_root}/examples/fabric-sync/bridge:fabric-bridge-lib",
"${chip_root}/examples/fabric-sync/bridge:fabric-bridge-zap",
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/src/lib",
"${chip_root}/third_party/inipp",
]

output_dir = root_out_dir
}

group("default") {
deps = [ ":fabric-sync" ]
}
40 changes: 40 additions & 0 deletions examples/fabric-sync/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")

import("${chip_root}/config/standalone/args.gni")

chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
chip_project_config_include = "<CHIPProjectAppConfig.h>"
chip_system_project_config_include = "<SystemProjectConfig.h>"

chip_project_config_include_dirs =
[ "${chip_root}/examples/fabric-sync/bridge/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]

chip_build_libshell = true

chip_enable_additional_data_advertising = true

chip_enable_rotating_device_id = true

chip_config_network_layer_ble = false

matter_enable_tracing_support = true
matter_log_json_payload_hex = true
matter_log_json_payload_decode_full = true

# Thread devices do not support WakeOnLan because their mac address is >48bit
chip_enable_openthread = false
51 changes: 51 additions & 0 deletions examples/fabric-sync/bridge/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/src/app/chip_data_model.gni")
import("${chip_root}/src/lib/lib.gni")

config("config") {
include_dirs = [ "include" ]
}

chip_data_model("fabric-bridge-zap") {
zap_file = "fabric-bridge.zap"
is_server = true
cflags = [ "-DDYNAMIC_ENDPOINT_COUNT=16" ]
}

# This includes all the clusters that only exist on the dynamic endpoint.
source_set("fabric-bridge-common") {
public_configs = [ ":config" ]

sources = [
"${chip_root}/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp",
"${chip_root}/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h",
]

public_deps = [ ":fabric-bridge-zap" ]
}

source_set("fabric-bridge-lib") {
public_configs = [ ":config" ]

sources = [ "include/CHIPProjectAppConfig.h" ]

deps = [
"${chip_root}/examples/fabric-sync/bridge:fabric-bridge-common",
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/src/lib",
]
}
Loading

0 comments on commit f23a1c3

Please sign in to comment.