-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OIS] Add tv-app Matter example (#27838)
* [OIS] Add CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS Add a new item of Matter build settings that pass extra include dirs for project configurations. It's used in common GN arguments function. Signed-off-by: ATmobica <[email protected]> * [OIS] Add tv-app Matter example Add tv-app implementation for OIS. Create tv-app integration tests. Extend build script, Vscode tasks, CI with tv-app. Signed-off-by: ATmobica <[email protected]> --------- Signed-off-by: ATmobica <[email protected]>
- Loading branch information
Showing
15 changed files
with
1,409 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
shell | ||
lock-app | ||
tv-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# | ||
# Copyright (c) 2022-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(TV_APP_COMMON ${CHIP_ROOT}/examples/tv-app/tv-common REALPATH) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${OPEN_IOT_SDK_CONFIG}/cmake) | ||
list(APPEND CMAKE_MODULE_PATH ${TV_APP_COMMON}) | ||
|
||
set(APP_TARGET chip-openiotsdk-tv-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 | ||
set(CONFIG_CHIP_LIB_SHELL YES) | ||
set(CONFIG_CHIP_PROJECT_CONFIG "../tv-common/include/CHIPProjectAppConfig.h") | ||
set(CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS "\"${CMAKE_CURRENT_SOURCE_DIR}/main/include\"" ) | ||
include(chip) | ||
|
||
add_subdirectory(${OPEN_IOT_SDK_EXAMPLE_COMMON}/app ./app_build) | ||
target_include_directories(openiotsdk-app | ||
PRIVATE | ||
main/include | ||
) | ||
|
||
chip_add_data_model(openiotsdk-app PUBLIC tv) | ||
|
||
# Add common lock-app sources | ||
include(tv-app) | ||
chip_add_tv_app_common(openiotsdk-app | ||
SCOPE PUBLIC | ||
SHELL_CMD CONFIG_CHIP_LIB_SHELL | ||
) | ||
|
||
target_include_directories(${APP_TARGET} | ||
PRIVATE | ||
main/include | ||
) | ||
|
||
target_sources(${APP_TARGET} | ||
PRIVATE | ||
main/main_ns.cpp | ||
) | ||
|
||
target_link_libraries(${APP_TARGET} | ||
openiotsdk-startup | ||
openiotsdk-app | ||
) | ||
|
||
include(linker) | ||
set_target_link(${APP_TARGET}) | ||
|
||
sdk_post_build(${APP_TARGET}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
# Matter Open IoT SDK TV-App Example Application | ||
|
||
The Open IoT SDK TV Example is an example implementation of the Casting Video | ||
Player device (refer to Video Player Architecture in the Matter Device Library | ||
Specification document). It supports basic and content launching features. The | ||
example includes a dummy application platform with a few hardcoded apps which | ||
use the pre-defined settings to work. | ||
|
||
The TV example also functions as a commissionable node, device that can be | ||
paired into an existing Matter network and can be controlled by it. | ||
|
||
> 💡 **Notes**: The Open IoT SDK platform implementation does not yet support | ||
> the commissioner role, which means that some of its features are unavailable | ||
> for this example. Therefore, it does not work properly with the Casting Video | ||
> Client node like | ||
> [CHIP TV Casting App Example](../../tv-casting-app/linux/README.md). | ||
## 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 `tv-app`. | ||
|
||
## Example output | ||
|
||
When the example runs, these lines should be visible: | ||
|
||
``` | ||
[INF] [-] Open IoT SDK tv-app example application start | ||
... | ||
[INF] [-] Open IoT SDK tv-app example application run | ||
``` | ||
|
||
This means the `tv-app` application launched correctly and you can follow traces | ||
in the terminal. | ||
|
||
## Shell commands | ||
|
||
The application supports Matter shell commands that allow managing the | ||
application platform (see `examples/tv-app/tv-common/src/AppTvShellCommands.cpp` | ||
implementation). Pass commands to the terminal and wait for the response. | ||
|
||
Example: | ||
|
||
``` | ||
> app add 1 | ||
[INF] [DL] GetLoadContentAppByVendorId() - vendorId 1, productId 0 | ||
[INF] [DL] ContentAppFactoryImpl: LoadContentAppByAppId catalogVendorId=65521 applicationId=1 | ||
[INF] [DL] Looking next=1 | ||
[INF] [DL] Adding ContentApp with appid 1 | ||
[INF] [ZCL] TV Linux App: ApplicationBasic::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: KeypadInput::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: ApplicationLauncher::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: AccountLogin::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: ContentLauncher::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: MediaPlayback::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: TargetNavigator::SetDefaultDelegate | ||
[INF] [ZCL] TV Linux App: Channel::SetDefaultDelegate | ||
[INF] [DL] Added ContentApp 1 to dynamic endpoint 4 (index=0) | ||
[INF] [DL] added app | ||
Done | ||
``` | ||
|
||
Run the `app help` command to get all supported commands and their usage. | ||
|
||
## 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. | ||
|
||
### ApplicationBasic cluster usage | ||
|
||
One of the fully supported clusters by this example is `ApplicationBasic` | ||
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. | ||
|
||
Before using the cluster commands, you need to add the application to the | ||
platform using shell commands: | ||
|
||
``` | ||
> app add 1 | ||
``` | ||
|
||
Example command: | ||
|
||
``` | ||
chip-tool applicationbasic read vendor-name 123 4 | ||
``` | ||
|
||
The numeric arguments are: device node ID and device endpoint ID, respectively. | ||
|
||
The endpoint ID argument is the dynamically assigned endpoint that is associated | ||
with the added application. You can refer to the output logs after completing | ||
the application adding step to find this value, for example: | ||
|
||
``` | ||
[INF] [DL] Added ContentApp 1 to dynamic endpoint 4 (index=0) | ||
``` | ||
|
||
The device send a response with its vendor name and you should see this line in | ||
the controller output: | ||
|
||
``` | ||
CHIP:TOO: VendorName: Vendor1 | ||
``` | ||
|
||
The `Vendor1` is the hardcoded value for this example. | ||
|
||
### ApplicationLauncher cluster usage | ||
|
||
The `Application Launcher` is the next example of the supported cluster. Use its | ||
commands to trigger actions on the device. You can issue commands through the | ||
same Matter controller you used to perform the commissioning step above. | ||
|
||
Before using the cluster commands, you need to add the application to the | ||
platform using shell commands: | ||
|
||
``` | ||
> app add 1 | ||
``` | ||
|
||
Example command: | ||
|
||
``` | ||
chip-tool applicationlauncher launch-app '{"catalogVendorID": 1, "applicationID": "1"}' 123 4 | ||
``` | ||
|
||
The numeric arguments are: device node ID and device endpoint ID, respectively. | ||
|
||
The endpoint ID argument is the dynamically assigned endpoint that is associated | ||
with the added application. You can refer to the output logs after completing | ||
the application adding step to find this value, for example: | ||
|
||
``` | ||
[INF] [DL] Added ContentApp 1 to dynamic endpoint 4 (index=0) | ||
``` | ||
|
||
`catalogVendorID` and `applicationID` parameters are also printed after | ||
completing the application adding step, for example: | ||
|
||
``` | ||
[INF] [DL] ContentAppFactoryImpl: LoadContentAppByAppId catalogVendorId=65521 applicationId=1 | ||
``` | ||
|
||
The device send a response that is printed to the controller output: | ||
|
||
``` | ||
CHIP:TOO: LauncherResponse: { | ||
CHIP:TOO: status: 0 | ||
CHIP:TOO: data: 64617461 | ||
CHIP:TOO: } | ||
``` | ||
|
||
The example application confirms handling the command with the log: | ||
|
||
``` | ||
[INF] [ZCL] ApplicationLauncherManager::HandleLaunchApp | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.