-
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.
feat: Add terms-and-conditions sample app for CI testing (#36950)
* feat: Add terms-and-conditions sample app for CI testing Add a new sample application that demonstrates and tests the terms and conditions feature. This app will be integrated into the CI pipeline to prevent regressions and ensure the feature continues to work as expected. The sample app serves as both a reference implementation and an automated test case for the terms and conditions functionality. ```bash ./scripts/build/build_examples.py --target linux-x64-terms-and-conditions build ``` * Update cluster configurations for app testing - Enable switch cluster for basic app control testing - Enable network commissioning cluster for in-app commission testing - Disable provisional clusters as they are not required - Disable other non-required clusters to streamline testing setup This change focuses the cluster configuration on essential components needed for basic app control and commissioning testing scenarios. * refactor: Remove unused attributes from Switch cluster Remove unused attributes from the Switch cluster to comply with the "On/Off Light" device type specification as defined in the Matter device library v1.4. This change removes several server-side attributes including ServerList, ClientList, PartsList, and various internal lists that are not required for the basic On/Off Light functionality. * feat: Add Descriptor cluster and enable attribute reporting Add the mandatory Descriptor cluster to endpoint 1 and enable attribute reporting for the device. Changes include: - Add Descriptor cluster with all required attributes (deviceTypeList, serverList, etc.) - Enable reportable flag for multiple attributes with min/max reporting intervals - Configure all Descriptor cluster attributes as external callbacks This change ensures compliance with the Matter specification for the On/Off Light device type.
- Loading branch information
1 parent
72b1da7
commit 083803c
Showing
14 changed files
with
4,443 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,25 @@ | ||
# Copyright (c) 2024 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") | ||
} |
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,32 @@ | ||
# Copyright (c) 2024 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}/build/chip/tools.gni") | ||
import("${chip_root}/src/app/common_flags.gni") | ||
|
||
executable("chip-terms-and-conditions-app") { | ||
sources = [ "main.cpp" ] | ||
|
||
deps = [ | ||
"${chip_root}/examples/platform/linux:app-main", | ||
"${chip_root}/examples/terms-and-conditions-app/terms-and-conditions-common", | ||
] | ||
|
||
output_dir = root_out_dir | ||
} | ||
|
||
group("default") { | ||
deps = [ ":chip-terms-and-conditions-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,18 @@ | ||
# Copyright (c) 2024 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_terms_and_conditions_required = true |
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,82 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 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/server/TermsAndConditionsManager.h> | ||
#include <app/server/TermsAndConditionsProvider.h> | ||
|
||
using namespace chip; | ||
using namespace chip::ArgParser; | ||
|
||
static uint16_t sTcMinRequiredVersion = 0; | ||
static uint16_t sTcRequiredAcknowledgements = 0; | ||
|
||
static OptionDef sTermsAndConditionsOptions[] = { | ||
{ "tc-min-required-version", kArgumentRequired, 'm' }, | ||
{ "tc-required-acknowledgements", kArgumentRequired, 'r' }, | ||
{ nullptr }, | ||
}; | ||
|
||
static const char * const sTermsAndConditionsOptionHelp = | ||
"-m, --tc-min-required-version <number>\n Configure the minimum required TC version.\n\n" | ||
"-r, --tc-required-acknowledgements <number (bitfield)>\n Configure the required TC acknowledgements.\n\n"; | ||
|
||
static bool HandleOption(const char * progName, OptionSet * optSet, int id, const char * name, const char * arg) | ||
{ | ||
switch (id) | ||
{ | ||
case 'm': | ||
sTcMinRequiredVersion = static_cast<uint16_t>(atoi(arg)); | ||
break; | ||
case 'r': | ||
sTcRequiredAcknowledgements = static_cast<uint16_t>(atoi(arg)); | ||
break; | ||
default: | ||
PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", progName, name); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
static OptionSet sTermsAndConditionsCmdLineOptions = { | ||
HandleOption, | ||
sTermsAndConditionsOptions, | ||
"TERMS AND CONDITIONS OPTIONS", | ||
sTermsAndConditionsOptionHelp, | ||
}; | ||
|
||
void ApplicationInit() | ||
{ | ||
const app::TermsAndConditions termsAndConditions = app::TermsAndConditions(sTcRequiredAcknowledgements, sTcMinRequiredVersion); | ||
PersistentStorageDelegate & persistentStorageDelegate = Server::GetInstance().GetPersistentStorage(); | ||
app::TermsAndConditionsManager::GetInstance()->Init(&persistentStorageDelegate, MakeOptional(termsAndConditions)); | ||
} | ||
|
||
void ApplicationShutdown() {} | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
if (ChipLinuxAppInit(argc, argv, &sTermsAndConditionsCmdLineOptions) != 0) | ||
{ | ||
return -1; | ||
} | ||
|
||
ChipLinuxAppMainLoop(); | ||
return 0; | ||
} |
1 change: 1 addition & 0 deletions
1
examples/terms-and-conditions-app/linux/third_party/connectedhomeip
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 changes: 22 additions & 0 deletions
22
examples/terms-and-conditions-app/terms-and-conditions-common/BUILD.gn
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) 2024 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("terms-and-conditions-common") { | ||
zap_file = "terms-and-conditions-app.zap" | ||
is_server = true | ||
} |
Oops, something went wrong.