Skip to content

Commit 3b37a19

Browse files
authored
Merge branch 'master' into AA/AppNoContext
2 parents 3441641 + 909c69b commit 3b37a19

File tree

176 files changed

+2560
-13416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+2560
-13416
lines changed

.github/workflows/tests.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,11 @@ jobs:
536536
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
537537
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
538538
scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py'
539-
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_1_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
540539
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
541540
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
542541
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
543542
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
544543
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
545-
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_1_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
546544
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
547545
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
548546
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
@@ -563,6 +561,8 @@ jobs:
563561
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
564562
scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_DA_1_2.py'
565563
scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_ICDM_2_1.py'
564+
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py'
565+
566566
- name: Uploading core files
567567
uses: actions/upload-artifact@v4
568568
if: ${{ failure() && !env.ACT }}

build/toolchain/android/android_toolchain.gni

-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,5 @@ template("android_clang_toolchain") {
6969
ar = _ndk_prefix + "llvm-ar"
7070
cc = _ndk_prefix + _tool_name_root + "clang"
7171
cxx = _ndk_prefix + _tool_name_root + "clang++"
72-
link_generate_map_file = false
7372
}
7473
}

build/toolchain/gcc_toolchain.gni

+3-9
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ import("//build_overrides/pigweed.gni")
1616
import("$dir_pw_toolchain/generate_toolchain.gni")
1717

1818
declare_args() {
19-
# Generate Linker map files. Can skip since they can
19+
# Generate Linker map files. By default it is disabled since they can
2020
# be quite large.
21-
#
22-
# Note that toolchains can individually override this
23-
chip_generate_link_map_file = true
21+
chip_generate_link_map_file = false
2422
}
2523

2624
template("gcc_toolchain") {
@@ -48,11 +46,7 @@ template("gcc_toolchain") {
4846
cxx = invoker.cxx
4947
}
5048

51-
if (defined(invoker.link_generate_map_file)) {
52-
link_generate_map_file = invoker.link_generate_map_file
53-
} else {
54-
link_generate_map_file = chip_generate_link_map_file
55-
}
49+
link_generate_map_file = chip_generate_link_map_file
5650

5751
is_host_toolchain = invoker_toolchain_args.current_os == host_os
5852
link_group = invoker_toolchain_args.current_os != "mac" &&

examples/chef/chef.py

+1
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,7 @@ def main() -> int:
811811
'chip_shell_cmd_server = false',
812812
'chip_build_libshell = true',
813813
'chip_enable_openthread = false',
814+
'chip_generate_link_map_file = true',
814815
'chip_config_network_layer_ble = false',
815816
'chip_device_project_config_include = "<CHIPProjectAppConfig.h>"',
816817
'chip_project_config_include = "<CHIPProjectAppConfig.h>"',

examples/chip-tool/commands/clusters/ClusterCommand.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
5555
return InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value);
5656
}
5757

58+
CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
59+
chip::CommandId commandId,
60+
const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type & value)
61+
{
62+
ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value));
63+
mScopedNodeId = chip::ScopedNodeId(value.checkInNodeID, device->GetSecureSession().Value()->GetFabricIndex());
64+
return CHIP_NO_ERROR;
65+
}
66+
5867
CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
5968
chip::CommandId commandId,
6069
const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value)
@@ -109,6 +118,11 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
109118
return;
110119
}
111120
}
121+
if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) &&
122+
(path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id))
123+
{
124+
ModelCommand::ClearICDEntry(mScopedNodeId);
125+
}
112126
}
113127

114128
virtual void OnError(const chip::app::CommandSender * client, CHIP_ERROR error) override
@@ -208,7 +222,7 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
208222
private:
209223
chip::ClusterId mClusterId;
210224
chip::CommandId mCommandId;
211-
225+
chip::ScopedNodeId mScopedNodeId;
212226
CHIP_ERROR mError = CHIP_NO_ERROR;
213227
CustomArgument mPayload;
214228
};

examples/chip-tool/commands/clusters/ModelCommand.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ void ModelCommand::Shutdown()
7676
CHIPCommand::Shutdown();
7777
}
7878

79+
void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId)
80+
{
81+
CHIP_ERROR deleteEntryError = CHIPCommand::sICDClientStorage.DeleteEntry(nodeId);
82+
if (deleteEntryError != CHIP_NO_ERROR)
83+
{
84+
ChipLogError(chipTool, "Failed to delete ICD entry: %" CHIP_ERROR_FORMAT, deleteEntryError.Format());
85+
}
86+
}
87+
7988
void ModelCommand::CheckPeerICDType()
8089
{
8190
if (mIsPeerLIT.HasValue())

examples/chip-tool/commands/clusters/ModelCommand.h

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class ModelCommand : public CHIPCommand
6767

6868
virtual CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) { return CHIP_ERROR_BAD_REQUEST; };
6969

70+
virtual void ClearICDEntry(const chip::ScopedNodeId & nodeId);
71+
7072
void Shutdown() override;
7173

7274
protected:

examples/fabric-bridge-app/linux/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ executable("fabric-bridge-app") {
2222
sources = [
2323
"${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h",
2424
"Device.cpp",
25+
"DeviceManager.cpp",
2526
"include/Device.h",
27+
"include/DeviceManager.h",
2628
"main.cpp",
2729
]
2830

examples/fabric-bridge-app/linux/Device.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ void Device::SetReachable(bool aReachable)
4646

4747
if (aReachable)
4848
{
49-
ChipLogProgress(DeviceLayer, "Device[%s]: ONLINE", mName);
49+
ChipLogProgress(NotSpecified, "Device[%s]: ONLINE", mName);
5050
}
5151
else
5252
{
53-
ChipLogProgress(DeviceLayer, "Device[%s]: OFFLINE", mName);
53+
ChipLogProgress(NotSpecified, "Device[%s]: OFFLINE", mName);
5454
}
5555

5656
if (changed)
@@ -63,7 +63,7 @@ void Device::SetName(const char * szName)
6363
{
6464
bool changed = (strncmp(mName, szName, sizeof(mName)) != 0);
6565

66-
ChipLogProgress(DeviceLayer, "Device[%s]: New Name=\"%s\"", mName, szName);
66+
ChipLogProgress(NotSpecified, "Device[%s]: New Name=\"%s\"", mName, szName);
6767

6868
chip::Platform::CopyString(mName, szName);
6969

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include "DeviceManager.h"
20+
21+
#include <app-common/zap-generated/ids/Attributes.h>
22+
#include <app-common/zap-generated/ids/Clusters.h>
23+
#include <app/AttributeAccessInterfaceRegistry.h>
24+
#include <app/ConcreteAttributePath.h>
25+
#include <app/EventLogging.h>
26+
#include <app/reporting/reporting.h>
27+
#include <app/server/Server.h>
28+
#include <app/util/af-types.h>
29+
#include <app/util/attribute-storage.h>
30+
#include <app/util/endpoint-config-api.h>
31+
#include <app/util/util.h>
32+
#include <lib/support/CHIPMem.h>
33+
#include <lib/support/ZclString.h>
34+
35+
#include <cstdio>
36+
#include <string>
37+
38+
using namespace chip;
39+
using namespace chip::app;
40+
using namespace chip::Credentials;
41+
using namespace chip::Inet;
42+
using namespace chip::Transport;
43+
using namespace chip::DeviceLayer;
44+
using namespace chip::app::Clusters;
45+
46+
namespace {
47+
constexpr uint8_t kMaxRetries = 10;
48+
} // namespace
49+
50+
DeviceManager::DeviceManager()
51+
{
52+
memset(mDevices, 0, sizeof(mDevices));
53+
mFirstDynamicEndpointId = static_cast<chip::EndpointId>(
54+
static_cast<int>(emberAfEndpointFromIndex(static_cast<uint16_t>(emberAfFixedEndpointCount() - 1))) + 1);
55+
mCurrentEndpointId = mFirstDynamicEndpointId;
56+
}
57+
58+
int DeviceManager::AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep,
59+
const chip::Span<const EmberAfDeviceType> & deviceTypeList,
60+
const chip::Span<chip::DataVersion> & dataVersionStorage, chip::EndpointId parentEndpointId)
61+
{
62+
uint8_t index = 0;
63+
while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
64+
{
65+
if (nullptr == mDevices[index])
66+
{
67+
mDevices[index] = dev;
68+
CHIP_ERROR err;
69+
int retryCount = 0;
70+
while (retryCount < kMaxRetries)
71+
{
72+
DeviceLayer::StackLock lock;
73+
dev->SetEndpointId(mCurrentEndpointId);
74+
dev->SetParentEndpointId(parentEndpointId);
75+
err =
76+
emberAfSetDynamicEndpoint(index, mCurrentEndpointId, ep, dataVersionStorage, deviceTypeList, parentEndpointId);
77+
if (err == CHIP_NO_ERROR)
78+
{
79+
ChipLogProgress(NotSpecified, "Added device %s to dynamic endpoint %d (index=%d)", dev->GetName(),
80+
mCurrentEndpointId, index);
81+
return index;
82+
}
83+
if (err != CHIP_ERROR_ENDPOINT_EXISTS)
84+
{
85+
return -1; // Return error as endpoint addition failed due to an error other than endpoint already exists
86+
}
87+
// Increment the endpoint ID and handle wrap condition
88+
if (++mCurrentEndpointId < mFirstDynamicEndpointId)
89+
{
90+
mCurrentEndpointId = mFirstDynamicEndpointId;
91+
}
92+
retryCount++;
93+
}
94+
ChipLogError(NotSpecified, "Failed to add dynamic endpoint after %d retries", kMaxRetries);
95+
return -1; // Return error as all retries are exhausted
96+
}
97+
index++;
98+
}
99+
ChipLogProgress(NotSpecified, "Failed to add dynamic endpoint: No endpoints available!");
100+
return -1;
101+
}
102+
103+
int DeviceManager::RemoveDeviceEndpoint(Device * dev)
104+
{
105+
uint8_t index = 0;
106+
while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
107+
{
108+
if (mDevices[index] == dev)
109+
{
110+
DeviceLayer::StackLock lock;
111+
// Silence complaints about unused ep when progress logging
112+
// disabled.
113+
[[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index);
114+
mDevices[index] = nullptr;
115+
ChipLogProgress(NotSpecified, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index);
116+
return index;
117+
}
118+
index++;
119+
}
120+
return -1;
121+
}
122+
123+
Device * DeviceManager::GetDevice(uint16_t index) const
124+
{
125+
if (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
126+
{
127+
return mDevices[index];
128+
}
129+
return nullptr;
130+
}

0 commit comments

Comments
 (0)