-
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.
[Feature]add refrigerator example (#28390)
* Add refrigerator example build script * Add refrigerator app * Restyled by whitespace * Restyled by gn * Restyled by prettier-markdown * fix document missing * Restyled by prettier-markdown * fix document build error * update zap and matter with #28299 * optimize code and add composition type for endpoint * Restyled by clang-format * Optimize endpoint 1: 1. remove Refrigerator And Temperature Controlled Cabinet Mode cluster 2. remove Refrigerator alarm cluster 3. remove Binding and Group cluster in endpoint 1 * Restyled by clang-format * fix build error * fix bug: test fail in TC-SM-1.1/TC-DT-1.1 * remove identify and groups cluster in root node * add tag list feauture in endpoint 2 and endpoint 3 * Restyled by clang-format --------- Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
Showing
31 changed files
with
15,309 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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. | ||
|
||
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 = { | ||
target_cpu = "arm" | ||
|
||
target_os = "freertos" | ||
|
||
import("//args.gni") | ||
} |
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,129 @@ | ||
# 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. | ||
|
||
import("//build_overrides/asr.gni") | ||
import("//build_overrides/build.gni") | ||
import("//build_overrides/chip.gni") | ||
import("${asr_sdk_build_root}/asr_sdk.gni") | ||
import("${build_root}/config/defaults.gni") | ||
import("${chip_root}/src/lib/lib.gni") | ||
import("${chip_root}/src/platform/device.gni") | ||
import("${chip_root}/third_party/asr/asr_executable.gni") | ||
|
||
import("cfg.gni") | ||
|
||
assert(current_os == "freertos") | ||
|
||
asr_project_dir = "${chip_root}/examples/refrigerator-app/asr" | ||
examples_plat_dir = "${chip_root}/examples/platform/asr" | ||
|
||
declare_args() { | ||
# Dump memory usage at link time. | ||
chip_print_memory_usage = false | ||
} | ||
|
||
asr_sdk_sources("refrigerator_app_sdk_sources") { | ||
include_dirs = [ | ||
"${chip_root}/src/platform/ASR", | ||
"${asr_project_dir}/include", | ||
"${examples_plat_dir}", | ||
] | ||
|
||
defines = [ | ||
"ASR_LOG_ENABLED=1", | ||
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", | ||
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", | ||
] | ||
|
||
if (chip_enable_factory_data) { | ||
defines += [ | ||
"CONFIG_ENABLE_ASR_FACTORY_DATA_PROVIDER=1", | ||
"CONFIG_ENABLE_ASR_FACTORY_DEVICE_INFO_PROVIDER=1", | ||
] | ||
} | ||
|
||
if (chip_lwip_ip6_hook) { | ||
defines += [ | ||
"CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT", | ||
"CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT", | ||
] | ||
} | ||
|
||
sources = [ "${asr_project_dir}/include/CHIPProjectConfig.h" ] | ||
|
||
public_configs = [ "${asr_sdk_build_root}:asr_sdk_config" ] | ||
} | ||
|
||
asr_executable("refrigerator_app") { | ||
include_dirs = [] | ||
defines = [] | ||
output_name = "chip-asr-refrigerator-example.out" | ||
|
||
sources = [ | ||
"${chip_root}/examples/refrigerator-app/refrigerator-common/src/static-supported-temperature-levels.cpp", | ||
"${examples_plat_dir}/CHIPDeviceManager.cpp", | ||
"${examples_plat_dir}/init_Matter.cpp", | ||
"${examples_plat_dir}/init_asrPlatform.cpp", | ||
"${examples_plat_dir}/shell/matter_shell.cpp", | ||
"src/AppTask.cpp", | ||
"src/DeviceCallbacks.cpp", | ||
"src/main.cpp", | ||
] | ||
|
||
if (chip_enable_ota_requestor) { | ||
sources += [ "${examples_plat_dir}/init_OTARequestor.cpp" ] | ||
} | ||
|
||
deps = [ | ||
":refrigerator_app_sdk_sources", | ||
"${chip_root}/examples/common/QRCode", | ||
"${chip_root}/examples/providers:device_info_provider", | ||
"${chip_root}/examples/refrigerator-app/refrigerator-common", | ||
"${chip_root}/src/lib", | ||
"${chip_root}/src/setup_payload", | ||
] | ||
|
||
include_dirs += [ | ||
"include", | ||
"${examples_plat_dir}", | ||
"${asr_project_dir}/include", | ||
"${chip_root}/src/lib", | ||
"${chip_root}/examples/refrigerator-app/refrigerator-common/include", | ||
] | ||
|
||
defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ] | ||
|
||
if (chip_build_libshell) { | ||
defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ] | ||
sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ] | ||
include_dirs += [ "${examples_plat_dir}/shell" ] | ||
} | ||
|
||
if (chip_print_memory_usage) { | ||
ldflags += [ | ||
"-Wl,--print-memory-usage", | ||
"-fstack-usage", | ||
] | ||
} | ||
|
||
output_dir = root_out_dir | ||
} | ||
|
||
group("asr") { | ||
deps = [ ":refrigerator_app" ] | ||
} | ||
|
||
group("default") { | ||
deps = [ ":asr" ] | ||
} |
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,27 @@ | ||
# 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. | ||
|
||
import("//build_overrides/chip.gni") | ||
import("//build_overrides/pigweed.gni") | ||
import("//cfg.gni") | ||
import("${chip_root}/src/platform/ASR/args.gni") | ||
|
||
asr_target_project = | ||
get_label_info(":refrigerator_app_sdk_sources", "label_no_toolchain") | ||
|
||
declare_args() { | ||
# Disable lock tracking, since our FreeRTOS configuration does not set | ||
# INCLUDE_xSemaphoreGetMutexHolder | ||
chip_stack_lock_tracking = "none" | ||
} |
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_overrides/ |
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,23 @@ | ||
# 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. | ||
|
||
declare_args() { | ||
chip_enable_factory_data = false | ||
|
||
chip_lwip_ip6_hook = false | ||
|
||
setupPinCode = 20202021 | ||
|
||
setupDiscriminator = 3840 | ||
} |
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,45 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
// ---- Refrigerator Example App Config ---- | ||
|
||
#if (CFG_EASY_LOG_ENABLE == 1) | ||
#include "elog.h" | ||
#endif | ||
|
||
#define APP_TASK_NAME "APP" | ||
|
||
#define APP_TASK_STACK_SIZE (1024 * 4) | ||
|
||
#define MATTER_DEVICE_NAME "Refrigerator" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void appError(int err); | ||
void ASR_LOG(const char * aFormat, ...); | ||
|
||
#ifdef __cplusplus | ||
} | ||
|
||
#include <lib/core/CHIPError.h> | ||
void appError(CHIP_ERROR error); | ||
#endif |
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,43 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdbool.h> | ||
#include <stdint.h> | ||
|
||
#include <lega_rtos_api.h> | ||
#include <platform/CHIPDeviceLayer.h> | ||
|
||
class AppTask | ||
{ | ||
|
||
public: | ||
CHIP_ERROR StartAppTask(); | ||
static void AppTaskMain(void * pvParameter); | ||
|
||
private: | ||
friend AppTask & GetAppTask(void); | ||
|
||
static AppTask sAppTask; | ||
}; | ||
|
||
inline AppTask & GetAppTask(void) | ||
{ | ||
return AppTask::sAppTask; | ||
} |
Oops, something went wrong.