Skip to content

Commit 9992065

Browse files
mkardous-silabspull[bot]
authored andcommitted
[ICD] Add LIT ICD reference app for tests and certification (#30092)
* Initial example creation * intial clean up * update build.gb * update build configs * correct build.gn * Add example to CI * zap regen * update linux targets * Add default config for user active trigger * remove clusters that shouldn't be on endpoint 0 * fix device conformance
1 parent 9a6565f commit 9992065

17 files changed

+5399
-1
lines changed

.github/workflows/darwin-tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
--target darwin-x64-ota-requestor-${BUILD_VARIANT} \
9999
--target darwin-x64-tv-app-${BUILD_VARIANT} \
100100
--target darwin-x64-bridge-${BUILD_VARIANT} \
101+
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
101102
build \
102103
--copy-artifacts-to objdir-clone \
103104
"

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

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
--target linux-arm64-minmdns-clang \
6565
--target linux-arm64-light-rpc-ipv6only-clang \
6666
--target linux-arm64-thermostat-no-ble-clang \
67+
--target linux-arm64-lit-icd-no-ble-clang \
6768
build \
6869
"
6970
- name: Bloat report - chip-tool

examples/lit-icd-app/linux/.gn

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2020 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/lit-icd-app/linux/BUILD.gn

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2020 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+
executable("lit-icd-app") {
19+
sources = [ "main.cpp" ]
20+
21+
deps = [
22+
"${chip_root}/examples/lit-icd-app/lit-icd-common",
23+
"${chip_root}/examples/platform/linux:app-main",
24+
"${chip_root}/src/app/icd:manager",
25+
"${chip_root}/src/lib",
26+
"${chip_root}/third_party/jsoncpp",
27+
]
28+
29+
include_dirs = [ "include" ]
30+
31+
cflags = [ "-Wconversion" ]
32+
33+
output_dir = root_out_dir
34+
}
35+
36+
group("linux") {
37+
deps = [ ":lit-icd-app" ]
38+
}
39+
40+
group("default") {
41+
deps = [ ":linux" ]
42+
}

examples/lit-icd-app/linux/Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# Copyright (c) 2020 Project CHIP Authors
3+
# All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
from generic_node_image
19+
RUN apt-get install -y libglib2.0
20+
COPY out/debug/lit-icd-app /usr/bin/
21+
COPY entrypoint.sh /
22+
23+
ENTRYPOINT ["/entrypoint.sh", "server"]

examples/lit-icd-app/linux/args.gni

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2020 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/lit-icd-app/linux/include" ]
25+
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
26+
matter_enable_tracing_support = true
27+
28+
# ICD configurations
29+
chip_enable_icd_server = true
30+
chip_subscription_timeout_resumption = false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../build_overrides
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (c) 2020 Project CHIP Authors
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
set -ex
20+
21+
service dbus start
22+
sleep 1
23+
/usr/sbin/otbr-agent -I wpan0 spinel+hdlc+uart:///dev/ttyUSB0 &
24+
sleep 1
25+
ot-ctl panid 0x1234
26+
ot-ctl ifconfig up
27+
ot-ctl thread start
28+
29+
lit-icd-app
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
*
3+
* Copyright (c) 2022 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/**
20+
* @file
21+
* Example project configuration file for CHIP.
22+
*
23+
* This is a place to put application or project-specific overrides
24+
* to the default configuration values for general CHIP features.
25+
*
26+
*/
27+
28+
#pragma once
29+
30+
// include the CHIPProjectConfig from config/standalone
31+
#include <CHIPProjectConfig.h>
32+
33+
// Allows app options (ports) to be configured on launch of app
34+
#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1
35+
36+
// Enable subscriptions synchronization
37+
#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 1
38+
39+
// ICD configurations
40+
#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC 3600
41+
#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS 10000
42+
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS 1000

examples/lit-icd-app/linux/main.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
*
3+
* Copyright (c) 2020 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include "AppMain.h"
20+
#include <app-common/zap-generated/ids/Clusters.h>
21+
22+
using namespace chip;
23+
using namespace chip::app;
24+
25+
void ApplicationInit() {}
26+
27+
void ApplicationShutdown() {}
28+
29+
int main(int argc, char * argv[])
30+
{
31+
VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0);
32+
ChipLinuxAppMainLoop();
33+
return 0;
34+
}
35+
36+
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
37+
uint8_t * value)
38+
{
39+
// TODO: Watch ICDM Cluster changes
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2020 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+
import("${chip_root}/src/app/chip_data_model.gni")
17+
18+
chip_data_model("lit-icd-common") {
19+
zap_file = "lit-icd-server-app.zap"
20+
21+
zap_pregenerated_dir =
22+
"${chip_root}/zzz_generated/lit-icd-server-app/zap-generated"
23+
is_server = true
24+
}

0 commit comments

Comments
 (0)