Skip to content

Commit

Permalink
[OIS] Add all-clusters-app Matter example (#27836)
Browse files Browse the repository at this point in the history
Add all-clusters-app implementation for OIS.
Create all-clusters-app integration tests.
Extend build script, Vscode tasks, CI with all-clusters-app.

Signed-off-by: ATmobica <artur.tynecki@arm.com>
Co-authored-by: Chris Swinchatt <christopher.swinchatt@arm.com>
  • Loading branch information
2 people authored and pull[bot] committed Jan 31, 2024
1 parent 8995a76 commit 1027481
Show file tree
Hide file tree
Showing 13 changed files with 895 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/examples-openiotsdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ jobs:
examples/tv-app/openiotsdk/build/chip-openiotsdk-tv-app-example.elf \
/tmp/bloat_reports/
- name: Build all-clusters-app example
id: build_all_clusters_app
timeout-minutes: 10
run: |
scripts/examples/openiotsdk_example.sh all-clusters-app
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
openiotsdk release all-clusters-app \
examples/all-clusters-app/openiotsdk/build/chip-openiotsdk-all-clusters-app-example.elf \
/tmp/bloat_reports/
- name: Build unit tests (mbedtls)
id: build_unit_tests_mbedtls
run: |
Expand Down Expand Up @@ -119,6 +129,15 @@ jobs:
'scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh --no-activate -C test -n ${TEST_NETWORK_NAME}tap tv-app'
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down
- name: "Test: all-clusters-app example"
if: steps.build_all_clusters_app.outcome == 'success'
timeout-minutes: 5
run: |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up
scripts/run_in_python_env.sh out/venv \
'scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh --no-activate -C test -n ${TEST_NETWORK_NAME}tap all-clusters-app'
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down
- name: "Test: unit-tests (mbedtls)"
if: steps.build_unit_tests_mbedtls.outcome == 'success'
run: |
Expand Down
1 change: 1 addition & 0 deletions docs/guides/openiotsdk_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The list of currently supported Matter examples:
shell
lock-app
tv-app
all-clusters-app
```

You can use these examples as a reference for creating your own applications.
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/openiotsdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
68 changes: 68 additions & 0 deletions examples/all-clusters-app/openiotsdk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Copyright (c) 2023 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.
#

cmake_minimum_required(VERSION 3.21)

get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH)
get_filename_component(OPEN_IOT_SDK_CONFIG ${CHIP_ROOT}/config/openiotsdk REALPATH)
get_filename_component(OPEN_IOT_SDK_EXAMPLE_COMMON ${CHIP_ROOT}/examples/platform/openiotsdk REALPATH)
get_filename_component(ALL_CLUSTERS_COMMON ${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common REALPATH)

list(APPEND CMAKE_MODULE_PATH ${OPEN_IOT_SDK_CONFIG}/cmake)

set(APP_TARGET chip-openiotsdk-all-clusters-app-example_ns)

set(TFM_PROJECT_CONFIG_HEADER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/tf-m-config/TfmProjectConfig.h")

# Toolchain files need to exist before first call to project
include(toolchain)

project(${APP_TARGET} LANGUAGES C CXX ASM)

include(sdk)

add_executable(${APP_TARGET})

# Application CHIP build configuration
include(chip)

add_subdirectory(${OPEN_IOT_SDK_EXAMPLE_COMMON}/app ./app_build)

chip_add_data_model(openiotsdk-app PUBLIC all-clusters)

target_include_directories(${APP_TARGET}
PRIVATE
main/include
${ALL_CLUSTERS_COMMON}/include
)

target_sources(${APP_TARGET}
PRIVATE
main/main_ns.cpp
${ALL_CLUSTERS_COMMON}/src/bridged-actions-stub.cpp
${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp
${ALL_CLUSTERS_COMMON}/src/binding-handler.cpp
)

target_link_libraries(${APP_TARGET}
openiotsdk-startup
openiotsdk-app
)

include(linker)
set_target_link(${APP_TARGET})

sdk_post_build(${APP_TARGET})
100 changes: 100 additions & 0 deletions examples/all-clusters-app/openiotsdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Matter Open IoT SDK All-Clusters-App Example Application

The Open IoT SDK All Clusters Example demonstrates various ZCL clusters control.

The example behaves as a Matter accessory, device that can be paired into an
existing Matter network and can be controlled by it.

You can use this example as a reference for creating your own application.

## Build-run-test-debug

For information on how to build, run, test and debug this example and further
information about the platform it is run on see
[Open IoT SDK examples](../../../docs/guides/openiotsdk_examples.md).

The example name to use in the scripts is `all-clusters-app`.

## Example output

When the example runs, these lines should be visible:

```
[INF] [-] Open IoT SDK all-clusters-app example application start
...
[INF] [-] Open IoT SDK all-clusters-app example application run
```

This means the all-clusters-app application launched correctly and you can
follow traces in the terminal.

### Commissioning

Read the
[Open IoT SDK commissioning guide](../../../docs/guides/openiotsdk_commissioning.md)
to see how to use the Matter controller to commission and control the
application.

### AccessControl cluster usage

The application fully supports the AccessControl cluster. For more details about
access control please visit
[Access Control Guide](../../../docs/guides/access-control-guide.md). Use
cluster commands to trigger actions on the device. You can issue commands
through the same Matter controller you used to perform the commissioning step
above.

Example command:

```
chip-tool accesscontrol read acl 123 0
```

The numeric arguments are: device node ID and device endpoint ID, respectively.

The device sent a response and you should see this line in the controller
output:

```
CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0000 DataVersion: 3442030892
CHIP:TOO: ACL: 1 entries
CHIP:TOO: [1]: {
CHIP:TOO: Privilege: 5
CHIP:TOO: AuthMode: 2
CHIP:TOO: Subjects: 1 entries
CHIP:TOO: [1]: 112233
CHIP:TOO: Targets: null
CHIP:TOO: FabricIndex: 1
CHIP:TOO: }
```

These are automatically installed ACL entries after commissioning.

### BasicInformation cluster usage

One of the fully supported clusters by this example is BasicInformation cluster.
Use cluster commands to trigger actions on the device. You can issue commands
through the same Matter controller you used to perform the commissioning step
above.

Example command:

```
chip-tool basicinformation read vendor-id 123 0
```

The numeric arguments are: device node ID and device endpoint ID, respectively.

The device send a response with its vendor ID number and you should see this
line in the controller output:

```
CHIP:TOO: VendorID: 65521
```

The `65521` value is the default `vendor ID` for Matter examples.

**NOTE**

More details about the `chip-tool` controller can be found
[here](../../chip-tool/README.md).
22 changes: 22 additions & 0 deletions examples/all-clusters-app/openiotsdk/cmsis-config/RTE_Components.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
*
* 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.
*/

#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H

#endif // RTE_COMPONENTS_H
Loading

0 comments on commit 1027481

Please sign in to comment.