Skip to content

Commit

Permalink
[ICD] Add LIT ICD reference app for tests and certification (#30092)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Nov 27, 2023
1 parent c4ea7ad commit 108c255
Show file tree
Hide file tree
Showing 17 changed files with 5,399 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
--target darwin-x64-ota-requestor-${BUILD_VARIANT} \
--target darwin-x64-tv-app-${BUILD_VARIANT} \
--target darwin-x64-bridge-${BUILD_VARIANT} \
--target darwin-x64-lit-icd-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/examples-linux-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
--target linux-arm64-minmdns-clang \
--target linux-arm64-light-rpc-ipv6only-clang \
--target linux-arm64-thermostat-no-ble-clang \
--target linux-arm64-lit-icd-no-ble-clang \
build \
"
- name: Bloat report - chip-tool
Expand Down
25 changes: 25 additions & 0 deletions examples/lit-icd-app/linux/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2020 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")
}
42 changes: 42 additions & 0 deletions examples/lit-icd-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) 2020 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")

executable("lit-icd-app") {
sources = [ "main.cpp" ]

deps = [
"${chip_root}/examples/lit-icd-app/lit-icd-common",
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/src/app/icd:manager",
"${chip_root}/src/lib",
"${chip_root}/third_party/jsoncpp",
]

include_dirs = [ "include" ]

cflags = [ "-Wconversion" ]

output_dir = root_out_dir
}

group("linux") {
deps = [ ":lit-icd-app" ]
}

group("default") {
deps = [ ":linux" ]
}
23 changes: 23 additions & 0 deletions examples/lit-icd-app/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) 2020 Project CHIP Authors
# All rights reserved.
#
# 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.
#

from generic_node_image
RUN apt-get install -y libglib2.0
COPY out/debug/lit-icd-app /usr/bin/
COPY entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh", "server"]
30 changes: 30 additions & 0 deletions examples/lit-icd-app/linux/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2020 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/lit-icd-app/linux/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
matter_enable_tracing_support = true

# ICD configurations
chip_enable_icd_server = true
chip_subscription_timeout_resumption = false
1 change: 1 addition & 0 deletions examples/lit-icd-app/linux/build_overrides
29 changes: 29 additions & 0 deletions examples/lit-icd-app/linux/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

#
# Copyright (c) 2020 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.
#

set -ex

service dbus start
sleep 1
/usr/sbin/otbr-agent -I wpan0 spinel+hdlc+uart:///dev/ttyUSB0 &
sleep 1
ot-ctl panid 0x1234
ot-ctl ifconfig up
ot-ctl thread start

lit-icd-app
42 changes: 42 additions & 0 deletions examples/lit-icd-app/linux/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* 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.
*/

/**
* @file
* Example project configuration file for CHIP.
*
* This is a place to put application or project-specific overrides
* to the default configuration values for general CHIP features.
*
*/

#pragma once

// include the CHIPProjectConfig from config/standalone
#include <CHIPProjectConfig.h>

// Allows app options (ports) to be configured on launch of app
#define CHIP_DEVICE_ENABLE_PORT_PARAMS 1

// Enable subscriptions synchronization
#define CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED 1

// ICD configurations
#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC 3600
#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS 10000
#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS 1000
40 changes: 40 additions & 0 deletions examples/lit-icd-app/linux/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* All rights reserved.
*
* 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.
*/

#include "AppMain.h"
#include <app-common/zap-generated/ids/Clusters.h>

using namespace chip;
using namespace chip::app;

void ApplicationInit() {}

void ApplicationShutdown() {}

int main(int argc, char * argv[])
{
VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0);
ChipLinuxAppMainLoop();
return 0;
}

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
uint8_t * value)
{
// TODO: Watch ICDM Cluster changes
}
1 change: 1 addition & 0 deletions examples/lit-icd-app/linux/third_party/connectedhomeip
24 changes: 24 additions & 0 deletions examples/lit-icd-app/lit-icd-common/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2020 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")

chip_data_model("lit-icd-common") {
zap_file = "lit-icd-server-app.zap"

zap_pregenerated_dir =
"${chip_root}/zzz_generated/lit-icd-server-app/zap-generated"
is_server = true
}
Loading

0 comments on commit 108c255

Please sign in to comment.