Skip to content

Commit

Permalink
Merge branch 'master' into feature/fix-tv-app-install-flow-and-suppor…
Browse files Browse the repository at this point in the history
…ted-clusters
  • Loading branch information
lazarkov authored Jun 25, 2024
2 parents 0847fd4 + 686e73b commit e1ba701
Show file tree
Hide file tree
Showing 142 changed files with 1,011 additions and 478 deletions.
7 changes: 5 additions & 2 deletions build/chip/chip_test_suite.gni
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ template("chip_test_suite") {

deps = [ dir_pw_unit_test ]

if (current_os != "zephyr" && current_os != "mbed") {
if (current_os != "zephyr" && current_os != "mbed" &&
chip_device_platform != "efr32") {
# Depend on stdio logging, and have it take precedence over the default platform backend
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
public_deps += [ "${chip_root}/src/platform/logging:stdio" ]
} else {
public_deps += [ "${chip_root}/src/platform/logging:default" ]
}
}
if (chip_link_tests) {
Expand Down
5 changes: 5 additions & 0 deletions build/chip/tests.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/platform/device.gni")

declare_args() {
# Build monolithic test library.
chip_monolithic_tests = false
}

declare_args() {
# Enable building tests.
chip_build_tests = current_os != "freertos"
Expand Down
7 changes: 6 additions & 1 deletion config/common/cmake/chip_gn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ macro(matter_build target)
LIB_PW_RPC
LIB_MBEDTLS
DEVICE_INFO_EXAMPLE_PROVIDER
FORCE_LOGGING_STDIO
)
set(multiValueArgs GN_DEPENDENCIES)

Expand All @@ -85,7 +86,11 @@ macro(matter_build target)
set(MATTER_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib)

# Prepare Matter libraries that the application should be linked with
set(MATTER_LIBRARIES -lCHIP)
if (FORCE_LOGGING_STDIO)
set(MATTER_LIBRARIES -lCHIPWithStdioLogging)
else()
set(MATTER_LIBRARIES -lCHIP)
endif()

if (ARG_LIB_MBEDTLS)
list(APPEND MATTER_LIBRARIES -lmbedtls)
Expand Down
1 change: 1 addition & 0 deletions config/openiotsdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ matter_build(chip
LIB_SHELL ${CONFIG_CHIP_LIB_SHELL}
LIB_TESTS ${CONFIG_CHIP_LIB_TESTS}
GN_DEPENDENCIES ${CONFIG_GN_DEPENDENCIES}
FORCE_LOGGING_STDIO ${CONFIG_CHIP_FORCE_LOGGING_STDIO}
)

target_link_libraries(chip INTERFACE
Expand Down
1 change: 1 addition & 0 deletions config/openiotsdk/cmake/chip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS "" CACHE STRING "")
set(CONFIG_CHIP_LIB_TESTS NO CACHE BOOL "")
set(CONFIG_CHIP_LIB_SHELL NO CACHE BOOL "")

set(CONFIG_CHIP_FORCE_LOGGING_STDIO NO CACHE BOOL "Enable stdio logging backend")
set(CONFIG_CHIP_DETAIL_LOGGING YES CACHE BOOL "Enable logging at detail level")
set(CONFIG_CHIP_PROGRESS_LOGGING YES CACHE BOOL "Enable logging at progress level")
set(CONFIG_CHIP_AUTOMATION_LOGGING YES CACHE BOOL "Enable logging at automation level")
Expand Down
1 change: 1 addition & 0 deletions examples/air-purifier-app/cc32xx/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ ti_simplelink_executable("air-purifier_app") {
"${chip_root}/examples/air-purifier-app/air-purifier-common",
"${chip_root}/examples/platform/cc32xx:cc32xx-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ asr_executable("clusters_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ ti_simplelink_executable("all-clusters-app") {
"${chip_root}/examples/all-clusters-app/all-clusters-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/openthread:openthread",
]
defines = []
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ psoc6_executable("clusters_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/nxp/mw320/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ mw320_executable("shell_mw320") {
"${chip_root}/src/setup_payload",
]

deps = [ "${chip_root}/src/platform:syscalls_stub" ]
deps = [
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
]

include_dirs = [
"${chip_root}/src/platform/nxp/mw320",
Expand Down
10 changes: 8 additions & 2 deletions examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ rt_executable("all_cluster_app") {
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
"${common_example_dir}/icd/source/ICDUtil.cpp",
"${common_example_dir}/matter_button/source/AppMatterButtonEmpty.cpp",
"${common_example_dir}/matter_cli/source/AppMatterCli.cpp",
]

deps = [ "${chip_root}/examples/${app_common_folder}" ]
deps = [
"${chip_root}/examples/${app_common_folder}",
"${chip_root}/src/platform/logging:default",
]

sources += [
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
Expand All @@ -185,6 +187,10 @@ rt_executable("all_cluster_app") {
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
]
sources += [
"${common_example_dir}/matter_cli/source/AppCLIBase.cpp",
"${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp",
]
}

if (chip_enable_ota_requestor) {
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-minimal-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ asr_executable("clusters_minimal_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ psoc6_executable("clusters_minimal_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/bridge-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ asr_executable("bridge_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/chef/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ silabs_executable("chef_app") {
deps = [
":chef-common",
":sdk",
"${chip_root}/src/platform/logging:default",
"${examples_plat_dir}:efr32-common",
]

Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ executable("chip-tool") {

deps = [
":chip-tool-utils",
"${chip_root}/src/platform/logging:force_stdio",
"${chip_root}/src/platform/logging:stdio",
]

output_dir = root_out_dir
Expand Down
2 changes: 1 addition & 1 deletion examples/common/tracing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ executable("chip-trace-decoder") {

output_dir = root_out_dir

deps = [ "${chip_root}/src/platform/logging:force_stdio" ]
deps = [ "${chip_root}/src/platform/logging:stdio" ]

public_deps = [
"${chip_root}/src/lib",
Expand Down
1 change: 1 addition & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ k32w0_executable("contact_sensor_app") {
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
]
Expand Down
1 change: 1 addition & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ k32w1_executable("contact_sensor_app") {
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w1_platform_dir}/app/support:freertos_mbedtls_utils",
]
Expand Down
1 change: 1 addition & 0 deletions examples/dishwasher-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ asr_executable("dishwasher_app") {
"${chip_root}/examples/dishwasher-app/dishwasher-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
2 changes: 1 addition & 1 deletion examples/fabric-admin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ executable("fabric-admin") {

deps = [
":fabric-admin-utils",
"${chip_root}/src/platform/logging:force_stdio",
"${chip_root}/src/platform/logging:stdio",
]

output_dir = root_out_dir
Expand Down
107 changes: 58 additions & 49 deletions examples/laundry-washer-app/nxp/common/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,80 +29,87 @@

#ifdef ENABLE_CHIP_SHELL
#include <lib/shell/Engine.h>

#include <map>
using namespace chip::Shell;
#define MATTER_CLI_LOG(message) (streamer_printf(streamer_get(), message))
#endif /* ENABLE_CHIP_SHELL */

using namespace chip;
using namespace chip::app::Clusters;

app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate;

CHIP_ERROR cliOpState(int argc, char * argv[])
#ifdef ENABLE_CHIP_SHELL
const static std::map<std::string, uint8_t> map_cmd_errstate{
{ "no_error", (uint8_t) OperationalState::ErrorStateEnum::kNoError },
{ "unable_to_start_or_resume", (uint8_t) OperationalState::ErrorStateEnum::kUnableToStartOrResume },
{ "unable_to_complete_operation", (uint8_t) OperationalState::ErrorStateEnum::kUnableToCompleteOperation },
{ "command_invalid_in_state", (uint8_t) OperationalState::ErrorStateEnum::kCommandInvalidInState }
};

const static std::map<std::string, uint8_t> map_cmd_opstate{ { "stop", (uint8_t) OperationalState::OperationalStateEnum::kStopped },
{ "run", (uint8_t) OperationalState::OperationalStateEnum::kRunning },
{ "pause", (uint8_t) OperationalState::OperationalStateEnum::kPaused },
{ "error",
(uint8_t) OperationalState::OperationalStateEnum::kError } };

static void InvalidStateHandler(void)
{
if ((argc != 1) && (argc != 2))
{
ChipLogError(Shell, "Target State is missing");
return CHIP_ERROR_INVALID_ARGUMENT;
}
if (!strcmp(argv[0], "stop"))
ChipLogError(Shell, "Invalid State/Error to set");
MATTER_CLI_LOG("Invalid. Supported commands are:\n");
for (auto const & it : map_cmd_opstate)
{
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
OperationalState::GetOperationalStateInstance()->SetOperationalState(
to_underlying(OperationalState::OperationalStateEnum::kStopped));
MATTER_CLI_LOG(("\t opstate " + it.first + "\n").c_str());
}
else if (!strcmp(argv[0], "run"))
for (auto const & it : map_cmd_errstate)
{
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
OperationalState::GetOperationalStateInstance()->SetOperationalState(
to_underlying(OperationalState::OperationalStateEnum::kRunning));
MATTER_CLI_LOG(("\t opstate error " + it.first + "\n").c_str());
}
else if (!strcmp(argv[0], "pause"))
}

static CHIP_ERROR cliOpState(int argc, char * argv[])
{
bool inputErr = false;
if ((argc != 1) && (argc != 2))
{
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
OperationalState::GetOperationalStateInstance()->SetOperationalState(
to_underlying(OperationalState::OperationalStateEnum::kPaused));
inputErr = true;
goto exit;
}
else if (!strcmp(argv[0], "error"))

if (map_cmd_opstate.find(argv[0]) != map_cmd_opstate.end())
{
OperationalState::Structs::ErrorStateStruct::Type err;
OperationalState::GetOperationalStateInstance()->SetOperationalState(map_cmd_opstate.at(argv[0]));
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
if (!strcmp(argv[1], "no_error"))
{
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kNoError;
}
else if (!strcmp(argv[1], "unable_to_start_or_resume"))
{
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kUnableToStartOrResume;
}
else if (!strcmp(argv[1], "unable_to_complete_operation"))
{
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kUnableToCompleteOperation;
}
else if (!strcmp(argv[1], "command_invalid_in_state"))
{
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kCommandInvalidInState;
}
else
if (!strcmp(argv[0], "error") && argc == 2)
{
ChipLogError(Shell, "Invalid Error State to set");
return CHIP_ERROR_INVALID_ARGUMENT;
OperationalState::Structs::ErrorStateStruct::Type err;
if (map_cmd_errstate.find(argv[1]) != map_cmd_errstate.end())
{
ChipLogDetail(Shell, "OpSState_error : Set to %s state", argv[1]);
err.errorStateID = map_cmd_errstate.at(argv[1]);
OperationalState::GetOperationalStateInstance()->OnOperationalErrorDetected(err);
}
else
{
inputErr = true;
goto exit;
}
}
OperationalState::GetOperationalStateInstance()->OnOperationalErrorDetected(err);
OperationalState::GetOperationalStateInstance()->SetOperationalState(
to_underlying(OperationalState::OperationalStateEnum::kError));
}
else
{
ChipLogError(Shell, "Invalid State to set");
inputErr = true;
}
exit:
if (inputErr)
{
InvalidStateHandler();
return CHIP_ERROR_INVALID_ARGUMENT;
}

return CHIP_NO_ERROR;
}
#endif /* ENABLE_CHIP_SHELL */

void LaundryWasherApp::AppTask::PreInitMatterStack()
{
Expand All @@ -121,7 +128,9 @@ void LaundryWasherApp::AppTask::AppMatter_RegisterCustomCliCommands()
#ifdef ENABLE_CHIP_SHELL
/* Register application commands */
static const shell_command_t kCommands[] = {
{ .cmd_func = cliOpState, .cmd_name = "opstate", .cmd_help = "Set the Operational State" },
{ .cmd_func = cliOpState,
.cmd_name = "opstate",
.cmd_help = "Set the Operational State. Usage:[stop|run|pause|dock|error 'state'] " },
};
Engine::Root().RegisterCommands(kCommands, sizeof(kCommands) / sizeof(kCommands[0]));
#endif
Expand Down
10 changes: 8 additions & 2 deletions examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,12 @@ rt_executable("laundry-washer") {
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
"${common_example_dir}/icd/source/ICDUtil.cpp",
"${common_example_dir}/matter_button/source/AppMatterButtonEmpty.cpp",
"${common_example_dir}/matter_cli/source/AppMatterCli.cpp",
]

deps = [ "${chip_root}/examples/${app_common_folder}" ]
deps = [
"${chip_root}/examples/${app_common_folder}",
"${chip_root}/src/platform/logging:default",
]

sources += [
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
Expand All @@ -190,6 +192,10 @@ rt_executable("laundry-washer") {
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
]
sources += [
"${common_example_dir}/matter_cli/source/AppCLIBase.cpp",
"${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp",
]
}

if (chip_enable_ota_requestor) {
Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ asr_executable("light_switch_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
Loading

0 comments on commit e1ba701

Please sign in to comment.