From 3806a38e71ab6ed6c9937f52d8143577d2e4c238 Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:52:11 +1200 Subject: [PATCH 01/15] Disentangle data model tests by moving fixtures into their own file (#34154) * Disentangle data model tests by moving fixtures into their own file The data model tests all had linker dependencies on each other, which meant that running any of Test{Read,Write,Commands} would run the tests from all of them, because the global fixture function from that test was required. This change moves all those fixture functions into DataModelFixtures.cpp. Also disambiguate the enum types and control variable names involved. * Address review comments - Add more comments to DataModelFixtures.h - Use ScopedChangeOnly for the fixture control variables - Extend ScopedChange to allow assignments within the scope --- src/app/util/mock/Constants.h | 19 + src/app/util/mock/attribute-storage.cpp | 20 +- src/controller/tests/data_model/BUILD.gn | 14 +- .../tests/data_model/DataModelFixtures.cpp | 468 ++++++++++++++++++ .../tests/data_model/DataModelFixtures.h | 102 ++++ .../tests/data_model/TestCommands.cpp | 159 +----- src/controller/tests/data_model/TestRead.cpp | 377 +++----------- src/controller/tests/data_model/TestWrite.cpp | 192 +------ src/lib/support/Scoped.h | 30 +- 9 files changed, 744 insertions(+), 637 deletions(-) create mode 100644 src/controller/tests/data_model/DataModelFixtures.cpp create mode 100644 src/controller/tests/data_model/DataModelFixtures.h diff --git a/src/app/util/mock/Constants.h b/src/app/util/mock/Constants.h index 803dff5b7f8f12..e60154a5d0e773 100644 --- a/src/app/util/mock/Constants.h +++ b/src/app/util/mock/Constants.h @@ -50,5 +50,24 @@ constexpr EventId MockEventId(const uint16_t & id) { return (0xFFF1'0000 | id); } + +// Cluster Revision value returned by mock clusters +extern const uint16_t mockClusterRevision; + +// Feature Map value returned by mock clusters +extern const uint32_t mockFeatureMap; + +// Scalar value returned by mock clusters for MockAttributeId(1) +extern const bool mockAttribute1; + +// Scalar value returned by mock clusters for MockAttributeId(2) +extern const int16_t mockAttribute2; + +// Scalar value returned by mock clusters for MockAttributeId(3) +extern const uint64_t mockAttribute3; + +// MockAttributeId(4) returns a list of octstr with this value +extern const uint8_t mockAttribute4[256]; + } // namespace Test } // namespace chip diff --git a/src/app/util/mock/attribute-storage.cpp b/src/app/util/mock/attribute-storage.cpp index 97b21967be0313..93d3219fc04a41 100644 --- a/src/app/util/mock/attribute-storage.cpp +++ b/src/app/util/mock/attribute-storage.cpp @@ -113,12 +113,17 @@ const MockNodeConfig & GetMockNodeConfig() return (mockConfig != nullptr) ? *mockConfig : DefaultMockNodeConfig(); } -uint16_t mockClusterRevision = 1; -uint32_t mockFeatureMap = 0x1234; -bool mockAttribute1 = true; -int16_t mockAttribute2 = 42; -uint64_t mockAttribute3 = 0xdeadbeef0000cafe; -uint8_t mockAttribute4[256] = { +} // namespace + +namespace chip { +namespace Test { + +const uint16_t mockClusterRevision = 1; +const uint32_t mockFeatureMap = 0x1234; +const bool mockAttribute1 = true; +const int16_t mockAttribute2 = 42; +const uint64_t mockAttribute3 = 0xdeadbeef0000cafe; +const uint8_t mockAttribute4[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, @@ -129,7 +134,8 @@ uint8_t mockAttribute4[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, }; -} // namespace +} // namespace Test +} // namespace chip uint16_t emberAfEndpointCount() { diff --git a/src/controller/tests/data_model/BUILD.gn b/src/controller/tests/data_model/BUILD.gn index d8ce821ed837af..c67922717645dd 100644 --- a/src/controller/tests/data_model/BUILD.gn +++ b/src/controller/tests/data_model/BUILD.gn @@ -22,11 +22,19 @@ import("${chip_root}/src/platform/device.gni") chip_test_suite("data_model") { output_name = "libDataModelTests" + sources = [ + "DataModelFixtures.cpp", + "DataModelFixtures.h", + ] + + test_sources = [] if (chip_device_platform != "mbed" && chip_device_platform != "efr32" && chip_device_platform != "esp32" && chip_device_platform != "fake") { - test_sources = [ "TestCommands.cpp" ] - test_sources += [ "TestWrite.cpp" ] - test_sources += [ "TestRead.cpp" ] + test_sources += [ + "TestCommands.cpp", + "TestRead.cpp", + "TestWrite.cpp", + ] } public_deps = [ diff --git a/src/controller/tests/data_model/DataModelFixtures.cpp b/src/controller/tests/data_model/DataModelFixtures.cpp new file mode 100644 index 00000000000000..11dbd1059f7415 --- /dev/null +++ b/src/controller/tests/data_model/DataModelFixtures.cpp @@ -0,0 +1,468 @@ +/* + * + * 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 "DataModelFixtures.h" + +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModelTests; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::UnitTesting; +using namespace chip::Protocols; + +namespace chip { +namespace app { + +namespace DataModelTests { + +ScopedChangeOnly gReadResponseDirective(ReadResponseDirective::kSendDataResponse); +ScopedChangeOnly gWriteResponseDirective(WriteResponseDirective::kSendAttributeSuccess); +ScopedChangeOnly gCommandResponseDirective(CommandResponseDirective::kSendSuccessStatusCode); + +ScopedChangeOnly gIsLitIcd(false); + +uint16_t gInt16uTotalReadCount = 0; +CommandHandler::Handle gAsyncCommandHandle; + +} // namespace DataModelTests + +CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, + const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, + AttributeEncodeState * apEncoderState) +{ + if (aPath.mEndpointId >= chip::Test::kMockEndpointMin) + { + return chip::Test::ReadSingleMockClusterData(aSubjectDescriptor.fabricIndex, aPath, aAttributeReports, apEncoderState); + } + + if (gReadResponseDirective == ReadResponseDirective::kSendManyDataResponses || + gReadResponseDirective == ReadResponseDirective::kSendManyDataResponsesWrongPath) + { + if (aPath.mClusterId != Clusters::UnitTesting::Id || aPath.mAttributeId != Clusters::UnitTesting::Attributes::Boolean::Id) + { + return CHIP_ERROR_INCORRECT_STATE; + } + + for (size_t i = 0; i < 4; ++i) + { + ConcreteAttributePath path(aPath); + // Use an incorrect attribute id for some of the responses. + path.mAttributeId = static_cast( + path.mAttributeId + (i / 2) + (gReadResponseDirective == ReadResponseDirective::kSendManyDataResponsesWrongPath)); + AttributeEncodeState state(apEncoderState); + AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, path, kDataVersion, aIsFabricFiltered, state); + ReturnErrorOnFailure(valueEncoder.Encode(true)); + } + + return CHIP_NO_ERROR; + } + + if (gReadResponseDirective == ReadResponseDirective::kSendDataResponse) + { + if (aPath.mClusterId == app::Clusters::UnitTesting::Id && + aPath.mAttributeId == app::Clusters::UnitTesting::Attributes::ListFabricScoped::Id) + { + AttributeEncodeState state(apEncoderState); + AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, + state); + + return valueEncoder.EncodeList([aSubjectDescriptor](const auto & encoder) -> CHIP_ERROR { + app::Clusters::UnitTesting::Structs::TestFabricScoped::Type val; + val.fabricIndex = aSubjectDescriptor.fabricIndex; + ReturnErrorOnFailure(encoder.Encode(val)); + val.fabricIndex = (val.fabricIndex == 1) ? 2 : 1; + ReturnErrorOnFailure(encoder.Encode(val)); + return CHIP_NO_ERROR; + }); + } + if (aPath.mClusterId == app::Clusters::UnitTesting::Id && + aPath.mAttributeId == app::Clusters::UnitTesting::Attributes::Int16u::Id) + { + AttributeEncodeState state(apEncoderState); + AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, + state); + + return valueEncoder.Encode(++gInt16uTotalReadCount); + } + if (aPath.mClusterId == kPerpetualClusterId || + (aPath.mClusterId == app::Clusters::UnitTesting::Id && aPath.mAttributeId == kPerpetualAttributeid)) + { + AttributeEncodeState state; + AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, + state); + + CHIP_ERROR err = valueEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { + encoder.Encode(static_cast(1)); + return CHIP_ERROR_NO_MEMORY; + }); + + if (err != CHIP_NO_ERROR) + { + // If the err is not CHIP_NO_ERROR, means the encoding was aborted, then the valueEncoder may save its state. + // The state is used by list chunking feature for now. + if (apEncoderState != nullptr) + { + *apEncoderState = valueEncoder.GetState(); + } + return err; + } + } + if (aPath.mClusterId == app::Clusters::IcdManagement::Id && + aPath.mAttributeId == app::Clusters::IcdManagement::Attributes::OperatingMode::Id) + { + AttributeEncodeState state(apEncoderState); + AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, + state); + + return valueEncoder.Encode(gIsLitIcd ? Clusters::IcdManagement::OperatingModeEnum::kLit + : Clusters::IcdManagement::OperatingModeEnum::kSit); + } + + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); + ReturnErrorOnFailure(aAttributeReports.GetError()); + AttributeDataIB::Builder & attributeData = attributeReport.CreateAttributeData(); + ReturnErrorOnFailure(attributeReport.GetError()); + Clusters::UnitTesting::Attributes::ListStructOctetString::TypeInfo::Type value; + Clusters::UnitTesting::Structs::TestListStructOctet::Type valueBuf[4]; + + value = valueBuf; + + uint8_t i = 0; + for (auto & item : valueBuf) + { + item.member1 = i; + i++; + } + + attributeData.DataVersion(kDataVersion); + ReturnErrorOnFailure(attributeData.GetError()); + AttributePathIB::Builder & attributePath = attributeData.CreatePath(); + attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); + ReturnErrorOnFailure(attributePath.GetError()); + + ReturnErrorOnFailure(DataModel::Encode(*(attributeData.GetWriter()), TLV::ContextTag(AttributeDataIB::Tag::kData), value)); + ReturnErrorOnFailure(attributeData.EndOfAttributeDataIB()); + return attributeReport.EndOfAttributeReportIB(); + } + + for (size_t i = 0; i < (gReadResponseDirective == ReadResponseDirective::kSendTwoDataErrors ? 2 : 1); ++i) + { + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); + ReturnErrorOnFailure(aAttributeReports.GetError()); + AttributeStatusIB::Builder & attributeStatus = attributeReport.CreateAttributeStatus(); + AttributePathIB::Builder & attributePath = attributeStatus.CreatePath(); + attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); + ReturnErrorOnFailure(attributePath.GetError()); + + StatusIB::Builder & errorStatus = attributeStatus.CreateErrorStatus(); + ReturnErrorOnFailure(attributeStatus.GetError()); + errorStatus.EncodeStatusIB(StatusIB(Protocols::InteractionModel::Status::Busy)); + attributeStatus.EndOfAttributeStatusIB(); + ReturnErrorOnFailure(attributeStatus.GetError()); + ReturnErrorOnFailure(attributeReport.EndOfAttributeReportIB()); + } + + return CHIP_NO_ERROR; +} + +bool IsClusterDataVersionEqual(const app::ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) +{ + if (aRequiredVersion == kDataVersion) + { + return true; + } + if (Test::GetVersion() == aRequiredVersion) + { + return true; + } + + return false; +} + +bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) +{ + return false; +} + +bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) +{ + return true; +} + +Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) +{ + return Protocols::InteractionModel::Status::Success; +} + +const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) +{ + // Note: This test does not make use of the real attribute metadata. + static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; + return &stub; +} + +CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, + TLV::TLVReader & aReader, WriteHandler * aWriteHandler) +{ + static ListIndex listStructOctetStringElementCount = 0; + + if (aPath.mDataVersion.HasValue() && aPath.mDataVersion.Value() == kRejectedDataVersion) + { + return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::DataVersionMismatch); + } + + if (aPath.mClusterId == Clusters::UnitTesting::Id && + aPath.mAttributeId == Attributes::ListStructOctetString::TypeInfo::GetAttributeId()) + { + if (gWriteResponseDirective == WriteResponseDirective::kSendAttributeSuccess) + { + if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) + { + + Attributes::ListStructOctetString::TypeInfo::DecodableType value; + + ReturnErrorOnFailure(DataModel::Decode(aReader, value)); + + auto iter = value.begin(); + listStructOctetStringElementCount = 0; + while (iter.Next()) + { + auto & item = iter.GetValue(); + + VerifyOrReturnError(item.member1 == listStructOctetStringElementCount, CHIP_ERROR_INVALID_ARGUMENT); + listStructOctetStringElementCount++; + } + + aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); + } + else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) + { + Structs::TestListStructOctet::DecodableType item; + ReturnErrorOnFailure(DataModel::Decode(aReader, item)); + VerifyOrReturnError(item.member1 == listStructOctetStringElementCount, CHIP_ERROR_INVALID_ARGUMENT); + listStructOctetStringElementCount++; + + aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); + } + else + { + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; + } + } + else + { + aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Failure); + } + + return CHIP_NO_ERROR; + } + if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::ListFabricScoped::Id) + { + // Mock a invalid SubjectDescriptor + AttributeValueDecoder decoder(aReader, Access::SubjectDescriptor()); + if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) + { + Attributes::ListFabricScoped::TypeInfo::DecodableType value; + + ReturnErrorOnFailure(decoder.Decode(value)); + + auto iter = value.begin(); + while (iter.Next()) + { + auto & item = iter.GetValue(); + (void) item; + } + + aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); + } + else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) + { + Structs::TestFabricScoped::DecodableType item; + ReturnErrorOnFailure(decoder.Decode(item)); + + aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); + } + else + { + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; + } + return CHIP_NO_ERROR; + } + + // Boolean attribute of unit testing cluster triggers "multiple errors" case. + if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Boolean::TypeInfo::GetAttributeId()) + { + InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; + + if (gWriteResponseDirective == WriteResponseDirective::kSendMultipleSuccess) + { + status = InteractionModel::Status::Success; + } + else if (gWriteResponseDirective == WriteResponseDirective::kSendMultipleErrors) + { + status = InteractionModel::Status::Failure; + } + else + { + VerifyOrDie(false); + } + + for (size_t i = 0; i < 4; ++i) + { + aWriteHandler->AddStatus(aPath, status); + } + + return CHIP_NO_ERROR; + } + + if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Int8u::TypeInfo::GetAttributeId()) + { + InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; + if (gWriteResponseDirective == WriteResponseDirective::kSendClusterSpecificSuccess) + { + status = InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kExampleClusterSpecificSuccess); + } + else if (gWriteResponseDirective == WriteResponseDirective::kSendClusterSpecificFailure) + { + status = InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kExampleClusterSpecificFailure); + } + else + { + VerifyOrDie(false); + } + + aWriteHandler->AddStatus(aPath, status); + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, chip::TLV::TLVReader & aReader, + CommandHandler * apCommandObj) +{ + ChipLogDetail(Controller, "Received Cluster Command: Endpoint=%x Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + aCommandPath.mEndpointId, ChipLogValueMEI(aCommandPath.mClusterId), ChipLogValueMEI(aCommandPath.mCommandId)); + + if (aCommandPath.mClusterId == Clusters::UnitTesting::Id && + aCommandPath.mCommandId == Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type::GetCommandId()) + { + Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::DecodableType dataRequest; + + if (DataModel::Decode(aReader, dataRequest) != CHIP_NO_ERROR) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure, "Unable to decode the request"); + return; + } + + if (gCommandResponseDirective == CommandResponseDirective::kSendDataResponse) + { + Clusters::UnitTesting::Commands::TestStructArrayArgumentResponse::Type dataResponse; + Clusters::UnitTesting::Structs::NestedStructList::Type nestedStructList[4]; + + uint8_t i = 0; + for (auto & item : nestedStructList) + { + item.a = i; + item.b = false; + item.c.a = i; + item.c.b = true; + i++; + } + + dataResponse.arg1 = nestedStructList; + dataResponse.arg6 = true; + + apCommandObj->AddResponse(aCommandPath, dataResponse); + } + else if (gCommandResponseDirective == CommandResponseDirective::kSendSuccessStatusCode) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Success); + } + else if (gCommandResponseDirective == CommandResponseDirective::kSendMultipleSuccessStatusCodes) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Success, + "No error but testing status success case"); + + // TODO: Right now all but the first AddStatus call fail, so this + // test is not really testing what it should. + for (size_t i = 0; i < 3; ++i) + { + (void) apCommandObj->FallibleAddStatus(aCommandPath, Protocols::InteractionModel::Status::Success, + "No error but testing status success case"); + } + // And one failure on the end. + (void) apCommandObj->FallibleAddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); + } + else if (gCommandResponseDirective == CommandResponseDirective::kSendError) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); + } + else if (gCommandResponseDirective == CommandResponseDirective::kSendMultipleErrors) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); + + // TODO: Right now all but the first AddStatus call fail, so this + // test is not really testing what it should. + for (size_t i = 0; i < 3; ++i) + { + (void) apCommandObj->FallibleAddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); + } + } + else if (gCommandResponseDirective == CommandResponseDirective::kSendSuccessStatusCodeWithClusterStatus) + { + apCommandObj->AddStatus( + aCommandPath, Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kTestSuccessClusterStatus)); + } + else if (gCommandResponseDirective == CommandResponseDirective::kSendErrorWithClusterStatus) + { + apCommandObj->AddStatus( + aCommandPath, Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kTestFailureClusterStatus)); + } + else if (gCommandResponseDirective == CommandResponseDirective::kAsync) + { + gAsyncCommandHandle = apCommandObj; + } + } +} + +InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) +{ + // Mock cluster catalog, only support commands on one cluster on one endpoint. + using InteractionModel::Status; + + if (aCommandPath.mEndpointId != kTestEndpointId) + { + return Status::UnsupportedEndpoint; + } + + if (aCommandPath.mClusterId != Clusters::UnitTesting::Id) + { + return Status::UnsupportedCluster; + } + + return Status::Success; +} + +} // namespace app +} // namespace chip diff --git a/src/controller/tests/data_model/DataModelFixtures.h b/src/controller/tests/data_model/DataModelFixtures.h new file mode 100644 index 00000000000000..dfdc60e5b59b06 --- /dev/null +++ b/src/controller/tests/data_model/DataModelFixtures.h @@ -0,0 +1,102 @@ +/* + * + * 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. + */ + +// This module provides shared fixture implementations of global functions +// for data model tests as well as global variables to control them. + +#pragma once + +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace DataModelTests { + +constexpr EndpointId kTestEndpointId = 1; + +constexpr ClusterId kPerpetualClusterId = Test::MockClusterId(2); +constexpr AttributeId kPerpetualAttributeid = Test::MockAttributeId(1); + +constexpr DataVersion kRejectedDataVersion = 1; +constexpr DataVersion kAcceptedDataVersion = 5; +constexpr DataVersion kDataVersion = kAcceptedDataVersion; + +constexpr uint8_t kExampleClusterSpecificSuccess = 11u; +constexpr uint8_t kExampleClusterSpecificFailure = 12u; + +constexpr ClusterStatus kTestSuccessClusterStatus = 1; +constexpr ClusterStatus kTestFailureClusterStatus = 2; + +// Controls how the fixture responds to attribute reads +enum class ReadResponseDirective +{ + kSendDataResponse, + kSendManyDataResponses, // Many data blocks, for a single concrete path + // read, simulating a malicious server. + kSendManyDataResponsesWrongPath, // Many data blocks, all using the wrong + // path, for a single concrete path + // read, simulating a malicious server. + kSendDataError, + kSendTwoDataErrors, // Multiple errors, for a single concrete path, + // simulating a malicious server. +}; +extern ScopedChangeOnly gReadResponseDirective; + +// Number of reads of Clusters::UnitTesting::Attributes::Int16u that we have observed. +// Every read will increment this count by 1 and return the new value. +extern uint16_t gInt16uTotalReadCount; + +// Controls the ICD operating mode for the fixture +extern ScopedChangeOnly gIsLitIcd; + +// Controls how the fixture responds to attribute writes +enum class WriteResponseDirective +{ + kSendAttributeSuccess, + kSendAttributeError, + kSendMultipleSuccess, + kSendMultipleErrors, + kSendClusterSpecificSuccess, + kSendClusterSpecificFailure, +}; +extern ScopedChangeOnly gWriteResponseDirective; + +// Controls how the fixture responds to commands +enum class CommandResponseDirective +{ + kSendDataResponse, + kSendSuccessStatusCode, + kSendMultipleSuccessStatusCodes, + kSendError, + kSendMultipleErrors, + kSendSuccessStatusCodeWithClusterStatus, + kSendErrorWithClusterStatus, + kAsync, +}; +extern ScopedChangeOnly gCommandResponseDirective; + +// Populated with the command handle when gCommandResponseDirective == kAsync +extern CommandHandler::Handle gAsyncCommandHandle; + +} // namespace DataModelTests +} // namespace app +} // namespace chip diff --git a/src/controller/tests/data_model/TestCommands.cpp b/src/controller/tests/data_model/TestCommands.cpp index 11b71415ad6ec5..2ccb98d5cf7e00 100644 --- a/src/controller/tests/data_model/TestCommands.cpp +++ b/src/controller/tests/data_model/TestCommands.cpp @@ -25,10 +25,12 @@ #include #include -#include "app/data-model/NullObject.h" +#include "DataModelFixtures.h" + #include #include #include +#include #include #include #include @@ -45,142 +47,9 @@ using TestContext = chip::Test::AppContext; using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; +using namespace chip::app::DataModelTests; using namespace chip::Protocols; -namespace { -chip::ClusterStatus kTestSuccessClusterStatus = 1; -chip::ClusterStatus kTestFailureClusterStatus = 2; - -constexpr EndpointId kTestEndpointId = 1; - -enum ResponseDirective -{ - kSendDataResponse, - kSendSuccessStatusCode, - kSendMultipleSuccessStatusCodes, - kSendError, - kSendMultipleErrors, - kSendSuccessStatusCodeWithClusterStatus, - kSendErrorWithClusterStatus, - kAsync, -}; - -ResponseDirective responseDirective; -CommandHandler::Handle asyncHandle; - -} // namespace - -namespace chip { -namespace app { - -void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, chip::TLV::TLVReader & aReader, - CommandHandler * apCommandObj) -{ - ChipLogDetail(Controller, "Received Cluster Command: Endpoint=%x Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - aCommandPath.mEndpointId, ChipLogValueMEI(aCommandPath.mClusterId), ChipLogValueMEI(aCommandPath.mCommandId)); - - if (aCommandPath.mClusterId == Clusters::UnitTesting::Id && - aCommandPath.mCommandId == Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type::GetCommandId()) - { - Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::DecodableType dataRequest; - - if (DataModel::Decode(aReader, dataRequest) != CHIP_NO_ERROR) - { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure, "Unable to decode the request"); - return; - } - - if (responseDirective == kSendDataResponse) - { - Clusters::UnitTesting::Commands::TestStructArrayArgumentResponse::Type dataResponse; - Clusters::UnitTesting::Structs::NestedStructList::Type nestedStructList[4]; - - uint8_t i = 0; - for (auto & item : nestedStructList) - { - item.a = i; - item.b = false; - item.c.a = i; - item.c.b = true; - i++; - } - - dataResponse.arg1 = nestedStructList; - dataResponse.arg6 = true; - - apCommandObj->AddResponse(aCommandPath, dataResponse); - } - else if (responseDirective == kSendSuccessStatusCode) - { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Success); - } - else if (responseDirective == kSendMultipleSuccessStatusCodes) - { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Success, - "No error but testing status success case"); - - // TODO: Right now all but the first AddStatus call fail, so this - // test is not really testing what it should. - for (size_t i = 0; i < 3; ++i) - { - (void) apCommandObj->FallibleAddStatus(aCommandPath, Protocols::InteractionModel::Status::Success, - "No error but testing status success case"); - } - // And one failure on the end. - (void) apCommandObj->FallibleAddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); - } - else if (responseDirective == kSendError) - { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); - } - else if (responseDirective == kSendMultipleErrors) - { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); - - // TODO: Right now all but the first AddStatus call fail, so this - // test is not really testing what it should. - for (size_t i = 0; i < 3; ++i) - { - (void) apCommandObj->FallibleAddStatus(aCommandPath, Protocols::InteractionModel::Status::Failure); - } - } - else if (responseDirective == kSendSuccessStatusCodeWithClusterStatus) - { - apCommandObj->AddStatus( - aCommandPath, Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kTestSuccessClusterStatus)); - } - else if (responseDirective == kSendErrorWithClusterStatus) - { - apCommandObj->AddStatus( - aCommandPath, Protocols::InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kTestFailureClusterStatus)); - } - else if (responseDirective == kAsync) - { - asyncHandle = apCommandObj; - } - } -} - -InteractionModel::Status ServerClusterCommandExists(const ConcreteCommandPath & aCommandPath) -{ - // Mock cluster catalog, only support commands on one cluster on one endpoint. - using InteractionModel::Status; - - if (aCommandPath.mEndpointId != kTestEndpointId) - { - return Status::UnsupportedEndpoint; - } - - if (aCommandPath.mClusterId != Clusters::UnitTesting::Id) - { - return Status::UnsupportedCluster; - } - - return Status::Success; -} -} // namespace app -} // namespace chip - namespace { class TestCommands : public ::testing::Test @@ -257,7 +126,7 @@ TEST_F(TestCommands, TestDataResponse) // not safe to do so. auto onFailureCb = [&onFailureWasCalled](CHIP_ERROR aError) { onFailureWasCalled = true; }; - responseDirective = kSendDataResponse; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendDataResponse); chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -295,7 +164,7 @@ TEST_F(TestCommands, TestSuccessNoDataResponse) // not safe to do so. auto onFailureCb = [&onFailureWasCalled](CHIP_ERROR aError) { onFailureWasCalled = true; }; - responseDirective = kSendSuccessStatusCode; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendSuccessStatusCode); chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -333,7 +202,7 @@ TEST_F(TestCommands, TestMultipleSuccessNoDataResponses) // not safe to do so. auto onFailureCb = [&failureCalls](CHIP_ERROR aError) { ++failureCalls; }; - responseDirective = kSendMultipleSuccessStatusCodes; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendMultipleSuccessStatusCodes); Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -372,7 +241,7 @@ TEST_F(TestCommands, TestAsyncResponse) // not safe to do so. auto onFailureCb = [&onFailureWasCalled](CHIP_ERROR aError) { onFailureWasCalled = true; }; - responseDirective = kAsync; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kAsync); chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -382,12 +251,12 @@ TEST_F(TestCommands, TestAsyncResponse) EXPECT_TRUE(!onSuccessWasCalled && !onFailureWasCalled && !statusCheck); EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 2u); - CommandHandler * commandHandle = asyncHandle.Get(); + CommandHandler * commandHandle = gAsyncCommandHandle.Get(); ASSERT_NE(commandHandle, nullptr); commandHandle->AddStatus(ConcreteCommandPath(kTestEndpointId, request.GetClusterId(), request.GetCommandId()), Protocols::InteractionModel::Status::Success); - asyncHandle.Release(); + gAsyncCommandHandle.Release(); mpContext->DrainAndServiceIO(); @@ -417,7 +286,7 @@ TEST_F(TestCommands, TestFailure) onFailureWasCalled = true; }; - responseDirective = kSendError; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendError); chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -455,7 +324,7 @@ TEST_F(TestCommands, TestMultipleFailures) ++failureCalls; }; - responseDirective = kSendMultipleErrors; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendMultipleErrors); Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -495,7 +364,7 @@ TEST_F(TestCommands, TestSuccessNoDataResponseWithClusterStatus) // not safe to do so. auto onFailureCb = [&onFailureWasCalled](CHIP_ERROR aError) { onFailureWasCalled = true; }; - responseDirective = kSendSuccessStatusCodeWithClusterStatus; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendSuccessStatusCodeWithClusterStatus); chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); @@ -534,7 +403,7 @@ TEST_F(TestCommands, TestFailureWithClusterStatus) onFailureWasCalled = true; }; - responseDirective = kSendErrorWithClusterStatus; + ScopedChange directive(gCommandResponseDirective, CommandResponseDirective::kSendErrorWithClusterStatus); chip::Controller::InvokeCommandRequest(&mpContext->GetExchangeManager(), sessionHandle, kTestEndpointId, request, onSuccessCb, onFailureCb); diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index 906ba82a213042..954ff5044418d4 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -19,8 +19,8 @@ #include #include -#include "system/SystemClock.h" -#include "transport/SecureSession.h" +#include "DataModelFixtures.h" + #include #include #include @@ -35,228 +35,17 @@ #include #include #include +#include +#include using TestContext = chip::Test::AppContext; using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; +using namespace chip::app::DataModelTests; using namespace chip::Protocols; - -namespace { - -constexpr EndpointId kTestEndpointId = 1; -constexpr DataVersion kDataVersion = 5; -constexpr AttributeId kPerpetualAttributeid = chip::Test::MockAttributeId(1); -constexpr ClusterId kPerpetualClusterId = chip::Test::MockClusterId(2); -bool expectedAttribute1 = true; -int16_t expectedAttribute2 = 42; -uint64_t expectedAttribute3 = 0xdeadbeef0000cafe; -uint8_t expectedAttribute4[256] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -}; - -enum ResponseDirective -{ - kSendDataResponse, - kSendManyDataResponses, // Many data blocks, for a single concrete path - // read, simulating a malicious server. - kSendManyDataResponsesWrongPath, // Many data blocks, all using the wrong - // path, for a single concrete path - // read, simulating a malicious server. - kSendDataError, - kSendTwoDataErrors, // Multiple errors, for a single concrete path, - // simulating a malicious server. -}; - -ResponseDirective responseDirective; - -// Number of reads of Clusters::UnitTesting::Attributes::Int16u that we have observed. -// Every read will increment this count by 1 and return the new value. -uint16_t totalReadCount = 0; - -bool isLitIcd = false; - -} // namespace - -namespace chip { -namespace app { -CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, - const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, - AttributeEncodeState * apEncoderState) -{ - if (aPath.mEndpointId >= chip::Test::kMockEndpointMin) - { - return chip::Test::ReadSingleMockClusterData(aSubjectDescriptor.fabricIndex, aPath, aAttributeReports, apEncoderState); - } - - if (responseDirective == kSendManyDataResponses || responseDirective == kSendManyDataResponsesWrongPath) - { - if (aPath.mClusterId != Clusters::UnitTesting::Id || aPath.mAttributeId != Clusters::UnitTesting::Attributes::Boolean::Id) - { - return CHIP_ERROR_INCORRECT_STATE; - } - - for (size_t i = 0; i < 4; ++i) - { - ConcreteAttributePath path(aPath); - // Use an incorrect attribute id for some of the responses. - path.mAttributeId = - static_cast(path.mAttributeId + (i / 2) + (responseDirective == kSendManyDataResponsesWrongPath)); - AttributeEncodeState state(apEncoderState); - AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, path, kDataVersion, aIsFabricFiltered, state); - ReturnErrorOnFailure(valueEncoder.Encode(true)); - } - - return CHIP_NO_ERROR; - } - - if (responseDirective == kSendDataResponse) - { - if (aPath.mClusterId == app::Clusters::UnitTesting::Id && - aPath.mAttributeId == app::Clusters::UnitTesting::Attributes::ListFabricScoped::Id) - { - AttributeEncodeState state(apEncoderState); - AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, - state); - - return valueEncoder.EncodeList([aSubjectDescriptor](const auto & encoder) -> CHIP_ERROR { - app::Clusters::UnitTesting::Structs::TestFabricScoped::Type val; - val.fabricIndex = aSubjectDescriptor.fabricIndex; - ReturnErrorOnFailure(encoder.Encode(val)); - val.fabricIndex = (val.fabricIndex == 1) ? 2 : 1; - ReturnErrorOnFailure(encoder.Encode(val)); - return CHIP_NO_ERROR; - }); - } - if (aPath.mClusterId == app::Clusters::UnitTesting::Id && - aPath.mAttributeId == app::Clusters::UnitTesting::Attributes::Int16u::Id) - { - AttributeEncodeState state(apEncoderState); - AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, - state); - - return valueEncoder.Encode(++totalReadCount); - } - if (aPath.mClusterId == kPerpetualClusterId || - (aPath.mClusterId == app::Clusters::UnitTesting::Id && aPath.mAttributeId == kPerpetualAttributeid)) - { - AttributeEncodeState state; - AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, - state); - - CHIP_ERROR err = valueEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR { - encoder.Encode(static_cast(1)); - return CHIP_ERROR_NO_MEMORY; - }); - - if (err != CHIP_NO_ERROR) - { - // If the err is not CHIP_NO_ERROR, means the encoding was aborted, then the valueEncoder may save its state. - // The state is used by list chunking feature for now. - if (apEncoderState != nullptr) - { - *apEncoderState = valueEncoder.GetState(); - } - return err; - } - } - if (aPath.mClusterId == app::Clusters::IcdManagement::Id && - aPath.mAttributeId == app::Clusters::IcdManagement::Attributes::OperatingMode::Id) - { - AttributeEncodeState state(apEncoderState); - AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor, aPath, kDataVersion, aIsFabricFiltered, - state); - - return valueEncoder.Encode(isLitIcd ? Clusters::IcdManagement::OperatingModeEnum::kLit - : Clusters::IcdManagement::OperatingModeEnum::kSit); - } - - AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); - ReturnErrorOnFailure(aAttributeReports.GetError()); - AttributeDataIB::Builder & attributeData = attributeReport.CreateAttributeData(); - ReturnErrorOnFailure(attributeReport.GetError()); - Clusters::UnitTesting::Attributes::ListStructOctetString::TypeInfo::Type value; - Clusters::UnitTesting::Structs::TestListStructOctet::Type valueBuf[4]; - - value = valueBuf; - - uint8_t i = 0; - for (auto & item : valueBuf) - { - item.member1 = i; - i++; - } - - attributeData.DataVersion(kDataVersion); - ReturnErrorOnFailure(attributeData.GetError()); - AttributePathIB::Builder & attributePath = attributeData.CreatePath(); - attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); - ReturnErrorOnFailure(attributePath.GetError()); - - ReturnErrorOnFailure(DataModel::Encode(*(attributeData.GetWriter()), TLV::ContextTag(AttributeDataIB::Tag::kData), value)); - ReturnErrorOnFailure(attributeData.EndOfAttributeDataIB()); - return attributeReport.EndOfAttributeReportIB(); - } - - for (size_t i = 0; i < (responseDirective == kSendTwoDataErrors ? 2 : 1); ++i) - { - AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); - ReturnErrorOnFailure(aAttributeReports.GetError()); - AttributeStatusIB::Builder & attributeStatus = attributeReport.CreateAttributeStatus(); - AttributePathIB::Builder & attributePath = attributeStatus.CreatePath(); - attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); - ReturnErrorOnFailure(attributePath.GetError()); - - StatusIB::Builder & errorStatus = attributeStatus.CreateErrorStatus(); - ReturnErrorOnFailure(attributeStatus.GetError()); - errorStatus.EncodeStatusIB(StatusIB(Protocols::InteractionModel::Status::Busy)); - attributeStatus.EndOfAttributeStatusIB(); - ReturnErrorOnFailure(attributeStatus.GetError()); - ReturnErrorOnFailure(attributeReport.EndOfAttributeReportIB()); - } - - return CHIP_NO_ERROR; -} - -bool IsClusterDataVersionEqual(const app::ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) -{ - if (aRequiredVersion == kDataVersion) - { - return true; - } - if (Test::GetVersion() == aRequiredVersion) - { - return true; - } - - return false; -} - -bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) -{ - return false; -} - -bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) -{ - return true; -} - -Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) -{ - return Protocols::InteractionModel::Status::Success; -} - -} // namespace app -} // namespace chip +using namespace chip::Test; namespace { @@ -390,7 +179,7 @@ TEST_F(TestRead, TestReadAttributeResponse) auto sessionHandle = mpContext->GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -430,8 +219,8 @@ TEST_F(TestRead, TestReadAttributeResponse) // `EXPECT_TRUE(version1.HasValue() && (version1.Value() == 0))`. TEST_F(TestRead, TestReadSubscribeAttributeResponseWithVersionOnlyCache) { - CHIP_ERROR err = CHIP_NO_ERROR; - responseDirective = kSendDataResponse; + CHIP_ERROR err = CHIP_NO_ERROR; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); MockInteractionModelApp delegate; chip::app::ClusterStateCache cache(delegate, Optional::Missing(), false /*cachedData*/); @@ -502,8 +291,8 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithVersionOnlyCache) TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) { - CHIP_ERROR err = CHIP_NO_ERROR; - responseDirective = kSendDataResponse; + CHIP_ERROR err = CHIP_NO_ERROR; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); MockInteractionModelApp delegate; chip::app::ClusterStateCache cache(delegate); @@ -606,7 +395,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -616,7 +405,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -626,7 +415,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; @@ -684,7 +473,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -694,7 +483,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -739,7 +528,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -749,7 +538,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -759,7 +548,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -769,7 +558,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -818,7 +607,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -828,7 +617,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -838,7 +627,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -882,7 +671,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -892,7 +681,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -902,7 +691,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -912,7 +701,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -964,7 +753,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -974,7 +763,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -984,7 +773,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -1033,7 +822,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1043,7 +832,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -1053,7 +842,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -1097,7 +886,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1107,7 +896,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -1117,7 +906,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -1127,7 +916,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; } @@ -1180,7 +969,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1190,7 +979,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -1200,7 +989,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -1210,7 +999,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; readPrepareParams.mpEventPathParamsList = nullptr; @@ -1269,7 +1058,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1279,7 +1068,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1289,7 +1078,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -1299,7 +1088,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -1309,7 +1098,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { app::ConcreteAttributePath attributePath(chip::Test::kMockEndpoint2, chip::Test::MockClusterId(2), @@ -1318,7 +1107,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; @@ -1380,7 +1169,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1390,7 +1179,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1400,7 +1189,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -1410,7 +1199,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -1420,7 +1209,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1430,7 +1219,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } delegate.mNumAttributeResponse = 0; readPrepareParams.mpEventPathParamsList = nullptr; @@ -1469,7 +1258,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); bool receivedAttribute1; reader.Get(receivedAttribute1); - EXPECT_EQ(receivedAttribute1, expectedAttribute1); + EXPECT_EQ(receivedAttribute1, mockAttribute1); } { @@ -1479,7 +1268,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); int16_t receivedAttribute2; reader.Get(receivedAttribute2); - EXPECT_EQ(receivedAttribute2, expectedAttribute2); + EXPECT_EQ(receivedAttribute2, mockAttribute2); } { @@ -1489,7 +1278,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint64_t receivedAttribute3; reader.Get(receivedAttribute3); - EXPECT_EQ(receivedAttribute3, expectedAttribute3); + EXPECT_EQ(receivedAttribute3, mockAttribute3); } { @@ -1499,7 +1288,7 @@ TEST_F(TestRead, TestReadSubscribeAttributeResponseWithCache) EXPECT_EQ(cache.Get(attributePath, reader), CHIP_NO_ERROR); uint8_t receivedAttribute4[256]; reader.GetBytes(receivedAttribute4, 256); - EXPECT_TRUE(memcmp(receivedAttribute4, expectedAttribute4, 256)); + EXPECT_TRUE(memcmp(receivedAttribute4, mockAttribute4, 256)); } delegate.mNumAttributeResponse = 0; } @@ -1546,7 +1335,7 @@ TEST_F(TestRead, TestReadAttributeError) auto sessionHandle = mpContext->GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; - responseDirective = kSendDataError; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataError); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -1577,7 +1366,7 @@ TEST_F(TestRead, TestReadAttributeTimeout) auto sessionHandle = mpContext->GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; - responseDirective = kSendDataError; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataError); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -1836,7 +1625,7 @@ TEST_F(TestRead, TestReadHandler_MultipleSubscriptions) uint32_t numSuccessCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -1904,7 +1693,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionAppRejection) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -1970,7 +1759,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest1) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2045,7 +1834,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest2) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2120,7 +1909,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest3) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2197,7 +1986,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest4) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2264,7 +2053,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest5) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2339,7 +2128,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest6) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2414,7 +2203,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest7) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2490,7 +2279,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest8) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2553,7 +2342,7 @@ TEST_F(TestRead, TestReadHandler_SubscriptionReportingIntervalsTest9) uint32_t numFailureCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2704,16 +2493,16 @@ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) auto sessionHandle = mpContext->GetSessionBobToAlice(); mpContext->SetMRPMode(chip::Test::MessagingContext::MRPMode::kResponsive); + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); + ScopedChange isLitIcd(gIsLitIcd, false); { TestResubscriptionCallback callback; app::ReadClient readClient(app::InteractionModelEngine::GetInstance(), &mpContext->GetExchangeManager(), callback, app::ReadClient::InteractionType::Subscribe); - responseDirective = kSendDataResponse; callback.mScheduleLITResubscribeImmediately = false; callback.SetReadClient(&readClient); - isLitIcd = false; app::ReadPrepareParams readPrepareParams(mpContext->GetSessionBobToAlice()); @@ -2808,8 +2597,6 @@ TEST_F(TestRead, TestSubscribe_DynamicLITSubscription) app::InteractionModelEngine::GetInstance()->ShutdownActiveReads(); EXPECT_EQ(mpContext->GetExchangeManager().GetNumActiveExchanges(), 0u); - - isLitIcd = false; } /** @@ -2944,7 +2731,7 @@ void TestRead::SubscribeThenReadHelper(TestContext * apCtx, size_t aSubscribeCou uint32_t numReadSuccessCalls = 0; uint32_t numReadFailureCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -2997,9 +2784,9 @@ void TestRead::MultipleReadHelperInternal(TestContext * apCtx, size_t aReadCount auto sessionHandle = apCtx->GetSessionBobToAlice(); - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); - uint16_t firstExpectedResponse = totalReadCount + 1; + uint16_t firstExpectedResponse = gInt16uTotalReadCount + 1; auto onFailureCb = [&aNumFailureCalls](const app::ConcreteDataAttributePath * attributePath, CHIP_ERROR aError) { aNumFailureCalls++; @@ -3040,7 +2827,7 @@ TEST_F(TestRead, TestReadHandler_MultipleSubscriptionsWithDataVersionFilter) uint32_t numSuccessCalls = 0; uint32_t numSubscriptionEstablishedCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -3181,7 +2968,7 @@ TEST_F(TestRead, TestReadHandlerResourceExhaustion_MultipleReads) uint32_t numSuccessCalls = 0; uint32_t numFailureCalls = 0; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -3232,7 +3019,7 @@ TEST_F(TestRead, TestReadFabricScopedWithoutFabricFilter) auto sessionHandle = mpContext->GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -3277,7 +3064,7 @@ TEST_F(TestRead, TestReadFabricScopedWithFabricFilter) auto sessionHandle = mpContext->GetSessionBobToAlice(); bool onSuccessCbInvoked = false, onFailureCbInvoked = false; - responseDirective = kSendDataResponse; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendDataResponse); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -4835,7 +4622,7 @@ TEST_F(TestRead, TestReadAttribute_ManyDataValues) size_t successCalls = 0; size_t failureCalls = 0; - responseDirective = kSendManyDataResponses; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendManyDataResponses); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -4868,7 +4655,7 @@ TEST_F(TestRead, TestReadAttribute_ManyDataValuesWrongPath) size_t successCalls = 0; size_t failureCalls = 0; - responseDirective = kSendManyDataResponsesWrongPath; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendManyDataResponsesWrongPath); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -4901,7 +4688,7 @@ TEST_F(TestRead, TestReadAttribute_ManyErrors) size_t successCalls = 0; size_t failureCalls = 0; - responseDirective = kSendTwoDataErrors; + ScopedChange directive(gReadResponseDirective, ReadResponseDirective::kSendTwoDataErrors); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. diff --git a/src/controller/tests/data_model/TestWrite.cpp b/src/controller/tests/data_model/TestWrite.cpp index da5505ccd613a1..8f0d96f7667507 100644 --- a/src/controller/tests/data_model/TestWrite.cpp +++ b/src/controller/tests/data_model/TestWrite.cpp @@ -19,6 +19,8 @@ #include #include +#include "DataModelFixtures.h" + #include "app-common/zap-generated/ids/Clusters.h" #include #include @@ -37,178 +39,11 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::UnitTesting; +using namespace chip::app::DataModelTests; using namespace chip::Protocols; namespace { -constexpr EndpointId kTestEndpointId = 1; -constexpr DataVersion kRejectedDataVersion = 1; -constexpr DataVersion kAcceptedDataVersion = 5; - -constexpr uint8_t kExampleClusterSpecificSuccess = 11u; -constexpr uint8_t kExampleClusterSpecificFailure = 12u; - -enum ResponseDirective -{ - kSendAttributeSuccess, - kSendAttributeError, - kSendMultipleSuccess, - kSendMultipleErrors, - kSendClusterSpecificSuccess, - kSendClusterSpecificFailure, -}; - -ResponseDirective gResponseDirective = kSendAttributeSuccess; - -} // namespace - -namespace chip { -namespace app { - -const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) -{ - // Note: This test does not make use of the real attribute metadata. - static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; - return &stub; -} - -CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, - TLV::TLVReader & aReader, WriteHandler * aWriteHandler) -{ - static ListIndex listStructOctetStringElementCount = 0; - - if (aPath.mDataVersion.HasValue() && aPath.mDataVersion.Value() == kRejectedDataVersion) - { - return aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::DataVersionMismatch); - } - - if (aPath.mClusterId == Clusters::UnitTesting::Id && - aPath.mAttributeId == Attributes::ListStructOctetString::TypeInfo::GetAttributeId()) - { - if (gResponseDirective == kSendAttributeSuccess) - { - if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) - { - - Attributes::ListStructOctetString::TypeInfo::DecodableType value; - - ReturnErrorOnFailure(DataModel::Decode(aReader, value)); - - auto iter = value.begin(); - listStructOctetStringElementCount = 0; - while (iter.Next()) - { - auto & item = iter.GetValue(); - - VerifyOrReturnError(item.member1 == listStructOctetStringElementCount, CHIP_ERROR_INVALID_ARGUMENT); - listStructOctetStringElementCount++; - } - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) - { - Structs::TestListStructOctet::DecodableType item; - ReturnErrorOnFailure(DataModel::Decode(aReader, item)); - VerifyOrReturnError(item.member1 == listStructOctetStringElementCount, CHIP_ERROR_INVALID_ARGUMENT); - listStructOctetStringElementCount++; - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - } - else - { - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Failure); - } - - return CHIP_NO_ERROR; - } - if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::ListFabricScoped::Id) - { - // Mock a invalid SubjectDescriptor - AttributeValueDecoder decoder(aReader, Access::SubjectDescriptor()); - if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) - { - Attributes::ListFabricScoped::TypeInfo::DecodableType value; - - ReturnErrorOnFailure(decoder.Decode(value)); - - auto iter = value.begin(); - while (iter.Next()) - { - auto & item = iter.GetValue(); - (void) item; - } - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) - { - Structs::TestFabricScoped::DecodableType item; - ReturnErrorOnFailure(decoder.Decode(item)); - - aWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); - } - else - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - return CHIP_NO_ERROR; - } - - // Boolean attribute of unit testing cluster triggers "multiple errors" case. - if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Boolean::TypeInfo::GetAttributeId()) - { - InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; - - if (gResponseDirective == kSendMultipleSuccess) - { - status = InteractionModel::Status::Success; - } - else if (gResponseDirective == kSendMultipleErrors) - { - status = InteractionModel::Status::Failure; - } - else - { - VerifyOrDie(false); - } - - for (size_t i = 0; i < 4; ++i) - { - aWriteHandler->AddStatus(aPath, status); - } - - return CHIP_NO_ERROR; - } - - if (aPath.mClusterId == Clusters::UnitTesting::Id && aPath.mAttributeId == Attributes::Int8u::TypeInfo::GetAttributeId()) - { - InteractionModel::ClusterStatusCode status{ Protocols::InteractionModel::Status::InvalidValue }; - if (gResponseDirective == kSendClusterSpecificSuccess) - { - status = InteractionModel::ClusterStatusCode::ClusterSpecificSuccess(kExampleClusterSpecificSuccess); - } - else if (gResponseDirective == kSendClusterSpecificFailure) - { - status = InteractionModel::ClusterStatusCode::ClusterSpecificFailure(kExampleClusterSpecificFailure); - } - else - { - VerifyOrDie(false); - } - - aWriteHandler->AddStatus(aPath, status); - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; -} - class SingleWriteCallback : public WriteClient::Callback { public: @@ -249,11 +84,6 @@ class SingleWriteCallback : public WriteClient::Callback StatusIB mPathStatus; }; -} // namespace app -} // namespace chip - -namespace { - class TestWrite : public ::testing::Test { public: @@ -315,7 +145,7 @@ TEST_F(TestWrite, TestDataResponse) i++; } - gResponseDirective = kSendAttributeSuccess; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendAttributeSuccess); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -353,7 +183,7 @@ TEST_F(TestWrite, TestDataResponseWithAcceptedDataVersion) i++; } - gResponseDirective = kSendAttributeSuccess; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendAttributeSuccess); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -393,7 +223,7 @@ TEST_F(TestWrite, TestDataResponseWithRejectedDataVersion) i++; } - gResponseDirective = kSendAttributeSuccess; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendAttributeSuccess); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -432,7 +262,7 @@ TEST_F(TestWrite, TestAttributeError) i++; } - gResponseDirective = kSendAttributeError; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendAttributeError); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -498,7 +328,7 @@ TEST_F(TestWrite, TestMultipleSuccessResponses) size_t successCalls = 0; size_t failureCalls = 0; - gResponseDirective = kSendMultipleSuccess; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendMultipleSuccess); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -525,7 +355,7 @@ TEST_F(TestWrite, TestMultipleFailureResponses) size_t successCalls = 0; size_t failureCalls = 0; - gResponseDirective = kSendMultipleErrors; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendMultipleErrors); // Passing of stack variables by reference is only safe because of synchronous completion of the interaction. Otherwise, it's // not safe to do so. @@ -552,7 +382,7 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) // Cluster-specific success code case { - gResponseDirective = kSendClusterSpecificSuccess; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendClusterSpecificSuccess); this->ResetCallback(); this->PrepareWriteCallback( @@ -584,7 +414,7 @@ TEST_F(TestWrite, TestWriteClusterSpecificStatuses) // Cluster-specific failure code case { - gResponseDirective = kSendClusterSpecificFailure; + ScopedChange directive(gWriteResponseDirective, WriteResponseDirective::kSendClusterSpecificFailure); this->ResetCallback(); this->PrepareWriteCallback( diff --git a/src/lib/support/Scoped.h b/src/lib/support/Scoped.h index 67cc2ea9e96271..a96021c097ee0a 100644 --- a/src/lib/support/Scoped.h +++ b/src/lib/support/Scoped.h @@ -46,12 +46,16 @@ class ScopedChangeOnly /// Allows a scoped mutation to occur on a variable. /// /// When an instance of this class goes out of scope, the variable -/// will be reset to the default. +/// will be reset to the value id had before the scoped change came +/// into effect. /// -/// Example usage +/// While the ScopedChange is in scope it can be used to make changes +/// to the underlying value using the assignment operator. /// -/// int a = 123; -/// ScopedChangeOnly b(234); +/// Example usage: +/// +/// int a = 123; +/// ScopedChangeOnly b(234); /// /// /* a == 123, b == 234 */ /// { @@ -62,6 +66,8 @@ class ScopedChangeOnly /// /* a == 321, b == 10 */ /// } /// /* a == 321, b == 234 */ +/// changeA = 333; // assignments within the ScopedChange are allowed +/// /* a == 333, b == 234 */ /// } /// /* a == 123, b == 234 */ /// @@ -69,10 +75,22 @@ template class ScopedChange { public: - ScopedChange(ScopedChangeOnly & what, T value) : mValue(what.InternalMutableValue()), mOriginal(what) { mValue = value; } - ScopedChange(T & what, T value) : mValue(what), mOriginal(what) { mValue = value; } + ScopedChange(ScopedChangeOnly & what) : mValue(what.InternalMutableValue()), mOriginal(what) {} + ScopedChange(ScopedChangeOnly & what, T value) : ScopedChange(what) { mValue = value; } + + ScopedChange(T & what) : mValue(what), mOriginal(what) {} + ScopedChange(T & what, T value) : ScopedChange(what) { mValue = value; } + ~ScopedChange() { mValue = mOriginal; } + ScopedChange & operator=(T const & value) + { + mValue = value; + return *this; + } + + operator T() const { return mValue; } + private: T & mValue; T mOriginal; From fba57935485d0c526ed9acaf92d3749fac283709 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Tue, 2 Jul 2024 19:19:32 -0400 Subject: [PATCH 02/15] XML changes for OccupancySensing rev 5 (#34163) * Updated occupancy sensing cluster XML to Rev 5 (Matter 1.4) * Regen ZAP * Fix codegen * Add missing Kotlin generated files * Restyled by whitespace * Restyled by prettier-json --------- Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 19 ++ .../all-clusters-minimal-app.matter | 19 ++ ...p_rootnode_dimmablelight_bCwGYSDpoe.matter | 19 ++ .../rootnode_dimmablelight_bCwGYSDpoe.matter | 19 ++ ...tnode_dimmablepluginunit_f8a9a0b9d4.matter | 19 ++ ...rootnode_occupancysensor_iHyVgifZuo.matter | 19 ++ .../rootnode_thermostat_bm3fb8dhYi.matter | 19 ++ .../contact-sensor-app.matter | 19 ++ .../lighting-common/lighting-app.matter | 19 ++ .../placeholder/linux/apps/app1/config.matter | 19 ++ .../placeholder/linux/apps/app2/config.matter | 19 ++ examples/pump-app/pump-common/pump-app.matter | 19 ++ .../silabs/data_model/pump-thread-app.matter | 19 ++ .../silabs/data_model/pump-wifi-app.matter | 19 ++ .../chip/occupancy-sensing-cluster.xml | 41 +++ .../zcl/zcl-with-test-extensions.json | 1 + src/app/zap-templates/zcl/zcl.json | 1 + .../data_model/controller-clusters.matter | 19 ++ .../chip/devicecontroller/ChipClusters.java | 67 +++++ .../chip/devicecontroller/ChipStructs.java | 76 ++++++ .../devicecontroller/ClusterIDMapping.java | 2 + .../devicecontroller/ClusterInfoMapping.java | 21 ++ .../devicecontroller/ClusterReadMapping.java | 11 + .../devicecontroller/ClusterWriteMapping.java | 22 ++ .../chip/devicecontroller/cluster/files.gni | 1 + ...pancySensingClusterHoldTimeLimitsStruct.kt | 64 +++++ .../clusters/OccupancySensingCluster.kt | 235 ++++++++++++++++++ .../java/matter/controller/cluster/files.gni | 1 + ...pancySensingClusterHoldTimeLimitsStruct.kt | 64 +++++ .../CHIPAttributeTLVValueDecoder.cpp | 71 ++++++ .../python/chip/clusters/CHIPClusters.py | 13 + .../python/chip/clusters/Objects.py | 62 +++++ .../MTRAttributeSpecifiedCheck.mm | 6 + .../MTRAttributeTLVValueDecoder.mm | 25 ++ .../CHIP/zap-generated/MTRBaseClusters.h | 25 ++ .../CHIP/zap-generated/MTRBaseClusters.mm | 100 ++++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 2 + .../CHIP/zap-generated/MTRClusterNames.mm | 8 + .../CHIP/zap-generated/MTRClusters.h | 6 + .../CHIP/zap-generated/MTRClusters.mm | 21 ++ .../CHIP/zap-generated/MTRStructsObjc.h | 7 + .../CHIP/zap-generated/MTRStructsObjc.mm | 33 +++ .../zap-generated/attributes/Accessors.cpp | 46 ++++ .../zap-generated/attributes/Accessors.h | 6 + .../app-common/zap-generated/cluster-enums.h | 13 + .../zap-generated/cluster-objects.cpp | 52 ++++ .../zap-generated/cluster-objects.h | 53 ++++ .../app-common/zap-generated/ids/Attributes.h | 8 + .../zap-generated/cluster/Commands.h | 14 +- .../cluster/ComplexArgumentParser.cpp | 39 +++ .../cluster/ComplexArgumentParser.h | 5 + .../cluster/logging/DataModelLogger.cpp | 44 ++++ .../cluster/logging/DataModelLogger.h | 3 + .../zap-generated/cluster/Commands.h | 223 +++++++++++++++++ 54 files changed, 1775 insertions(+), 2 deletions(-) create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt create mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 13fc057dd62f40..c4636b60e07b9b 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -5890,6 +5890,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -5900,9 +5911,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 303c1af63edbfa..707e74cf1fa87c 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -4438,6 +4438,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -4448,9 +4459,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index 245eb35b1dbd3b..372503cef8bad1 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -1619,6 +1619,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1629,9 +1640,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index 6680bcaeaa7363..a44ffef19ce24b 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -1514,6 +1514,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1524,9 +1535,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter index 9178ac128c2268..95ccd3897c1e6f 100644 --- a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter +++ b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter @@ -1663,6 +1663,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1673,9 +1684,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index 0cd5fede3a5c0f..778bb2daa5e0b6 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -1317,6 +1317,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1327,9 +1338,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index 2e8e81f7fd3d45..f76b5208c97ceb 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -1836,6 +1836,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1846,9 +1857,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter index 59a3ead8a4e439..9b1e4ba906ea19 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter @@ -1616,6 +1616,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1626,9 +1637,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 190744f68aa6c3..4be0b2c2529409 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -2321,6 +2321,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -2331,9 +2342,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 39f6a4b3894475..c4141255ad55f3 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -6324,6 +6324,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -6334,9 +6345,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index d3ec0ea0e26723..e5a389e2e4813d 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -6281,6 +6281,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -6291,9 +6302,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index c7962c4805d7af..fa81bdc7452213 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -1620,6 +1620,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1630,9 +1641,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.matter b/examples/pump-app/silabs/data_model/pump-thread-app.matter index 736f48b70839f3..42f463b17e256e 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.matter +++ b/examples/pump-app/silabs/data_model/pump-thread-app.matter @@ -1620,6 +1620,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1630,9 +1641,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.matter b/examples/pump-app/silabs/data_model/pump-wifi-app.matter index 736f48b70839f3..42f463b17e256e 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.matter +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.matter @@ -1620,6 +1620,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -1630,9 +1641,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml index effff079cda8e8..23d1e5bb3948d6 100644 --- a/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/occupancy-sensing-cluster.xml @@ -37,6 +37,13 @@ limitations under the License. + + + + + + + Occupancy Sensing Measurement & Sensing @@ -44,6 +51,33 @@ limitations under the License. 0x0406 OCCUPANCY_SENSING_CLUSTER + + + + + + + + + + + + + + + + + + + + + + + + + + + true true @@ -53,6 +87,13 @@ limitations under the License. OccupancySensorType OccupancySensorTypeBitmap + + HoldTime + + + + HoldTimeLimits + PIROccupiedToUnoccupiedDelay diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index b253dd55e72831..95fa00cb7952c7 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -277,6 +277,7 @@ "ICDCounter", "ClientsSupportedPerFabric" ], + "Occupancy Sensing": ["HoldTimeLimits"], "Operational Credentials": [ "SupportedFabrics", "CommissionedFabrics", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 6b361e507a3cf3..e3ec959ff64e83 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -275,6 +275,7 @@ "ICDCounter", "ClientsSupportedPerFabric" ], + "Occupancy Sensing": ["HoldTimeLimits"], "Operational Credentials": [ "SupportedFabrics", "CommissionedFabrics", diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 60d2cf6599b8db..42771c75bf41f2 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -7363,6 +7363,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 3; } + bitmap Feature : bitmap32 { + kOther = 0x1; + kPassiveInfrared = 0x2; + kUltrasonic = 0x4; + kPhysicalContact = 0x8; + kActiveInfrared = 0x10; + kRadar = 0x20; + kRFSensing = 0x40; + kVision = 0x80; + } + bitmap OccupancyBitmap : bitmap8 { kOccupied = 0x1; } @@ -7373,9 +7384,17 @@ cluster OccupancySensing = 1030 { kPhysicalContact = 0x4; } + struct HoldTimeLimitsStruct { + int16u holdTimeMin = 0; + int16u holdTimeMax = 1; + int16u holdTimeDefault = 2; + } + readonly attribute OccupancyBitmap occupancy = 0; readonly attribute OccupancySensorTypeEnum occupancySensorType = 1; readonly attribute OccupancySensorTypeBitmap occupancySensorTypeBitmap = 2; + attribute access(write: manage) optional int16u holdTime = 3; + readonly attribute optional HoldTimeLimitsStruct holdTimeLimits = 4; attribute access(write: manage) optional int16u PIROccupiedToUnoccupiedDelay = 16; attribute access(write: manage) optional int16u PIRUnoccupiedToOccupiedDelay = 17; attribute access(write: manage) optional int8u PIRUnoccupiedToOccupiedThreshold = 18; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index f0b0436a1694c1..e96b2925e77a65 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -47598,6 +47598,8 @@ public static class OccupancySensingCluster extends BaseChipCluster { private static final long OCCUPANCY_ATTRIBUTE_ID = 0L; private static final long OCCUPANCY_SENSOR_TYPE_ATTRIBUTE_ID = 1L; private static final long OCCUPANCY_SENSOR_TYPE_BITMAP_ATTRIBUTE_ID = 2L; + private static final long HOLD_TIME_ATTRIBUTE_ID = 3L; + private static final long HOLD_TIME_LIMITS_ATTRIBUTE_ID = 4L; private static final long P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID = 16L; private static final long P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID = 17L; private static final long P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID = 18L; @@ -47624,6 +47626,10 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } + public interface HoldTimeLimitsAttributeCallback extends BaseAttributeCallback { + void onSuccess(ChipStructs.OccupancySensingClusterHoldTimeLimitsStruct value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -47718,6 +47724,67 @@ public void onSuccess(byte[] tlv) { }, OCCUPANCY_SENSOR_TYPE_BITMAP_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readHoldTimeAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HOLD_TIME_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, HOLD_TIME_ATTRIBUTE_ID, true); + } + + public void writeHoldTimeAttribute(DefaultClusterCallback callback, Integer value) { + writeHoldTimeAttribute(callback, value, 0); + } + + public void writeHoldTimeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + BaseTLVType tlvValue = new UIntType(value); + writeAttribute(new WriteAttributesCallbackImpl(callback), HOLD_TIME_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + } + + public void subscribeHoldTimeAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HOLD_TIME_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, HOLD_TIME_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readHoldTimeLimitsAttribute( + HoldTimeLimitsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HOLD_TIME_LIMITS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + ChipStructs.OccupancySensingClusterHoldTimeLimitsStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, HOLD_TIME_LIMITS_ATTRIBUTE_ID, true); + } + + public void subscribeHoldTimeLimitsAttribute( + HoldTimeLimitsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HOLD_TIME_LIMITS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + ChipStructs.OccupancySensingClusterHoldTimeLimitsStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, HOLD_TIME_LIMITS_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readPIROccupiedToUnoccupiedDelayAttribute( IntegerAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index f78eaf9c83cd10..35a08b3e35268d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -9748,6 +9748,82 @@ public String toString() { return output.toString(); } } +public static class OccupancySensingClusterHoldTimeLimitsStruct { + public Integer holdTimeMin; + public Integer holdTimeMax; + public Integer holdTimeDefault; + private static final long HOLD_TIME_MIN_ID = 0L; + private static final long HOLD_TIME_MAX_ID = 1L; + private static final long HOLD_TIME_DEFAULT_ID = 2L; + + public OccupancySensingClusterHoldTimeLimitsStruct( + Integer holdTimeMin, + Integer holdTimeMax, + Integer holdTimeDefault + ) { + this.holdTimeMin = holdTimeMin; + this.holdTimeMax = holdTimeMax; + this.holdTimeDefault = holdTimeDefault; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(HOLD_TIME_MIN_ID, new UIntType(holdTimeMin))); + values.add(new StructElement(HOLD_TIME_MAX_ID, new UIntType(holdTimeMax))); + values.add(new StructElement(HOLD_TIME_DEFAULT_ID, new UIntType(holdTimeDefault))); + + return new StructType(values); + } + + public static OccupancySensingClusterHoldTimeLimitsStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer holdTimeMin = null; + Integer holdTimeMax = null; + Integer holdTimeDefault = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == HOLD_TIME_MIN_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + holdTimeMin = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == HOLD_TIME_MAX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + holdTimeMax = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == HOLD_TIME_DEFAULT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + holdTimeDefault = castingValue.value(Integer.class); + } + } + } + return new OccupancySensingClusterHoldTimeLimitsStruct( + holdTimeMin, + holdTimeMax, + holdTimeDefault + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("OccupancySensingClusterHoldTimeLimitsStruct {\n"); + output.append("\tholdTimeMin: "); + output.append(holdTimeMin); + output.append("\n"); + output.append("\tholdTimeMax: "); + output.append(holdTimeMax); + output.append("\n"); + output.append("\tholdTimeDefault: "); + output.append(holdTimeDefault); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ThreadNetworkDirectoryClusterThreadNetworkStruct { public Long extendedPanID; public String networkName; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 7319aa479e37ce..eb51a558634fe4 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -13238,6 +13238,8 @@ public enum Attribute { Occupancy(0L), OccupancySensorType(1L), OccupancySensorTypeBitmap(2L), + HoldTime(3L), + HoldTimeLimits(4L), PIROccupiedToUnoccupiedDelay(16L), PIRUnoccupiedToOccupiedDelay(17L), PIRUnoccupiedToOccupiedThreshold(18L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 710ad85424cf80..00ccd333d9ff76 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -15583,6 +15583,27 @@ public void onError(Exception ex) { } } + public static class DelegatedOccupancySensingClusterHoldTimeLimitsAttributeCallback implements ChipClusters.OccupancySensingCluster.HoldTimeLimitsAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ChipStructs.OccupancySensingClusterHoldTimeLimitsStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.OccupancySensingClusterHoldTimeLimitsStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedOccupancySensingClusterGeneratedCommandListAttributeCallback implements ChipClusters.OccupancySensingCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 18cc03aa13a99f..cbf57969d6f96f 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -14576,6 +14576,17 @@ private static Map readOccupancySensingInteractionInfo( readOccupancySensingOccupancySensorTypeBitmapCommandParams ); result.put("readOccupancySensorTypeBitmapAttribute", readOccupancySensingOccupancySensorTypeBitmapAttributeInteractionInfo); + Map readOccupancySensingHoldTimeCommandParams = new LinkedHashMap(); + InteractionInfo readOccupancySensingHoldTimeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OccupancySensingCluster) cluster).readHoldTimeAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readOccupancySensingHoldTimeCommandParams + ); + result.put("readHoldTimeAttribute", readOccupancySensingHoldTimeAttributeInteractionInfo); Map readOccupancySensingPIROccupiedToUnoccupiedDelayCommandParams = new LinkedHashMap(); InteractionInfo readOccupancySensingPIROccupiedToUnoccupiedDelayAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index bd73d50f14c538..86d5b9b7763dbc 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -3419,6 +3419,28 @@ public Map> getWriteAttributeMap() { Map writeRelativeHumidityMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("relativeHumidityMeasurement", writeRelativeHumidityMeasurementInteractionInfo); Map writeOccupancySensingInteractionInfo = new LinkedHashMap<>(); + Map writeOccupancySensingHoldTimeCommandParams = new LinkedHashMap(); + CommandParameterInfo occupancySensingholdTimeCommandParameterInfo = + new CommandParameterInfo( + "value", + Integer.class, + Integer.class + ); + writeOccupancySensingHoldTimeCommandParams.put( + "value", + occupancySensingholdTimeCommandParameterInfo + ); + InteractionInfo writeOccupancySensingHoldTimeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.OccupancySensingCluster) cluster).writeHoldTimeAttribute( + (DefaultClusterCallback) callback, + (Integer) commandArguments.get("value") + ); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeOccupancySensingHoldTimeCommandParams + ); + writeOccupancySensingInteractionInfo.put("writeHoldTimeAttribute", writeOccupancySensingHoldTimeAttributeInteractionInfo); Map writeOccupancySensingPIROccupiedToUnoccupiedDelayCommandParams = new LinkedHashMap(); CommandParameterInfo occupancySensingPIROccupiedToUnoccupiedDelayCommandParameterInfo = new CommandParameterInfo( diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index c5c5d5e1adbb0d..4bcff980b6cbe6 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -92,6 +92,7 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterThreadInterfaceScanResultStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterWiFiInterfaceScanResultStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterNOCStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt new file mode 100644 index 00000000000000..d84009ea5fd25a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt @@ -0,0 +1,64 @@ +/* + * + * 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. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class OccupancySensingClusterHoldTimeLimitsStruct( + val holdTimeMin: UInt, + val holdTimeMax: UInt, + val holdTimeDefault: UInt, +) { + override fun toString(): String = buildString { + append("OccupancySensingClusterHoldTimeLimitsStruct {\n") + append("\tholdTimeMin : $holdTimeMin\n") + append("\tholdTimeMax : $holdTimeMax\n") + append("\tholdTimeDefault : $holdTimeDefault\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_HOLD_TIME_MIN), holdTimeMin) + put(ContextSpecificTag(TAG_HOLD_TIME_MAX), holdTimeMax) + put(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT), holdTimeDefault) + endStructure() + } + } + + companion object { + private const val TAG_HOLD_TIME_MIN = 0 + private const val TAG_HOLD_TIME_MAX = 1 + private const val TAG_HOLD_TIME_DEFAULT = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OccupancySensingClusterHoldTimeLimitsStruct { + tlvReader.enterStructure(tlvTag) + val holdTimeMin = tlvReader.getUInt(ContextSpecificTag(TAG_HOLD_TIME_MIN)) + val holdTimeMax = tlvReader.getUInt(ContextSpecificTag(TAG_HOLD_TIME_MAX)) + val holdTimeDefault = tlvReader.getUInt(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT)) + + tlvReader.exitContainer() + + return OccupancySensingClusterHoldTimeLimitsStruct(holdTimeMin, holdTimeMax, holdTimeDefault) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/OccupancySensingCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/OccupancySensingCluster.kt index 89979d73838f4b..bb54163f860ad0 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/OccupancySensingCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/OccupancySensingCluster.kt @@ -43,6 +43,17 @@ class OccupancySensingCluster( private val controller: MatterController, private val endpointId: UShort, ) { + class HoldTimeLimitsAttribute(val value: OccupancySensingClusterHoldTimeLimitsStruct?) + + sealed class HoldTimeLimitsAttributeSubscriptionState { + data class Success(val value: OccupancySensingClusterHoldTimeLimitsStruct?) : + HoldTimeLimitsAttributeSubscriptionState() + + data class Error(val exception: Exception) : HoldTimeLimitsAttributeSubscriptionState() + + object SubscriptionEstablished : HoldTimeLimitsAttributeSubscriptionState() + } + class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -330,6 +341,230 @@ class OccupancySensingCluster( } } + suspend fun readHoldTimeAttribute(): UShort? { + val ATTRIBUTE_ID: UInt = 3u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Holdtime attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + return decodedValue + } + + suspend fun writeHoldTimeAttribute(value: UShort, timedWriteTimeout: Duration? = null) { + val ATTRIBUTE_ID: UInt = 3u + + val tlvWriter = TlvWriter() + tlvWriter.put(AnonymousTag, value) + + val writeRequests: WriteRequests = + WriteRequests( + requests = + listOf( + WriteRequest( + attributePath = + AttributePath(endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID), + tlvPayload = tlvWriter.getEncoded(), + ) + ), + timedRequest = timedWriteTimeout, + ) + + val response: WriteResponse = controller.write(writeRequests) + + when (response) { + is WriteResponse.Success -> { + logger.log(Level.FINE, "Write command succeeded") + } + is WriteResponse.PartialWriteFailure -> { + val aggregatedErrorMessage = + response.failures.joinToString("\n") { failure -> + "Error at ${failure.attributePath}: ${failure.ex.message}" + } + + response.failures.forEach { failure -> + logger.log(Level.WARNING, "Error at ${failure.attributePath}: ${failure.ex.message}") + } + + throw IllegalStateException("Write command failed with errors: \n$aggregatedErrorMessage") + } + } + } + + suspend fun subscribeHoldTimeAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Holdtime attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort? = + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getUShort(AnonymousTag) + } else { + null + } + + decodedValue?.let { emit(UShortSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readHoldTimeLimitsAttribute(): HoldTimeLimitsAttribute { + val ATTRIBUTE_ID: UInt = 4u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Holdtimelimits attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: OccupancySensingClusterHoldTimeLimitsStruct? = + if (tlvReader.isNextTag(AnonymousTag)) { + OccupancySensingClusterHoldTimeLimitsStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } + + return HoldTimeLimitsAttribute(decodedValue) + } + + suspend fun subscribeHoldTimeLimitsAttribute( + minInterval: Int, + maxInterval: Int, + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()), + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + HoldTimeLimitsAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Holdtimelimits attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: OccupancySensingClusterHoldTimeLimitsStruct? = + if (tlvReader.isNextTag(AnonymousTag)) { + OccupancySensingClusterHoldTimeLimitsStruct.fromTlv(AnonymousTag, tlvReader) + } else { + null + } + + decodedValue?.let { emit(HoldTimeLimitsAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(HoldTimeLimitsAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readPIROccupiedToUnoccupiedDelayAttribute(): UShort? { val ATTRIBUTE_ID: UInt = 16u diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 4485a760e2b427..7c11cb00b0aceb 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -92,6 +92,7 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterThreadInterfaceScanResultStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterWiFiInterfaceScanResultStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalCredentialsClusterNOCStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterErrorStateStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt new file mode 100644 index 00000000000000..be70d3b11ccbb3 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OccupancySensingClusterHoldTimeLimitsStruct.kt @@ -0,0 +1,64 @@ +/* + * + * 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. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class OccupancySensingClusterHoldTimeLimitsStruct( + val holdTimeMin: UShort, + val holdTimeMax: UShort, + val holdTimeDefault: UShort, +) { + override fun toString(): String = buildString { + append("OccupancySensingClusterHoldTimeLimitsStruct {\n") + append("\tholdTimeMin : $holdTimeMin\n") + append("\tholdTimeMax : $holdTimeMax\n") + append("\tholdTimeDefault : $holdTimeDefault\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_HOLD_TIME_MIN), holdTimeMin) + put(ContextSpecificTag(TAG_HOLD_TIME_MAX), holdTimeMax) + put(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT), holdTimeDefault) + endStructure() + } + } + + companion object { + private const val TAG_HOLD_TIME_MIN = 0 + private const val TAG_HOLD_TIME_MAX = 1 + private const val TAG_HOLD_TIME_DEFAULT = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OccupancySensingClusterHoldTimeLimitsStruct { + tlvReader.enterStructure(tlvTag) + val holdTimeMin = tlvReader.getUShort(ContextSpecificTag(TAG_HOLD_TIME_MIN)) + val holdTimeMax = tlvReader.getUShort(ContextSpecificTag(TAG_HOLD_TIME_MAX)) + val holdTimeDefault = tlvReader.getUShort(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT)) + + tlvReader.exitContainer() + + return OccupancySensingClusterHoldTimeLimitsStruct(holdTimeMin, holdTimeMax, holdTimeDefault) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 4cebe9ea5a1829..66797f78118dd1 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -33993,6 +33993,77 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR value); return value; } + case Attributes::HoldTime::Id: { + using TypeInfo = Attributes::HoldTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + case Attributes::HoldTimeLimits::Id: { + using TypeInfo = Attributes::HoldTimeLimits::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + jobject value_holdTimeMin; + std::string value_holdTimeMinClassName = "java/lang/Integer"; + std::string value_holdTimeMinCtorSignature = "(I)V"; + jint jnivalue_holdTimeMin = static_cast(cppValue.holdTimeMin); + chip::JniReferences::GetInstance().CreateBoxedObject(value_holdTimeMinClassName.c_str(), + value_holdTimeMinCtorSignature.c_str(), jnivalue_holdTimeMin, + value_holdTimeMin); + jobject value_holdTimeMax; + std::string value_holdTimeMaxClassName = "java/lang/Integer"; + std::string value_holdTimeMaxCtorSignature = "(I)V"; + jint jnivalue_holdTimeMax = static_cast(cppValue.holdTimeMax); + chip::JniReferences::GetInstance().CreateBoxedObject(value_holdTimeMaxClassName.c_str(), + value_holdTimeMaxCtorSignature.c_str(), jnivalue_holdTimeMax, + value_holdTimeMax); + jobject value_holdTimeDefault; + std::string value_holdTimeDefaultClassName = "java/lang/Integer"; + std::string value_holdTimeDefaultCtorSignature = "(I)V"; + jint jnivalue_holdTimeDefault = static_cast(cppValue.holdTimeDefault); + chip::JniReferences::GetInstance().CreateBoxedObject(value_holdTimeDefaultClassName.c_str(), + value_holdTimeDefaultCtorSignature.c_str(), + jnivalue_holdTimeDefault, value_holdTimeDefault); + + jclass holdTimeLimitsStructStructClass_0; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$OccupancySensingClusterHoldTimeLimitsStruct", + holdTimeLimitsStructStructClass_0); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$OccupancySensingClusterHoldTimeLimitsStruct"); + return nullptr; + } + + jmethodID holdTimeLimitsStructStructCtor_0; + err = chip::JniReferences::GetInstance().FindMethod(env, holdTimeLimitsStructStructClass_0, "", + "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", + &holdTimeLimitsStructStructCtor_0); + if (err != CHIP_NO_ERROR || holdTimeLimitsStructStructCtor_0 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$OccupancySensingClusterHoldTimeLimitsStruct constructor"); + return nullptr; + } + + value = env->NewObject(holdTimeLimitsStructStructClass_0, holdTimeLimitsStructStructCtor_0, value_holdTimeMin, + value_holdTimeMax, value_holdTimeDefault); + return value; + } case Attributes::PIROccupiedToUnoccupiedDelay::Id: { using TypeInfo = Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index a163d37de675c9..db05bf7319200b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -10428,6 +10428,19 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x00000003: { + "attributeName": "HoldTime", + "attributeId": 0x00000003, + "type": "int", + "reportable": True, + "writable": True, + }, + 0x00000004: { + "attributeName": "HoldTimeLimits", + "attributeId": 0x00000004, + "type": "", + "reportable": True, + }, 0x00000010: { "attributeName": "PIROccupiedToUnoccupiedDelay", "attributeId": 0x00000010, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index a81dced46c589c..9a6c6a55a7f420 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -36884,6 +36884,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="occupancy", Tag=0x00000000, Type=uint), ClusterObjectFieldDescriptor(Label="occupancySensorType", Tag=0x00000001, Type=OccupancySensing.Enums.OccupancySensorTypeEnum), ClusterObjectFieldDescriptor(Label="occupancySensorTypeBitmap", Tag=0x00000002, Type=uint), + ClusterObjectFieldDescriptor(Label="holdTime", Tag=0x00000003, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="holdTimeLimits", Tag=0x00000004, Type=typing.Optional[OccupancySensing.Structs.HoldTimeLimitsStruct]), ClusterObjectFieldDescriptor(Label="PIROccupiedToUnoccupiedDelay", Tag=0x00000010, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="PIRUnoccupiedToOccupiedDelay", Tag=0x00000011, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="PIRUnoccupiedToOccupiedThreshold", Tag=0x00000012, Type=typing.Optional[uint]), @@ -36904,6 +36906,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: occupancy: 'uint' = None occupancySensorType: 'OccupancySensing.Enums.OccupancySensorTypeEnum' = None occupancySensorTypeBitmap: 'uint' = None + holdTime: 'typing.Optional[uint]' = None + holdTimeLimits: 'typing.Optional[OccupancySensing.Structs.HoldTimeLimitsStruct]' = None PIROccupiedToUnoccupiedDelay: 'typing.Optional[uint]' = None PIRUnoccupiedToOccupiedDelay: 'typing.Optional[uint]' = None PIRUnoccupiedToOccupiedThreshold: 'typing.Optional[uint]' = None @@ -36933,6 +36937,16 @@ class OccupancySensorTypeEnum(MatterIntEnum): kUnknownEnumValue = 4, class Bitmaps: + class Feature(IntFlag): + kOther = 0x1 + kPassiveInfrared = 0x2 + kUltrasonic = 0x4 + kPhysicalContact = 0x8 + kActiveInfrared = 0x10 + kRadar = 0x20 + kRFSensing = 0x40 + kVision = 0x80 + class OccupancyBitmap(IntFlag): kOccupied = 0x1 @@ -36941,6 +36955,22 @@ class OccupancySensorTypeBitmap(IntFlag): kUltrasonic = 0x2 kPhysicalContact = 0x4 + class Structs: + @dataclass + class HoldTimeLimitsStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="holdTimeMin", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="holdTimeMax", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="holdTimeDefault", Tag=2, Type=uint), + ]) + + holdTimeMin: 'uint' = 0 + holdTimeMax: 'uint' = 0 + holdTimeDefault: 'uint' = 0 + class Attributes: @dataclass class Occupancy(ClusterAttributeDescriptor): @@ -36990,6 +37020,38 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 + @dataclass + class HoldTime(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000406 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + + @dataclass + class HoldTimeLimits(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000406 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[OccupancySensing.Structs.HoldTimeLimitsStruct]) + + value: 'typing.Optional[OccupancySensing.Structs.HoldTimeLimitsStruct]' = None + @dataclass class PIROccupiedToUnoccupiedDelay(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 4200cb1dccd108..7785a04b904fa8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -4683,6 +4683,12 @@ static BOOL AttributeIsSpecifiedInOccupancySensingCluster(AttributeId aAttribute case Attributes::OccupancySensorTypeBitmap::Id: { return YES; } + case Attributes::HoldTime::Id: { + return YES; + } + case Attributes::HoldTimeLimits::Id: { + return YES; + } case Attributes::PIROccupiedToUnoccupiedDelay::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 1feae62ea18928..d3780c91cf9eb4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -13817,6 +13817,31 @@ static id _Nullable DecodeAttributeValueForOccupancySensingCluster(AttributeId a value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; return value; } + case Attributes::HoldTime::Id: { + using TypeInfo = Attributes::HoldTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::HoldTimeLimits::Id: { + using TypeInfo = Attributes::HoldTimeLimits::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTROccupancySensingClusterHoldTimeLimitsStruct * _Nonnull value; + value = [MTROccupancySensingClusterHoldTimeLimitsStruct new]; + value.holdTimeMin = [NSNumber numberWithUnsignedShort:cppValue.holdTimeMin]; + value.holdTimeMax = [NSNumber numberWithUnsignedShort:cppValue.holdTimeMax]; + value.holdTimeDefault = [NSNumber numberWithUnsignedShort:cppValue.holdTimeDefault]; + return value; + } case Attributes::PIROccupiedToUnoccupiedDelay::Id: { using TypeInfo = Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index a00ea9aed79605..979c1b92605c15 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -11706,6 +11706,20 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); + (void)readAttributeOccupancySensorTypeBitmapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); +- (void)readAttributeHoldTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeHoldTimeWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeHoldTimeWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeHoldTimeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeHoldTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeHoldTimeLimitsWithCompletion:(void (^)(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeHoldTimeLimitsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeHoldTimeLimitsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + - (void)readAttributePIROccupiedToUnoccupiedDelayWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributePIROccupiedToUnoccupiedDelayWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributePIROccupiedToUnoccupiedDelayWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); @@ -19783,6 +19797,17 @@ typedef NS_ENUM(uint8_t, MTROccupancySensingOccupancySensorType) { MTROccupancySensingOccupancySensorTypePhysicalContact MTR_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)) = 0x03, } MTR_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); +typedef NS_OPTIONS(uint32_t, MTROccupancySensingFeature) { + MTROccupancySensingFeatureOther MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTROccupancySensingFeaturePassiveInfrared MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTROccupancySensingFeatureUltrasonic MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTROccupancySensingFeaturePhysicalContact MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTROccupancySensingFeatureActiveInfrared MTR_PROVISIONALLY_AVAILABLE = 0x10, + MTROccupancySensingFeatureRadar MTR_PROVISIONALLY_AVAILABLE = 0x20, + MTROccupancySensingFeatureRFSensing MTR_PROVISIONALLY_AVAILABLE = 0x40, + MTROccupancySensingFeatureVision MTR_PROVISIONALLY_AVAILABLE = 0x80, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_OPTIONS(uint8_t, MTROccupancySensingOccupancyBitmap) { MTROccupancySensingOccupancyBitmapOccupied MTR_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)) = 0x1, } MTR_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 2103baa5ab86db..87398bcf63b53e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -85751,6 +85751,106 @@ + (void)readAttributeOccupancySensorTypeBitmapWithClusterStateCache:(MTRClusterS completion:completion]; } +- (void)readAttributeHoldTimeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = OccupancySensing::Attributes::HoldTime::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)writeAttributeHoldTimeWithValue:(NSNumber * _Nonnull)value completion:(MTRStatusCompletion)completion +{ + [self writeAttributeHoldTimeWithValue:(NSNumber * _Nonnull) value params:nil completion:completion]; +} +- (void)writeAttributeHoldTimeWithValue:(NSNumber * _Nonnull)value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion +{ + // Make a copy of params before we go async. + params = [params copy]; + value = [value copy]; + + auto * bridge = new MTRDefaultSuccessCallbackBridge(self.callbackQueue, ^(id _Nullable ignored, NSError * _Nullable error) { completion(error); }, ^(ExchangeManager & exchangeManager, const SessionHandle & session, DefaultSuccessCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { + chip::Optional timedWriteTimeout; + if (params != nil) { + if (params.timedWriteTimeout != nil){ + timedWriteTimeout.SetValue(params.timedWriteTimeout.unsignedShortValue); + } + } + + ListFreer listFreer; + using TypeInfo = OccupancySensing::Attributes::HoldTime::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedShortValue; + + chip::Controller::ClusterBase cppCluster(exchangeManager, session, self.endpointID.unsignedShortValue); + return cppCluster.WriteAttribute(cppValue, bridge, successCb, failureCb, timedWriteTimeout); }); + std::move(*bridge).DispatchAction(self.device); +} + +- (void)subscribeAttributeHoldTimeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = OccupancySensing::Attributes::HoldTime::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeHoldTimeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = OccupancySensing::Attributes::HoldTime::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeHoldTimeLimitsWithCompletion:(void (^)(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = OccupancySensing::Attributes::HoldTimeLimits::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeHoldTimeLimitsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = OccupancySensing::Attributes::HoldTimeLimits::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeHoldTimeLimitsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = OccupancySensing::Attributes::HoldTimeLimits::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + - (void)readAttributePIROccupiedToUnoccupiedDelayWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion { using TypeInfo = OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 9d8914a5505742..2b9d4fbba701d5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -4173,6 +4173,8 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancyID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000000, MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancySensorTypeID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000001, MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancySensorTypeBitmapID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000002, + MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeLimitsID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, MTRAttributeIDTypeClusterOccupancySensingAttributePIROccupiedToUnoccupiedDelayID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000010, MTRAttributeIDTypeClusterOccupancySensingAttributePIRUnoccupiedToOccupiedDelayID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000011, MTRAttributeIDTypeClusterOccupancySensingAttributePIRUnoccupiedToOccupiedThresholdID MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000012, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm index c320e8c06e8dea..48b47328a79ebb 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterNames.mm @@ -6437,6 +6437,14 @@ result = @"OccupancySensorTypeBitmap"; break; + case MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeID: + result = @"HoldTime"; + break; + + case MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeLimitsID: + result = @"HoldTimeLimits"; + break; + case MTRAttributeIDTypeClusterOccupancySensingAttributePIROccupiedToUnoccupiedDelayID: result = @"PIROccupiedToUnoccupiedDelay"; break; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 114205ae5df9e0..39024834ce0b37 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -5401,6 +5401,12 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - (NSDictionary * _Nullable)readAttributeOccupancySensorTypeBitmapWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)); +- (NSDictionary * _Nullable)readAttributeHoldTimeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeHoldTimeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_PROVISIONALLY_AVAILABLE; +- (void)writeAttributeHoldTimeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeHoldTimeLimitsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributePIROccupiedToUnoccupiedDelayWithParams:(MTRReadParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributePIROccupiedToUnoccupiedDelayWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); - (void)writeAttributePIROccupiedToUnoccupiedDelayWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)); diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 823821d7e238ad..50a659cc520bb1 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -15779,6 +15779,27 @@ @implementation MTRClusterOccupancySensing return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeOccupancySensingID) attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancySensorTypeBitmapID) params:params]; } +- (NSDictionary * _Nullable)readAttributeHoldTimeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeOccupancySensingID) attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeID) params:params]; +} + +- (void)writeAttributeHoldTimeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs +{ + [self writeAttributeHoldTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; +} +- (void)writeAttributeHoldTimeWithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params +{ + NSNumber * timedWriteTimeout = params.timedWriteTimeout; + + [self.device writeAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeOccupancySensingID) attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; +} + +- (NSDictionary * _Nullable)readAttributeHoldTimeLimitsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeOccupancySensingID) attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeHoldTimeLimitsID) params:params]; +} + - (NSDictionary * _Nullable)readAttributePIROccupiedToUnoccupiedDelayWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeOccupancySensingID) attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePIROccupiedToUnoccupiedDelayID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 8ea03ce1fd2a9d..74a621dd01df9c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1680,6 +1680,13 @@ MTR_DEPRECATED("Please use MTRThermostatClusterWeeklyScheduleTransitionStruct", @property (nonatomic, copy) NSNumber * _Nullable coolSetpoint MTR_DEPRECATED("Please use MTRThermostatClusterWeeklyScheduleTransitionStruct", ios(16.1, 17.4), macos(13.0, 14.4), watchos(9.1, 10.4), tvos(16.1, 17.4)); @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTROccupancySensingClusterHoldTimeLimitsStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull holdTimeMin MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull holdTimeMax MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull holdTimeDefault MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRThreadNetworkDirectoryClusterThreadNetworkStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull extendedPanID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 1ff604e5469e36..5dca49be4900cf 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -7085,6 +7085,39 @@ @implementation MTRThermostatClusterThermostatScheduleTransition : MTRThermostat @dynamic coolSetpoint; @end +@implementation MTROccupancySensingClusterHoldTimeLimitsStruct +- (instancetype)init +{ + if (self = [super init]) { + + _holdTimeMin = @(0); + + _holdTimeMax = @(0); + + _holdTimeDefault = @(0); + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTROccupancySensingClusterHoldTimeLimitsStruct alloc] init]; + + other.holdTimeMin = self.holdTimeMin; + other.holdTimeMax = self.holdTimeMax; + other.holdTimeDefault = self.holdTimeDefault; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: holdTimeMin:%@; holdTimeMax:%@; holdTimeDefault:%@; >", NSStringFromClass([self class]), _holdTimeMin, _holdTimeMax, _holdTimeDefault]; + return descriptionString; +} + +@end + @implementation MTRThreadNetworkDirectoryClusterThreadNetworkStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index c16c4d688e2744..e349271c1d9ed5 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -33800,6 +33800,52 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, } // namespace OccupancySensorTypeBitmap +namespace HoldTime { + +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + Protocols::InteractionModel::Status status = + emberAfReadAttribute(endpoint, Clusters::OccupancySensing::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(Protocols::InteractionModel::Status::Success == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + *value = Traits::StorageToWorking(temp); + return status; +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::OccupancySensing::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE, markDirty); +} + +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return Protocols::InteractionModel::Status::ConstraintError; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::OccupancySensing::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace HoldTime + namespace PIROccupiedToUnoccupiedDelay { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 4d0c6c1d97ad9a..acf4ff18b97443 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -5167,6 +5167,12 @@ Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, MarkAttributeDirty markDirty); } // namespace OccupancySensorTypeBitmap +namespace HoldTime { +Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); +Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value, MarkAttributeDirty markDirty); +} // namespace HoldTime + namespace PIROccupiedToUnoccupiedDelay { Protocols::InteractionModel::Status Get(chip::EndpointId endpoint, uint16_t * value); // int16u Protocols::InteractionModel::Status Set(chip::EndpointId endpoint, uint16_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index a7c433848df662..52e953741808d1 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -4396,6 +4396,19 @@ enum class OccupancySensorTypeEnum : uint8_t kUnknownEnumValue = 4, }; +// Bitmap for Feature +enum class Feature : uint32_t +{ + kOther = 0x1, + kPassiveInfrared = 0x2, + kUltrasonic = 0x4, + kPhysicalContact = 0x8, + kActiveInfrared = 0x10, + kRadar = 0x20, + kRFSensing = 0x40, + kVision = 0x80, +}; + // Bitmap for OccupancyBitmap enum class OccupancyBitmap : uint8_t { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 98acaaca61920c..42a36d6da15918 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -22758,6 +22758,54 @@ namespace Events {} // namespace Events } // namespace RelativeHumidityMeasurement namespace OccupancySensing { +namespace Structs { + +namespace HoldTimeLimitsStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kHoldTimeMin), holdTimeMin); + encoder.Encode(to_underlying(Fields::kHoldTimeMax), holdTimeMax); + encoder.Encode(to_underlying(Fields::kHoldTimeDefault), holdTimeDefault); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kHoldTimeMin)) + { + err = DataModel::Decode(reader, holdTimeMin); + } + else if (__context_tag == to_underlying(Fields::kHoldTimeMax)) + { + err = DataModel::Decode(reader, holdTimeMax); + } + else if (__context_tag == to_underlying(Fields::kHoldTimeDefault)) + { + err = DataModel::Decode(reader, holdTimeDefault); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace HoldTimeLimitsStruct +} // namespace Structs namespace Commands {} // namespace Commands @@ -22772,6 +22820,10 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, occupancySensorType); case Attributes::OccupancySensorTypeBitmap::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, occupancySensorTypeBitmap); + case Attributes::HoldTime::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, holdTime); + case Attributes::HoldTimeLimits::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, holdTimeLimits); case Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, PIROccupiedToUnoccupiedDelay); case Attributes::PIRUnoccupiedToOccupiedDelay::TypeInfo::GetAttributeId(): diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 4d9b6f5639602e..a1fb80c760815c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -33039,6 +33039,33 @@ struct TypeInfo } // namespace Attributes } // namespace RelativeHumidityMeasurement namespace OccupancySensing { +namespace Structs { +namespace HoldTimeLimitsStruct { +enum class Fields : uint8_t +{ + kHoldTimeMin = 0, + kHoldTimeMax = 1, + kHoldTimeDefault = 2, +}; + +struct Type +{ +public: + uint16_t holdTimeMin = static_cast(0); + uint16_t holdTimeMax = static_cast(0); + uint16_t holdTimeDefault = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace HoldTimeLimitsStruct +} // namespace Structs namespace Attributes { @@ -33078,6 +33105,30 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace OccupancySensorTypeBitmap +namespace HoldTime { +struct TypeInfo +{ + using Type = uint16_t; + using DecodableType = uint16_t; + using DecodableArgType = uint16_t; + + static constexpr ClusterId GetClusterId() { return Clusters::OccupancySensing::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::HoldTime::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace HoldTime +namespace HoldTimeLimits { +struct TypeInfo +{ + using Type = chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type; + using DecodableType = chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::DecodableType; + using DecodableArgType = const chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::DecodableType &; + + static constexpr ClusterId GetClusterId() { return Clusters::OccupancySensing::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::HoldTimeLimits::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace HoldTimeLimits namespace PIROccupiedToUnoccupiedDelay { struct TypeInfo { @@ -33237,6 +33288,8 @@ struct TypeInfo static_cast(0); Attributes::OccupancySensorTypeBitmap::TypeInfo::DecodableType occupancySensorTypeBitmap = static_cast>(0); + Attributes::HoldTime::TypeInfo::DecodableType holdTime = static_cast(0); + Attributes::HoldTimeLimits::TypeInfo::DecodableType holdTimeLimits; Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo::DecodableType PIROccupiedToUnoccupiedDelay = static_cast(0); Attributes::PIRUnoccupiedToOccupiedDelay::TypeInfo::DecodableType PIRUnoccupiedToOccupiedDelay = static_cast(0); Attributes::PIRUnoccupiedToOccupiedThreshold::TypeInfo::DecodableType PIRUnoccupiedToOccupiedThreshold = diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 03ddaed214890c..7bfad24bf56998 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -5834,6 +5834,14 @@ namespace OccupancySensorTypeBitmap { static constexpr AttributeId Id = 0x00000002; } // namespace OccupancySensorTypeBitmap +namespace HoldTime { +static constexpr AttributeId Id = 0x00000003; +} // namespace HoldTime + +namespace HoldTimeLimits { +static constexpr AttributeId Id = 0x00000004; +} // namespace HoldTimeLimits + namespace PIROccupiedToUnoccupiedDelay { static constexpr AttributeId Id = 0x00000010; } // namespace PIROccupiedToUnoccupiedDelay diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 479be90b55fd42..a7bae21539e5b8 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -10833,6 +10833,8 @@ class ColorControlStepColorTemperature : public ClusterCommand | * Occupancy | 0x0000 | | * OccupancySensorType | 0x0001 | | * OccupancySensorTypeBitmap | 0x0002 | +| * HoldTime | 0x0003 | +| * HoldTimeLimits | 0x0004 | | * PIROccupiedToUnoccupiedDelay | 0x0010 | | * PIRUnoccupiedToOccupiedDelay | 0x0011 | | * PIRUnoccupiedToOccupiedThreshold | 0x0012 | @@ -23914,7 +23916,9 @@ void registerClusterOccupancySensing(Commands & commands, CredentialIssuerComman make_unique(Id, "occupancy", Attributes::Occupancy::Id, credsIssuerConfig), // make_unique(Id, "occupancy-sensor-type", Attributes::OccupancySensorType::Id, credsIssuerConfig), // make_unique(Id, "occupancy-sensor-type-bitmap", Attributes::OccupancySensorTypeBitmap::Id, - credsIssuerConfig), // + credsIssuerConfig), // + make_unique(Id, "hold-time", Attributes::HoldTime::Id, credsIssuerConfig), // + make_unique(Id, "hold-time-limits", Attributes::HoldTimeLimits::Id, credsIssuerConfig), // make_unique(Id, "piroccupied-to-unoccupied-delay", Attributes::PIROccupiedToUnoccupiedDelay::Id, credsIssuerConfig), // make_unique(Id, "pirunoccupied-to-occupied-delay", Attributes::PIRUnoccupiedToOccupiedDelay::Id, @@ -23948,6 +23952,10 @@ void registerClusterOccupancySensing(Commands & commands, CredentialIssuerComman make_unique>>( Id, "occupancy-sensor-type-bitmap", 0, UINT8_MAX, Attributes::OccupancySensorTypeBitmap::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "hold-time", 0, UINT16_MAX, Attributes::HoldTime::Id, WriteCommandType::kWrite, + credsIssuerConfig), // + make_unique>( + Id, "hold-time-limits", Attributes::HoldTimeLimits::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "piroccupied-to-unoccupied-delay", 0, UINT16_MAX, Attributes::PIROccupiedToUnoccupiedDelay::Id, WriteCommandType::kWrite, credsIssuerConfig), // @@ -23992,7 +24000,9 @@ void registerClusterOccupancySensing(Commands & commands, CredentialIssuerComman make_unique(Id, "occupancy", Attributes::Occupancy::Id, credsIssuerConfig), // make_unique(Id, "occupancy-sensor-type", Attributes::OccupancySensorType::Id, credsIssuerConfig), // make_unique(Id, "occupancy-sensor-type-bitmap", Attributes::OccupancySensorTypeBitmap::Id, - credsIssuerConfig), // + credsIssuerConfig), // + make_unique(Id, "hold-time", Attributes::HoldTime::Id, credsIssuerConfig), // + make_unique(Id, "hold-time-limits", Attributes::HoldTimeLimits::Id, credsIssuerConfig), // make_unique(Id, "piroccupied-to-unoccupied-delay", Attributes::PIROccupiedToUnoccupiedDelay::Id, credsIssuerConfig), // make_unique(Id, "pirunoccupied-to-occupied-delay", Attributes::PIRUnoccupiedToOccupiedDelay::Id, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 6a73b61ce13720..c094853ab71712 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -4229,6 +4229,45 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::Thermostat::Structs::W ComplexArgumentParser::Finalize(request.coolSetpoint); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("HoldTimeLimitsStruct.holdTimeMin", "holdTimeMin", value.isMember("holdTimeMin"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("HoldTimeLimitsStruct.holdTimeMax", "holdTimeMax", value.isMember("holdTimeMax"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("HoldTimeLimitsStruct.holdTimeDefault", "holdTimeDefault", + value.isMember("holdTimeDefault"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "holdTimeMin"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.holdTimeMin, value["holdTimeMin"])); + valueCopy.removeMember("holdTimeMin"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "holdTimeMax"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.holdTimeMax, value["holdTimeMax"])); + valueCopy.removeMember("holdTimeMax"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "holdTimeDefault"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.holdTimeDefault, value["holdTimeDefault"])); + valueCopy.removeMember("holdTimeDefault"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.holdTimeMin); + ComplexArgumentParser::Finalize(request.holdTimeMax); + ComplexArgumentParser::Finalize(request.holdTimeDefault); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request, Json::Value & value) diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 4d7544b92daa32..f2893064ebafe0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -486,6 +486,11 @@ static CHIP_ERROR Setup(const char * label, static void Finalize(chip::app::Clusters::Thermostat::Structs::WeeklyScheduleTransitionStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index b7bcdcb7e8e7ba..d61ba121300baa 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -3735,6 +3735,40 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("HoldTimeMin", indent + 1, value.holdTimeMin); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HoldTimeMin'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("HoldTimeMax", indent + 1, value.holdTimeMax); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HoldTimeMax'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("HoldTimeDefault", indent + 1, value.holdTimeDefault); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'HoldTimeDefault'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType & value) @@ -15478,6 +15512,16 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("OccupancySensorTypeBitmap", 1, value); } + case OccupancySensing::Attributes::HoldTime::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("HoldTime", 1, value); + } + case OccupancySensing::Attributes::HoldTimeLimits::Id: { + chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("HoldTimeLimits", 1, value); + } case OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id: { uint16_t value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 44801e57ca16df..f0474e39422622 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -303,6 +303,9 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::Thermostat::Structs::WeeklyScheduleTransitionStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ThreadNetworkDirectory::Structs::ThreadNetworkStruct::DecodableType & value); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index c1b6c5781d0256..b91d8584fa83be 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -128108,6 +128108,8 @@ class SubscribeAttributeRelativeHumidityMeasurementClusterRevision : public Subs | * Occupancy | 0x0000 | | * OccupancySensorType | 0x0001 | | * OccupancySensorTypeBitmap | 0x0002 | +| * HoldTime | 0x0003 | +| * HoldTimeLimits | 0x0004 | | * PIROccupiedToUnoccupiedDelay | 0x0010 | | * PIRUnoccupiedToOccupiedDelay | 0x0011 | | * PIRUnoccupiedToOccupiedThreshold | 0x0012 | @@ -128373,6 +128375,218 @@ class SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap : public Subsc } }; +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute HoldTime + */ +class ReadOccupancySensingHoldTime : public ReadAttribute { +public: + ReadOccupancySensingHoldTime() + : ReadAttribute("hold-time") + { + } + + ~ReadOccupancySensingHoldTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeHoldTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"OccupancySensing.HoldTime response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("OccupancySensing HoldTime read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class WriteOccupancySensingHoldTime : public WriteAttribute { +public: + WriteOccupancySensingHoldTime() + : WriteAttribute("hold-time") + { + AddArgument("attr-name", "hold-time"); + AddArgument("attr-value", 0, UINT16_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteOccupancySensingHoldTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; + params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; + params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; + NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; + + [cluster writeAttributeHoldTimeWithValue:value params:params completion:^(NSError * _Nullable error) { + if (error != nil) { + LogNSError("OccupancySensing HoldTime write Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } + +private: + uint16_t mValue; +}; + +class SubscribeAttributeOccupancySensingHoldTime : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingHoldTime() + : SubscribeAttribute("hold-time") + { + } + + ~SubscribeAttributeOccupancySensingHoldTime() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHoldTimeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"OccupancySensing.HoldTime response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute HoldTimeLimits + */ +class ReadOccupancySensingHoldTimeLimits : public ReadAttribute { +public: + ReadOccupancySensingHoldTimeLimits() + : ReadAttribute("hold-time-limits") + { + } + + ~ReadOccupancySensingHoldTimeLimits() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTimeLimits::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeHoldTimeLimitsWithCompletion:^(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"OccupancySensing.HoldTimeLimits response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("OccupancySensing HoldTimeLimits read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeOccupancySensingHoldTimeLimits : public SubscribeAttribute { +public: + SubscribeAttributeOccupancySensingHoldTimeLimits() + : SubscribeAttribute("hold-time-limits") + { + } + + ~SubscribeAttributeOccupancySensingHoldTimeLimits() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTimeLimits::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeHoldTimeLimitsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"OccupancySensing.HoldTimeLimits response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL + /* * Attribute PIROccupiedToUnoccupiedDelay */ @@ -191504,6 +191718,15 @@ void registerClusterOccupancySensing(Commands & commands) make_unique(), // make_unique(), // make_unique(), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // From 4ef104b1019c05469483c7391d549a0407302846 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 2 Jul 2024 20:04:43 -0400 Subject: [PATCH 03/15] Add reviewers-nxp as company-reviewers in the SDK (#34157) Co-authored-by: Andrei Litvin --- .pullapprove.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pullapprove.yml b/.pullapprove.yml index 98dee34c049229..5be3f21a28a327 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -173,6 +173,14 @@ groups: teams: [reviewers-nordic] reviews: request: 10 + shared-reviewers-nxp: + type: optional + conditions: + - files.include('*') + reviewers: + teams: [reviewers-nxp] + reviews: + request: 10 shared-reviewers-samsung: type: optional conditions: From 856f7931e64eaf6e4a67334d24c7504701e50df4 Mon Sep 17 00:00:00 2001 From: ying-css <71699179+ying-css@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:35:26 +0800 Subject: [PATCH 04/15] Fixed the issues for p_local_crypt not being cleared properly for Infineon HSM OPTIGA Trust M (#34152) * Fixes the issues for p_local_crypt not being cleared. * 1)Bug fixing for ECDSA Verify Functions 2)Deleted redundant check * Apply restyled changes. --------- Co-authored-by: Ank Khandelwal Co-authored-by: Ank Khandelwal <108660995+ankk-css@users.noreply.github.com> --- .../trustm/CHIPCryptoPALHsm_P256_trustm.cpp | 9 +++-- .../trustm/CHIPCryptoPALHsm_utils_trustm.cpp | 38 ++++++++++--------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp index afa988d3ce8cb7..895b53222672b4 100644 --- a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp +++ b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_P256_trustm.cpp @@ -252,15 +252,16 @@ CHIP_ERROR P256Keypair::ECDH_derive_secret(const P256PublicKey & remote_public_k return_status = trustm_ecdh_derive_secret(OPTIGA_KEY_ID_E100, (uint8_t *) remote_key, (uint16_t) rem_pubKeyLen + 3, out_secret.Bytes(), (uint8_t) secret_length); - VerifyOrExit(return_status == OPTIGA_LIB_SUCCESS, error = CHIP_ERROR_INTERNAL); + out_secret.SetLength(secret_length); + error = CHIP_NO_ERROR; exit: if (error != CHIP_NO_ERROR) { trustm_close(); } - return out_secret.SetLength(secret_length); + return error; #endif } @@ -295,7 +296,7 @@ CHIP_ERROR P256PublicKey::ECDSA_validate_hash_signature(const uint8_t * hash, si (uint8_t *) bytes, (uint8_t) kP256_PublicKey_Length); VerifyOrExit(return_status == OPTIGA_LIB_SUCCESS, error = CHIP_ERROR_INTERNAL); - + error = CHIP_NO_ERROR; exit: if (error != CHIP_NO_ERROR) { @@ -407,7 +408,7 @@ CHIP_ERROR P256PublicKey::ECDSA_validate_msg_signature(const uint8_t * msg, size (uint8_t *) bytes, (uint8_t) kP256_PublicKey_Length); VerifyOrExit(return_status == OPTIGA_LIB_SUCCESS, error = CHIP_ERROR_INTERNAL); - + error = CHIP_NO_ERROR; exit: if (error != CHIP_NO_ERROR) { diff --git a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp index fa0ee0b2cc389b..be25fd89b824d6 100644 --- a/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp +++ b/src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_utils_trustm.cpp @@ -426,8 +426,9 @@ optiga_lib_status_t deriveKey_HKDF(const uint8_t * salt, uint16_t salt_length, c break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; + if (OPTIGA_LIB_SUCCESS != optiga_lib_status) { // optiga_crypt_hkdf failed @@ -539,8 +540,9 @@ optiga_lib_status_t hmac_sha256(optiga_hmac_type_t type, const uint8_t * input_d break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; + if (OPTIGA_LIB_SUCCESS != optiga_lib_status) { // optiga_crypt_hkdf failed @@ -578,8 +580,9 @@ optiga_lib_status_t optiga_crypt_rng(uint8_t * random_data, uint16_t random_data break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; + if (OPTIGA_LIB_SUCCESS != optiga_lib_status) { // optiga_crypt_random failed @@ -626,7 +629,7 @@ optiga_lib_status_t trustm_ecc_keygen(uint16_t optiga_key_id, uint8_t key_type, break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; } while (0); @@ -696,8 +699,10 @@ optiga_lib_status_t trustm_hash(uint8_t * msg, uint16_t msg_length, uint8_t * di optiga_lib_print_message("optiga_crypt_hash api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; + } while (0); if (p_local_crypt) @@ -729,7 +734,8 @@ optiga_lib_status_t trustm_ecdsa_sign(optiga_key_id_t optiga_key_id, uint8_t * d OPTIGA_UTIL_SERVICE_COLOR); break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; for (i = (*signature_length - 1); i >= 0; i--) @@ -803,8 +809,10 @@ optiga_lib_status_t trustm_ecdsa_verify(uint8_t * digest, uint8_t digest_length, OPTIGA_UTIL_SERVICE_COLOR); break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; + } while (0); if (p_local_crypt) @@ -852,14 +860,6 @@ CHIP_ERROR trustmGetCertificate(uint16_t optiga_oid, uint8_t * buf, uint16_t * b memcpy(buf, ifx_cert_hex, ifx_cert_hex_len); *buflen = ifx_cert_hex_len; - while (optiga_lib_status == OPTIGA_LIB_BUSY) - ; - if (OPTIGA_LIB_SUCCESS != optiga_lib_status) - { - // optiga_util_read_data failed - optiga_lib_print_message("optiga_util_read_data failed", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); - break; - } } while (0); if (p_local_util) @@ -896,8 +896,10 @@ optiga_lib_status_t trustm_ecdh_derive_secret(optiga_key_id_t optiga_key_id, uin optiga_lib_print_message("optiga_crypt_ecdh api returns error !!!", OPTIGA_UTIL_SERVICE, OPTIGA_UTIL_SERVICE_COLOR); break; } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; + } while (0); if (p_local_crypt) @@ -957,7 +959,7 @@ optiga_lib_status_t trustm_PBKDF2_HMAC(const unsigned char * salt, size_t slen, } } - while (optiga_lib_status == OPTIGA_LIB_BUSY) + while (p_local_crypt->instance_state != OPTIGA_LIB_INSTANCE_FREE) ; if (OPTIGA_LIB_SUCCESS != optiga_lib_status) @@ -978,4 +980,4 @@ optiga_lib_status_t trustm_PBKDF2_HMAC(const unsigned char * salt, size_t slen, optiga_crypt_destroy(p_local_crypt); } return return_status; -} \ No newline at end of file +} From d31cb546b761fffd9486a4c71d28efe67da8eb8d Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 3 Jul 2024 05:54:59 -0700 Subject: [PATCH 05/15] [Fabric-Sync] Add RPC method RemoveSynchronizedDevice (#34121) * Add RPC method RemoveSynchronizedDevice * Update examples/fabric-admin/rpc/RpcClient.cpp Co-authored-by: Andrei Litvin * Update examples/fabric-bridge-app/linux/RpcServer.cpp Co-authored-by: Andrei Litvin * Update comments for RemoveSynchronizedDevice --------- Co-authored-by: Andrei Litvin --- .../workflows/examples-linux-standalone.yaml | 8 ++-- .../protos/fabric_bridge_service.proto | 1 + .../pigweed/rpc_services/FabricBridge.h | 5 ++ examples/fabric-admin/BUILD.gn | 6 ++- examples/fabric-admin/args.gni | 1 + examples/fabric-admin/rpc/RpcClient.cpp | 46 ++++++++++++++++++- examples/fabric-admin/rpc/RpcClient.h | 15 ++++++ examples/fabric-bridge-app/linux/BUILD.gn | 6 ++- .../fabric-bridge-app/linux/RpcServer.cpp | 16 +++++++ examples/fabric-bridge-app/linux/main.cpp | 3 ++ 10 files changed, 98 insertions(+), 9 deletions(-) diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index eb97e63235e714..53728d33eac42a 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -202,21 +202,21 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target linux-x64-fabric-admin \ + --target linux-x64-fabric-admin-rpc \ build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ linux debug fabric-admin \ - out/linux-x64-fabric-admin/fabric-admin \ + out/linux-x64-fabric-admin-rpc/fabric-admin \ /tmp/bloat_reports/ - name: Build example Fabric Bridge App run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py \ - --target linux-x64-fabric-bridge \ + --target linux-x64-fabric-bridge-no-ble-rpc \ build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ linux debug fabric-bridge-app \ - out/linux-x64-fabric-bridge/fabric-bridge-app \ + out/linux-x64-fabric-bridge-no-ble-rpc/fabric-bridge-app \ /tmp/bloat_reports/ - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports diff --git a/examples/common/pigweed/protos/fabric_bridge_service.proto b/examples/common/pigweed/protos/fabric_bridge_service.proto index 5bd4f8efd779e7..10e5ccf888583d 100644 --- a/examples/common/pigweed/protos/fabric_bridge_service.proto +++ b/examples/common/pigweed/protos/fabric_bridge_service.proto @@ -11,5 +11,6 @@ message SynchronizedDevice { service FabricBridge { rpc AddSynchronizedDevice(SynchronizedDevice) returns (pw.protobuf.Empty){} + rpc RemoveSynchronizedDevice(SynchronizedDevice) returns (pw.protobuf.Empty){} } diff --git a/examples/common/pigweed/rpc_services/FabricBridge.h b/examples/common/pigweed/rpc_services/FabricBridge.h index bce32ebd3d99b2..4b9c4d93f1eb51 100644 --- a/examples/common/pigweed/rpc_services/FabricBridge.h +++ b/examples/common/pigweed/rpc_services/FabricBridge.h @@ -38,6 +38,11 @@ class FabricBridge : public pw_rpc::nanopb::FabricBridge::Service { return pw::Status::Unimplemented(); } + + virtual pw::Status RemoveSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) + { + return pw::Status::Unimplemented(); + } }; } // namespace rpc diff --git a/examples/fabric-admin/BUILD.gn b/examples/fabric-admin/BUILD.gn index 3427c6c0f6c2d9..be8313d7a944ac 100644 --- a/examples/fabric-admin/BUILD.gn +++ b/examples/fabric-admin/BUILD.gn @@ -46,8 +46,6 @@ config("config") { defines += [ "CONFIG_USE_LOCAL_STORAGE" ] } - cflags = [ "-Wconversion" ] - if (chip_enable_pw_rpc) { defines += [ "PW_RPC_ENABLED" ] } @@ -144,6 +142,10 @@ static_library("fabric-admin-utils") { ] deps += pw_build_LINK_DEPS + } else { + # The system_rpc_server.cc file is in pigweed and doesn't compile with + # -Wconversion, remove check for RPC build only. + cflags = [ "-Wconversion" ] } if (chip_enable_transport_trace) { diff --git a/examples/fabric-admin/args.gni b/examples/fabric-admin/args.gni index 83300d797ed08a..63c91c70c209cd 100644 --- a/examples/fabric-admin/args.gni +++ b/examples/fabric-admin/args.gni @@ -32,3 +32,4 @@ matter_log_json_payload_decode_full = true # make fabric-admin very strict by default chip_tlv_validate_char_string_on_read = true chip_tlv_validate_char_string_on_write = true +chip_enable_ble = true diff --git a/examples/fabric-admin/rpc/RpcClient.cpp b/examples/fabric-admin/rpc/RpcClient.cpp index 96a39e91f23b02..f03c4f3f699838 100644 --- a/examples/fabric-admin/rpc/RpcClient.cpp +++ b/examples/fabric-admin/rpc/RpcClient.cpp @@ -41,6 +41,7 @@ constexpr uint32_t kDefaultChannelId = 1; // Fabric Bridge Client rpc::pw_rpc::nanopb::FabricBridge::Client fabricBridgeClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); pw::rpc::NanopbUnaryReceiver<::pw_protobuf_Empty> addSynchronizedDeviceCall; +pw::rpc::NanopbUnaryReceiver<::pw_protobuf_Empty> removeSynchronizedDeviceCall; // Callback function to be called when the RPC response is received void OnAddDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status status) @@ -55,6 +56,19 @@ void OnAddDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status } } +// Callback function to be called when the RPC response is received +void OnRemoveDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status status) +{ + if (status.ok()) + { + ChipLogProgress(NotSpecified, "RemoveSynchronizedDevice RPC call succeeded!"); + } + else + { + ChipLogProgress(NotSpecified, "RemoveSynchronizedDevice RPC call failed with status: %d", status.code()); + } +} + } // namespace CHIP_ERROR InitRpcClient(uint16_t rpcServerPort) @@ -76,11 +90,41 @@ CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId) chip_rpc_SynchronizedDevice device; device.node_id = nodeId; - // The RPC will remain active as long as `addSynchronizedDeviceCall` is alive. + // By assigning the returned call to the global 'addSynchronizedDeviceCall', the RPC + // call is kept alive until it completes. When a response is received, it + // will be logged by the handler function and the call will complete. addSynchronizedDeviceCall = fabricBridgeClient.AddSynchronizedDevice(device, OnAddDeviceResponseCompleted); if (!addSynchronizedDeviceCall.active()) { + // The RPC call was not sent. This could occur due to, for example, an invalid channel ID. Handle if necessary. + return CHIP_ERROR_INTERNAL; + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR RemoveSynchronizedDevice(chip::NodeId nodeId) +{ + ChipLogProgress(NotSpecified, "RemoveSynchronizedDevice"); + + if (removeSynchronizedDeviceCall.active()) + { + ChipLogError(NotSpecified, "Remove Synchronized Device operation is in progress\n"); + return CHIP_ERROR_BUSY; + } + + chip_rpc_SynchronizedDevice device; + device.node_id = nodeId; + + // By assigning the returned call to the global 'removeSynchronizedDeviceCall', the RPC + // call is kept alive until it completes. When a response is received, it + // will be logged by the handler function and the call will complete. + removeSynchronizedDeviceCall = fabricBridgeClient.RemoveSynchronizedDevice(device, OnRemoveDeviceResponseCompleted); + + if (!removeSynchronizedDeviceCall.active()) + { + // The RPC call was not sent. This could occur due to, for example, an invalid channel ID. Handle if necessary. return CHIP_ERROR_INTERNAL; } diff --git a/examples/fabric-admin/rpc/RpcClient.h b/examples/fabric-admin/rpc/RpcClient.h index f6ce805d607ce0..eb28c19bee7d3e 100644 --- a/examples/fabric-admin/rpc/RpcClient.h +++ b/examples/fabric-admin/rpc/RpcClient.h @@ -46,3 +46,18 @@ CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. */ CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId); + +/** + * @brief Removes a synchronized device from the RPC client. + * + * This function attempts to remove a device identified by its `nodeId` from the synchronized device list. + * It logs the progress and checks if a `RemoveSynchronizedDevice` operation is already in progress. + * If an operation is in progress, it returns `CHIP_ERROR_BUSY`. + * + * @param nodeId The Node ID of the device to be removed. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_ERROR_BUSY: Another operation is currently in progress. + * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. + */ +CHIP_ERROR RemoveSynchronizedDevice(chip::NodeId nodeId); diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index 3e82f044c047f9..2b408d52625fea 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -46,8 +46,6 @@ executable("fabric-bridge-app") { "${chip_root}/src/lib", ] - cflags = [ "-Wconversion" ] - include_dirs = [ "include" ] if (bridge_enable_pw_rpc) { @@ -87,6 +85,10 @@ executable("fabric-bridge-app") { "${chip_root}/examples/common", "${chip_root}/examples/platform/linux", ] + } else { + # The system_rpc_server.cc file is in pigweed and doesn't compile with + # -Wconversion, remove check for RPC build only. + cflags = [ "-Wconversion" ] } output_dir = root_out_dir diff --git a/examples/fabric-bridge-app/linux/RpcServer.cpp b/examples/fabric-bridge-app/linux/RpcServer.cpp index 088fc9a50a38b8..d4044f043468d3 100644 --- a/examples/fabric-bridge-app/linux/RpcServer.cpp +++ b/examples/fabric-bridge-app/linux/RpcServer.cpp @@ -43,6 +43,7 @@ class FabricBridge final : public chip::rpc::FabricBridge { public: pw::Status AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) override; + pw::Status RemoveSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) override; }; pw::Status FabricBridge::AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) @@ -64,6 +65,21 @@ pw::Status FabricBridge::AddSynchronizedDevice(const chip_rpc_SynchronizedDevice return pw::OkStatus(); } +pw::Status FabricBridge::RemoveSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) +{ + NodeId nodeId = request.node_id; + ChipLogProgress(NotSpecified, "Received RemoveSynchronizedDevice: " ChipLogFormatX64, ChipLogValueX64(nodeId)); + + int removed_idx = DeviceMgr().RemoveDeviceByNodeId(nodeId); + if (removed_idx < 0) + { + ChipLogError(NotSpecified, "Failed to remove device with nodeId=0x" ChipLogFormatX64, ChipLogValueX64(nodeId)); + return pw::Status::NotFound(); + } + + return pw::OkStatus(); +} + FabricBridge fabric_bridge_service; #endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index f4217a14868972..2047e15877ee4c 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -47,7 +47,10 @@ using namespace chip::app::Clusters::AdministratorCommissioning; namespace { constexpr uint16_t kPollIntervalMs = 100; + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE constexpr uint16_t kRetryIntervalS = 3; +#endif bool KeyboardHit() { From e5acdc9a8b5bd4bd7a56642b7bb3c811488d56d1 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 3 Jul 2024 10:38:23 -0400 Subject: [PATCH 06/15] Fix logic error in codegen data model: write privileges should only exist if attribute is NOT read-only (#34161) * Tests update * Restyle * Make clang-tidy happy * Restyle and fix one more clang-tidy error --------- Co-authored-by: Andrei Litvin --- .../codegen-data-model/CodegenDataModel.cpp | 2 +- .../tests/TestCodegenModelViaMocks.cpp | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/app/codegen-data-model/CodegenDataModel.cpp b/src/app/codegen-data-model/CodegenDataModel.cpp index d46deeeddaa1e0..ec7b13af357287 100644 --- a/src/app/codegen-data-model/CodegenDataModel.cpp +++ b/src/app/codegen-data-model/CodegenDataModel.cpp @@ -115,7 +115,7 @@ void LoadAttributeInfo(const ConcreteAttributePath & path, const EmberAfAttribut InteractionModel::AttributeInfo * info) { info->readPrivilege = RequiredPrivilege::ForReadAttribute(path); - if (attribute.IsReadOnly()) + if (!attribute.IsReadOnly()) { info->writePrivilege = RequiredPrivilege::ForWriteAttribute(path); } diff --git a/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp index 11264bbd33a36e..df759e78666659 100644 --- a/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp @@ -59,6 +59,8 @@ constexpr NodeId kTestNodeId = 0xFFFF'1234'ABCD'4321; constexpr EndpointId kEndpointIdThatIsMissing = kMockEndpointMin - 1; +constexpr AttributeId kReadOnlyAttributeId = 0x5001; + static_assert(kEndpointIdThatIsMissing != kInvalidEndpointId); static_assert(kEndpointIdThatIsMissing != kMockEndpoint1); static_assert(kEndpointIdThatIsMissing != kMockEndpoint2); @@ -190,6 +192,11 @@ const MockNodeConfig gTestNodeConfig({ }), MockClusterConfig(MockClusterId(3), { ClusterRevision::Id, FeatureMap::Id, + MockAttributeConfig( + kReadOnlyAttributeId, + ZCL_INT32U_ATTRIBUTE_TYPE, + ATTRIBUTE_MASK_NULLABLE // NOTE: explicltly NOT ATTRIBUTE_MASK_WRITABLE + ) }), MockClusterConfig(MockClusterId(4), { ClusterRevision::Id, @@ -809,9 +816,22 @@ TEST(TestCodegenModelViaMocks, GetAttributeInfo) ASSERT_TRUE(info.has_value()); EXPECT_FALSE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) + // Mocks always set everything as R/W with administrative privileges + EXPECT_EQ(info->readPrivilege, chip::Access::Privilege::kAdminister); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->writePrivilege, chip::Access::Privilege::kAdminister); // NOLINT(bugprone-unchecked-optional-access) + info = model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint2, MockClusterId(2), MockAttributeId(2))); ASSERT_TRUE(info.has_value()); - EXPECT_TRUE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_TRUE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->readPrivilege, chip::Access::Privilege::kAdminister); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->writePrivilege, chip::Access::Privilege::kAdminister); // NOLINT(bugprone-unchecked-optional-access) + + // test a read-only attribute, which will not have a write privilege + info = model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint3, MockClusterId(3), kReadOnlyAttributeId)); + ASSERT_TRUE(info.has_value()); + EXPECT_FALSE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->readPrivilege, chip::Access::Privilege::kAdminister); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_FALSE(info->writePrivilege.has_value()); // NOLINT(bugprone-unchecked-optional-access) } // global attributes are EXPLICITLY not supported From 446ca8b47ccc7079b60c50387445b62e736de10e Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 3 Jul 2024 18:15:40 +0200 Subject: [PATCH 07/15] Allow specifying vendor/product ID in hex format (#34172) --- examples/platform/linux/Options.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/platform/linux/Options.cpp b/examples/platform/linux/Options.cpp index 78b73f6a0dc42c..9d6edc8bc43846 100644 --- a/examples/platform/linux/Options.cpp +++ b/examples/platform/linux/Options.cpp @@ -352,27 +352,28 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, break; case kDeviceOption_Version: - LinuxDeviceOptions::GetInstance().payload.version = static_cast(atoi(aValue)); + LinuxDeviceOptions::GetInstance().payload.version = static_cast(strtoul(aValue, nullptr, 0)); break; case kDeviceOption_VendorID: - LinuxDeviceOptions::GetInstance().payload.vendorID = static_cast(atoi(aValue)); + LinuxDeviceOptions::GetInstance().payload.vendorID = static_cast(strtoul(aValue, nullptr, 0)); break; case kDeviceOption_ProductID: - LinuxDeviceOptions::GetInstance().payload.productID = static_cast(atoi(aValue)); + LinuxDeviceOptions::GetInstance().payload.productID = static_cast(strtoul(aValue, nullptr, 0)); break; case kDeviceOption_CustomFlow: - LinuxDeviceOptions::GetInstance().payload.commissioningFlow = static_cast(atoi(aValue)); + LinuxDeviceOptions::GetInstance().payload.commissioningFlow = static_cast(strtoul(aValue, nullptr, 0)); break; case kDeviceOption_Capabilities: - LinuxDeviceOptions::GetInstance().payload.rendezvousInformation.Emplace().SetRaw(static_cast(atoi(aValue))); + LinuxDeviceOptions::GetInstance().payload.rendezvousInformation.Emplace().SetRaw( + static_cast(strtoul(aValue, nullptr, 0))); break; case kDeviceOption_Discriminator: { - uint16_t value = static_cast(atoi(aValue)); + uint16_t value = static_cast(strtoul(aValue, nullptr, 0)); if (value >= 4096) { PrintArgError("%s: invalid value specified for discriminator: %s\n", aProgram, aValue); @@ -386,7 +387,7 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, } case kDeviceOption_Passcode: - LinuxDeviceOptions::GetInstance().payload.setUpPINCode = static_cast(atoi(aValue)); + LinuxDeviceOptions::GetInstance().payload.setUpPINCode = static_cast(strtoul(aValue, nullptr, 0)); break; case kDeviceOption_Spake2pSaltBase64: { @@ -476,11 +477,9 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, case kDeviceOption_SecuredCommissionerPort: LinuxDeviceOptions::GetInstance().securedCommissionerPort = static_cast(atoi(aValue)); break; - case kCommissionerOption_FabricID: { - char * eptr; - LinuxDeviceOptions::GetInstance().commissionerFabricId = (chip::FabricId) strtoull(aValue, &eptr, 0); + case kCommissionerOption_FabricID: + LinuxDeviceOptions::GetInstance().commissionerFabricId = static_cast(strtoull(aValue, nullptr, 0)); break; - } #endif case kDeviceOption_Command: From 7557e54e0b282e013209b42f6c49c9fd846d3d3d Mon Sep 17 00:00:00 2001 From: hiltonlima <116589806+hiltonlima@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:33:56 -0300 Subject: [PATCH 08/15] Update test start hooks (#34140) * Update test start hooks * Restyled by autopep8 --------- Co-authored-by: Restyled.io --- scripts/py_matter_yamltests/matter_yamltests/hooks.py | 5 ++++- scripts/tests/chipyaml/tests_logger.py | 2 +- src/python_testing/hello_external_runner.py | 2 +- src/python_testing/matter_testing_support.py | 5 +++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/py_matter_yamltests/matter_yamltests/hooks.py b/scripts/py_matter_yamltests/matter_yamltests/hooks.py index 9b202c7e94d122..3d25cfff9c06c1 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/hooks.py +++ b/scripts/py_matter_yamltests/matter_yamltests/hooks.py @@ -104,7 +104,7 @@ def stop(self, duration: int): """ pass - def test_start(self, filename: str, name: str, count: int): + def test_start(self, filename: str, name: str, count: int, steps: list[str] = []): """ This method is called when the runner starts running a single test. @@ -118,6 +118,9 @@ def test_start(self, filename: str, name: str, count: int): count: int The number of steps from the test that will be run. + + steps: list[str] + The computed test step names """ pass diff --git a/scripts/tests/chipyaml/tests_logger.py b/scripts/tests/chipyaml/tests_logger.py index ff8ea0b41cec01..1d9480127df180 100755 --- a/scripts/tests/chipyaml/tests_logger.py +++ b/scripts/tests/chipyaml/tests_logger.py @@ -161,7 +161,7 @@ def start(self, count: int): def stop(self, duration: int): print(self.__strings.stop.format(runned=self.__runned, skipped=self.__skipped, duration=duration)) - def test_start(self, filename: str, name: str, count: int): + def test_start(self, filename: str, name: str, count: int, steps: list[str] = []): print(self.__strings.test_start.format(name=click.style(name, bold=True), count=click.style(count, bold=True))) if self.__use_test_harness_log_format: diff --git a/src/python_testing/hello_external_runner.py b/src/python_testing/hello_external_runner.py index 648ba5a85ff4aa..5f00eeb287a543 100755 --- a/src/python_testing/hello_external_runner.py +++ b/src/python_testing/hello_external_runner.py @@ -59,7 +59,7 @@ def start(self, count: int): def stop(self, duration: int): self.stop_called = True - def test_start(self, filename: str, name: str, count: int): + def test_start(self, filename: str, name: str, count: int, steps: list[str] = []): self.test_start_called = True def test_stop(self, exception: Exception, duration: int): diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 623ec9e8e44518..796397c57e0458 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -274,7 +274,7 @@ def start(self, count: int): def stop(self, duration: int): logging.info(f'Finished test set, ran for {duration}ms') - def test_start(self, filename: str, name: str, count: int): + def test_start(self, filename: str, name: str, count: int, steps: list[str] = []): logging.info(f'Starting test from {filename}: {name} - {count} steps') def test_stop(self, exception: Exception, duration: int): @@ -740,7 +740,8 @@ def setup_test(self): num_steps = 1 if steps is None else len(steps) filename = inspect.getfile(self.__class__) desc = self.get_test_desc(test_name) - self.runner_hook.test_start(filename=filename, name=desc, count=num_steps) + steps_descriptions = [] if steps is None else [step.description for step in steps] + self.runner_hook.test_start(filename=filename, name=desc, count=num_steps, steps=steps_descriptions) # If we don't have defined steps, we're going to start the one and only step now # if there are steps defined by the test, rely on the test calling the step() function # to indicates how it is proceeding From f8a633e51ad3c01cd5ce31b15c2b359390d27df8 Mon Sep 17 00:00:00 2001 From: Vatsal Ghelani <152916324+vatsalghelani-csa@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:58:23 -0400 Subject: [PATCH 09/15] Fixed python test runner code to error out if there are 0 test runs (#34164) * Create python_test_arguments.txt * Fixed runner code that 0 runs are an error * Restyled by autopep8 * Update hello_test.py * Update python_test_arguments.txt * Update python.md * Update python.md * Delete docs/testing/python_test_arguments.txt * Restyled by prettier-markdown * Update python.md * Update python.md * Update run_python_test.py * Restyled by prettier-markdown * Update python.md * Restyled by prettier-markdown --------- Co-authored-by: Restyled.io --- docs/testing/python.md | 66 +++++++++++++++++++++++++++++++- scripts/tests/run_python_test.py | 4 ++ src/python_testing/hello_test.py | 7 ++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/docs/testing/python.md b/docs/testing/python.md index 51f734ace3ab15..06051fee4fb33b 100644 --- a/docs/testing/python.md +++ b/docs/testing/python.md @@ -19,6 +19,11 @@ Python tests located in src/python_testing ## Writing Python tests +- Defining arguments in the test script + - In order to streamline the configuration and execution of tests, it is + essential to define arguments at the top of the test script. This + section should include various parameters and their respective values, + which will guide the test runner on how to execute the tests. - All test classes inherit from MatterBaseTest in [matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py) - support for commissioning using the python controller @@ -36,11 +41,17 @@ Python tests located in src/python_testing - Use Mobly assertions for failing tests - self.step() along with a steps\_ function to mark test plan steps for cert tests -- ### A simple test ``` +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto + class TC_MYTEST_1_1(MatterBaseTest): @async_test_body @@ -74,6 +85,59 @@ The default_matter_test_main() function is used to run the test on the command line. These two lines should appear verbatim at the bottom of every python test file. +## Defining the test arguments + +Below is the format: + +``` +# test-runner-runs: +# test-runner-run//app: ${TYPE_OF_APP} +# test-runner-run//factoryreset: +# test-runner-run//quiet: +# test-runner-run//app-args: +# test-runner-run//script-args: +``` + +### Description of Parameters + +- test-runner-runs: Specifies the identifier for the run. This can be any + unique identifier. + + - Example: run1 + +- test-runner-run//app: Indicates the application to be used + in the test. Different app types as needed could be referenced from section + [name: Generate an argument environment file ] of the file + [.github/workflows/tests.yaml](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml) + + - Example: \${TYPE_OF_APP} + +- test-runner-run//factoryreset: Determines whether a factory + reset should be performed before the test. + + - Example: True + +- test-runner-run//quiet: Sets the verbosity level of the test + run. When set to True, the test run will be quieter. + + - Example: True + +- test-runner-run//app-args: Specifies the arguments to be + passed to the application during the test. + + - Example: --discriminator 1234 --KVS kvs1 --trace-to + json:\${TRACE_APP}.json + +- test-runner-run//script-args: Specifies the arguments to be + passed to the test script. + - Example: --storage-path admin_storage.json --commissioning-method + on-network --discriminator 1234 --passcode 20202021 --trace-to + json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto + +This structured format ensures that all necessary configurations are clearly +defined and easily understood, allowing for consistent and reliable test +execution. + ## Cluster Codegen - [Objects.py](https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/clusters/Objects.py) diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index 5ccd67a987a401..7d7500c10f5a11 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -110,6 +110,10 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st ) ] + if not runs: + raise Exception( + "No valid runs were found. Make sure you add runs to your file, see https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md document for reference/example.") + for run in runs: print(f"Executing {run.py_script_path.split('/')[-1]} {run.run}") main_impl(run.app, run.factoryreset, run.factoryreset_app_only, run.app_args, diff --git a/src/python_testing/hello_test.py b/src/python_testing/hello_test.py index d6953bf3912c11..01657bf1bded6a 100644 --- a/src/python_testing/hello_test.py +++ b/src/python_testing/hello_test.py @@ -15,6 +15,13 @@ # limitations under the License. # +# test-runner-runs: run1 +# test-runner-run/run1/app: ${TYPE_OF_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto + import logging import chip.clusters as Clusters From 70744ed409212a1486f1203c42b9c34f8a6377cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szablowski?= <56074162+doublemis1@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:15:35 +0200 Subject: [PATCH 10/15] chip-repl runner: support missing features needed to yaml tests (#34130) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support to capture and use eventNumber parameter from read event response (needed for e.g. ACL-2.6) * Add support for current implemented pseduo cluster - most crucial EqualityCommands (needed for e.g. DGGEN-2.3) * Add possibility to gather cluster-specific error in InteractionDataModelError (needed for e.g. DRLK-2.8) Signed-off-by: Michał Szablowski --- scripts/tests/chiptest/__init__.py | 33 ----------------------- src/controller/python/chip/yaml/runner.py | 18 +++++++------ 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 0bd954a6241c72..d5a493b879d39b 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -226,50 +226,17 @@ def _GetChipReplUnsupportedTests() -> Set[str]: return { "Test_AddNewFabricFromExistingFabric.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command "Test_TC_OPCREDS_3_7.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command - "TestEqualities.yaml", # chip-repl does not support pseudo-cluster commands that return a value "TestExampleCluster.yaml", # chip-repl does not load custom pseudo clusters "TestAttributesById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestCommandsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestEventsById.yaml", # chip-repl does not support AnyCommands (06/06/2023) "TestReadNoneSubscribeNone.yaml", # chip-repl does not support AnyCommands (07/27/2023) - "Test_TC_DRLK_2_8.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27011#issuecomment-1593339855 - "Test_TC_ACE_1_6.yaml", # Test fails only in chip-repl: Refer--> https://github.com/project-chip/connectedhomeip/pull/27910#issuecomment-1632485584 "Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023) - "TestGroupKeyManagementCluster.yaml", # chip-repl does not support EqualityCommands (2023-08-04) "TestIcdManagementCluster.yaml", # TODO(#30430): add ICD registration support in chip-repl "Test_TC_ICDM_3_4.yaml", # chip-repl does not support ICD registration - "Test_TC_S_2_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_MOD_3_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_BRBINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_DGGEN_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_DGGEN_2_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_LWM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_LWM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_LWM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_OTCCM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_OTCCM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_OTCCM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_G_2_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_RVCRUNM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_RVCCLEANM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCCM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCCM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCCM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_TCTL_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster # chip-repl and chip-tool disagree on what the YAML here should look like: https://github.com/project-chip/connectedhomeip/issues/29110 "TestClusterMultiFabric.yaml", - "Test_TC_ACL_2_5.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884 - "Test_TC_ACL_2_6.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884 - "Test_TC_RVCCLEANM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_BINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "TestDiagnosticLogs.yaml", # chip-repl does not implement a BDXTransferServerDelegate - "Test_TC_EEVSEM_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_EEVSEM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_EEVSEM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster - "Test_TC_EEVSEM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "TestDiagnosticLogsDownloadCommand.yaml", # chip-repl does not implement the bdx download command } diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index ce1eaf84fcfbb9..3081dad6248fa9 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -31,14 +31,11 @@ from chip.exceptions import ChipStackError from chip.yaml.data_model_lookup import DataModelLookup from chip.yaml.errors import ActionCreationError, UnexpectedActionCreationError -from matter_yamltests.pseudo_clusters.clusters.delay_commands import DelayCommands -from matter_yamltests.pseudo_clusters.clusters.log_commands import LogCommands -from matter_yamltests.pseudo_clusters.clusters.system_commands import SystemCommands -from matter_yamltests.pseudo_clusters.pseudo_clusters import PseudoClusters +from matter_yamltests.pseudo_clusters.pseudo_clusters import get_default_pseudo_clusters from .data_model_lookup import PreDefinedDataModelLookup -_PSEUDO_CLUSTERS = PseudoClusters([DelayCommands(), LogCommands(), SystemCommands()]) +_PSEUDO_CLUSTERS = get_default_pseudo_clusters() logger = logging.getLogger('YamlParser') @@ -129,8 +126,8 @@ def __init__(self, test_step): raise ActionCreationError(f'Default cluster {test_step.cluster} {test_step.command}, not supported') async def run_action(self, dev_ctrl: ChipDeviceController) -> _ActionResult: - _ = await _PSEUDO_CLUSTERS.execute(self._test_step) - return _ActionResult(status=_ActionStatus.SUCCESS, response=None) + response = await _PSEUDO_CLUSTERS.execute(self._test_step) + return _ActionResult(status=_ActionStatus.SUCCESS, response=response[0]) class InvokeAction(BaseAction): @@ -884,8 +881,12 @@ def decode(self, result: _ActionResult): response = result.response decoded_response = {} + if isinstance(response, dict): + return response + if isinstance(response, chip.interaction_model.InteractionModelError): decoded_response['error'] = stringcase.snakecase(response.status.name).upper() + decoded_response['clusterError'] = response.clusterStatus return decoded_response if isinstance(response, chip.interaction_model.Status): @@ -939,12 +940,13 @@ def decode(self, result: _ActionResult): cluster_id = event.Header.ClusterId cluster_name = self._test_spec_definition.get_cluster_name(cluster_id) event_id = event.Header.EventId + event_number = event.Header.EventNumber event_name = self._test_spec_definition.get_event_name(cluster_id, event_id) event_definition = self._test_spec_definition.get_event_by_name(cluster_name, event_name) is_fabric_scoped = bool(event_definition.is_fabric_sensitive) decoded_event = Converter.from_data_model_to_test_definition( self._test_spec_definition, cluster_name, event_definition.fields, event.Data, is_fabric_scoped) - decoded_response.append({'value': decoded_event}) + decoded_response.append({'value': decoded_event, 'eventNumber': event_number}) return decoded_response if isinstance(response, ChipStackError): From d9fc295f0e590c9beb07191f4c4500cf1dfb7426 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 3 Jul 2024 12:03:17 -0700 Subject: [PATCH 11/15] [CI] Add Fabric-Admin and Fabric-Bridge to Linux ARM build target (#34177) --- .github/workflows/examples-linux-arm.yaml | 2 ++ examples/platform/linux/RpcClientProcessor.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 4bf103ddae4542..e22bb903635875 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -67,6 +67,8 @@ jobs: --target linux-arm64-light-rpc-ipv6only-clang \ --target linux-arm64-thermostat-no-ble-clang \ --target linux-arm64-lit-icd-no-ble-clang \ + --target linux-arm64-fabric-admin-clang-rpc \ + --target linux-arm64-fabric-bridge-no-ble-clang-rpc \ build \ " - name: Bloat report - chip-tool diff --git a/examples/platform/linux/RpcClientProcessor.cpp b/examples/platform/linux/RpcClientProcessor.cpp index a2cbe5694f531d..2b2fd661bc2771 100644 --- a/examples/platform/linux/RpcClientProcessor.cpp +++ b/examples/platform/linux/RpcClientProcessor.cpp @@ -33,7 +33,6 @@ namespace { // Constants constexpr size_t kMaxTransmissionUnit = 256; -constexpr uint32_t kDefaultChannelId = 1; const char * kDefaultRpcServerAddress = "127.0.0.1"; // RPC Stream and Channel Setup From 5a6d0f93695523f73b0411ea1898f2fa69125924 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 3 Jul 2024 15:11:14 -0400 Subject: [PATCH 12/15] Add Darwin availability annotations for some new features. (#34167) * Add Darwin availability annotations for some new features. * Update src/darwin/Framework/CHIP/templates/availability.yaml * Apply suggestions from code review --------- Co-authored-by: Justin Wood --- .../CHIP/templates/availability.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 4ca8533a55d561..88241256e2eca2 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -9694,6 +9694,25 @@ - ThreadBorderRouterManagement - ThreadNetworkDirectory - WiFiNetworkManagement + attributes: + OccupancySensing: + # Targeting 1.4 + - HoldTime + - HoldTimeLimits + commands: + UnitTesting: + # Ideally none of UnitTesting would be exposed as public API, but + # for now just start doing that for new additions to it. + - StringEchoRequest + - StringEchoResponse + structs: + OccupancySensing: + # Targeting 1.4 + - HoldTimeLimitsStruct + bitmaps: + OccupancySensing: + # Targeting Fall 1.4 + - Feature bitmap values: Switch: Feature: From ee0d96e8cf428fd90919a045fb49c4102798e2b5 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:45:04 -0400 Subject: [PATCH 13/15] [Silabs] Add support for EFR32MG26 boards (#34165) * Add support for EFR32MG26 boards * update matter suppport submodule to get mg26 provision lib * Try to regroup all _include_dir together. List MCU include before ncp's for wifi ncp combos * Fixup missing define for the MCU family for ncp builds. --- .../platform/silabs/ldscripts/efr32mg26.ld | 245 +++++++++++++++++ third_party/silabs/efr32_sdk.gni | 251 ++++++++++-------- third_party/silabs/matter_support | 2 +- third_party/silabs/silabs_arm.gni | 3 +- third_party/silabs/silabs_board.gni | 23 ++ 5 files changed, 405 insertions(+), 119 deletions(-) create mode 100644 examples/platform/silabs/ldscripts/efr32mg26.ld diff --git a/examples/platform/silabs/ldscripts/efr32mg26.ld b/examples/platform/silabs/ldscripts/efr32mg26.ld new file mode 100644 index 00000000000000..2476e4dce37274 --- /dev/null +++ b/examples/platform/silabs/ldscripts/efr32mg26.ld @@ -0,0 +1,245 @@ +/***************************************************************************//** + * GCC Linker script for Silicon Labs devices + ******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + + MEMORY + { + FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 0x318000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x80000 + } + +ENTRY(Reset_Handler) + +SECTIONS +{ + + .vectors : + { + linker_vectors_begin = .; + KEEP(*(.vectors)) + linker_vectors_end = .; + + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __lma_ramfuncs_start__ = .; + } > FLASH + + .stack (NOLOAD): + { + . = ALIGN(8); + __StackLimit = .; + KEEP(*(.stack*)) + . = ALIGN(4); + __StackTop = .; + PROVIDE(__stack = __StackTop); + } > RAM + + + .noinit (NOLOAD): + { + *(.noinit*); + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(SORT_BY_ALIGNMENT(.bss*)) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + text_application_ram : + { + . = ALIGN(4); + __vma_ramfuncs_start__ = .; + __text_application_ram_start__ = .; + + *(text_application_ram) + + . = ALIGN(4); + __vma_ramfuncs_end__ = .; + __text_application_ram_end__ = .; + } > RAM AT > FLASH + + .rodata : + { + __lma_ramfuncs_end__ = .; + __rodata_start__ = .; + __rodata_end__ = .; + } > FLASH + + .text : + { + linker_code_begin = .; + *(SORT_BY_ALIGNMENT(.text*)) + *(SORT_BY_ALIGNMENT(text_*)) + . = ALIGN(32); + linker_code_end = .; + + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata*) + *(.eh_frame*) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + + .copy.table : + { + . = ALIGN(4); + __copy_table_start__ = .; + + LONG (__etext) + LONG (__data_start__) + LONG ((__data_end__ - __data_start__) / 4) + + /* Add each additional data section here */ + /* + LONG (__etext2) + LONG (__data2_start__) + LONG ((__data2_end__ - __data2_start__) / 4) + */ + + __copy_table_end__ = .; + } > FLASH + + .zero.table : + { + . = ALIGN(4); + __zero_table_start__ = .; + /* Add each additional bss section here */ + /* + LONG (__bss2_start__) + LONG ((__bss2_end__ - __bss2_start__) / 4) + */ + + __zero_table_end__ = .; + __etext = .; + } > FLASH + + .data : + { + . = ALIGN(4); + __data_start__ = .; + *(vtable) + *(SORT_BY_ALIGNMENT(.data*)) + . = ALIGN(4); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM AT > FLASH + .memory_manager_heap (NOLOAD): + { + . = ALIGN(8); + __HeapBase = .; + __end__ = .; + end = __end__; + _end = __end__; + KEEP(*(.memory_manager_heap*)) + __HeapLimit = ORIGIN(RAM) + LENGTH(RAM); + } > RAM + + __heap_size = __HeapLimit - __HeapBase; + __ram_end__ = 0x20000000 + 0x80000; + __main_flash_end__ = 0x8006000 + 0x318000; + + /* This is where we handle flash storage blocks. We use dummy sections for finding the configured + * block sizes and then "place" them at the end of flash when the size is known. */ + .internal_storage (DSECT) : { + KEEP(*(.internal_storage*)) + } > FLASH + + + .nvm (DSECT) : { + KEEP(*(.simee*)) + } > FLASH + + __ramfuncs_start__ = __vma_ramfuncs_start__; + __ramfuncs_end__ = __vma_ramfuncs_end__; + + linker_nvm_end = __main_flash_end__; + linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm); + linker_storage_end = linker_nvm_begin; + __nvm3Base = linker_nvm_begin; + + linker_storage_begin = linker_storage_end - SIZEOF(.internal_storage); + ASSERT((linker_storage_begin >= (__etext + SIZEOF(.data))), "FLASH memory overflowed !") + + + app_flash_end = 0x8006000 + 0x318000; + ASSERT( (linker_nvm_begin + SIZEOF(.nvm)) <= app_flash_end, "NVM3 is excessing the flash size !") +} diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index ac30e83f123bfa..4d4656a5c22669 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -81,8 +81,11 @@ declare_args() { # Multi-chip OTA chip_enable_multi_ota_requestor = false } + examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" silabs_plat_efr32_wifi_dir = "${chip_root}/src/platform/silabs/efr32/wifi" +is_series_2 = silabs_family == "mgm24" || silabs_family == "efr32mg24" || + silabs_family == "efr32mg26" assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") @@ -135,6 +138,8 @@ template("efr32_sdk") { config("${sdk_target_name}_config") { include_dirs = [] libs = [] + defines = [] + if (defined(invoker.include_dirs)) { include_dirs += invoker.include_dirs } @@ -225,9 +230,94 @@ template("efr32_sdk") { "${sl_ot_libs_path}/config", ] + if (is_series_2) { + _include_dirs += [ + "${efr32_sdk_root}/platform/emdrv/dmadrv/inc/s2_signals", + "${efr32_sdk_root}/platform/driver/debug/inc/", + "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/", + "${efr32_sdk_root}/platform/service/device_init/config/s2/", + "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure", + ] + + libs += [ + "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", + "${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", + ] + + if (!chip_enable_ble_rs911x) { + libs += [ + "${sdk_support_root}/protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a", + "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/release/libbt_host.a", + "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/hal/release/libbt_hal_series2.a", + ] + } + } + if (silabs_family == "efr32mg24") { - _include_dirs += - [ "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include" ] + _include_dirs += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", + "${efr32_sdk_root}/platform/emdrv/spidrv/inc", + "${efr32_sdk_root}/platform/emdrv/spidrv/config", + ] + + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg24_gcc_release.a" ] + + if (!chip_enable_ble_rs911x) { + libs += [ "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a" ] + } + + defines += [ "EFR32MG24" ] + } else if (silabs_family == "mgm24") { + _include_dirs += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Include", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", + ] + + libs += [ + "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a", + "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a", + ] + + if (silabs_mcu == "MGM240PB32VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a" ] + } else if (silabs_mcu == "MGM240PB22VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb22vna_gcc.a" ] + } else if (silabs_mcu == "MGM240L022RNF") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240l022rnf_gcc.a" ] + } else if (silabs_mcu == "MGM240SD22VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240sd22vna_gcc.a" ] + defines += [ "SLI_RADIOAES_REQUIRES_MASKING=1" ] + } + + defines += [ "MGM24" ] + } else if (silabs_family == "efr32mg26") { + _include_dirs += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG26/Include", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg26", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg26/config", + ] + + libs += [ + "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg26_gcc_release.a", + "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg26_gcc_release.a", + ] + + defines += [ "EFR32MG26" ] + } + + if (use_wf200) { + _include_dirs += [ + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver", + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/bus", + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/firmware", + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/pds/brd8022a", + "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/secure_link", + ] } if (use_SiWx917) { @@ -279,12 +369,39 @@ template("efr32_sdk") { } } + if (use_system_view) { + _include_dirs += [ + "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER", + "${efr32_sdk_root}/util/third_party/segger/systemview/init/", + "${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/", + ] + + defines += [ + "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT", + "SEGGER_SYSVIEW_RTT_BUFFER_SIZE=8192", + ] + } + + if (use_wstk_leds) { + _include_dirs += [ "${efr32_sdk_root}/platform/driver/leddrv/inc" ] + + defines += [ "ENABLE_WSTK_LEDS" ] + } + + if (use_wstk_buttons) { + _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] + } + + if (invoker.enable_dic) { + _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] + } + # Note that we're setting the mbedTLS and PSA configuration files through a # define. This means the build system by default does not pick up changes in # the content of these, only when changing the filename itself. # To fix this, these files are also manually depended upon in the source set # declared in efr32_mbedtls_config further down this file. - defines = [ + defines += [ "MBEDTLS_CONFIG_FILE=\"efr32-chip-mbedtls-config.h\"", "MBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"efr32-psa-crypto-config.h\"", "__STARTUP_CLEAR_BSS", @@ -427,29 +544,6 @@ template("efr32_sdk") { } } - if (use_system_view) { - _include_dirs += [ - "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER", - "${efr32_sdk_root}/util/third_party/segger/systemview/init/", - "${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/", - ] - - defines += [ - "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT", - "SEGGER_SYSVIEW_RTT_BUFFER_SIZE=8192", - ] - } - - if (use_wstk_leds) { - _include_dirs += [ "${efr32_sdk_root}/platform/driver/leddrv/inc" ] - - defines += [ "ENABLE_WSTK_LEDS" ] - } - - if (use_wstk_buttons) { - _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] - } - if (chip_enable_icd_server) { defines += [ "SL_ICD_ENABLED=1", @@ -519,96 +613,10 @@ template("efr32_sdk") { ] } - if (invoker.enable_dic) { - _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] - } - if (sl_use_subscription_synching) { defines += [ "CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED=1" ] } - if (silabs_family == "efr32mg24") { - _include_dirs += [ - "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", - "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", - "${efr32_sdk_root}/platform/service/device_init/config/s2/", - "${efr32_sdk_root}/platform/emdrv/spidrv/inc", - "${efr32_sdk_root}/platform/emdrv/spidrv/config", - "${efr32_sdk_root}/platform/emdrv/dmadrv/inc/s2_signals", - ] - - libs += [ - "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_efr32xg24_gcc_release.a", - "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", - "${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", - ] - - if (!chip_enable_ble_rs911x) { - libs += [ - "${sdk_support_root}/protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a", - "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/release/libbt_host.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/hal/release/libbt_hal_series2.a", - ] - } - - defines += [ - "EFR32MG24", - "EFR32_SERIES2_CONFIG4_MICRO", - ] - } else if (silabs_family == "mgm24") { - _include_dirs += [ - "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Include", - "${efr32_sdk_root}/platform/driver/debug/inc/", - "${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x", - "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24/config", - "${efr32_sdk_root}/platform/service/device_init/config/s2/", - "${efr32_sdk_root}/platform/emdrv/dmadrv/inc/s2_signals", - ] - - libs += [ - "${sdk_support_root}/protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a", - "${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/release/libbt_host.a", - "${sdk_support_root}/protocol/bluetooth/build/gcc/cortex-m33/bt_host/hal/release/libbt_hal_series2.a", - "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a", - "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", - "${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", - ] - - if (silabs_mcu == "MGM240PB32VNA") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a" ] - } else if (silabs_mcu == "MGM240PB22VNA") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb22vna_gcc.a" ] - } else if (silabs_mcu == "MGM240L022RNF") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240l022rnf_gcc.a" ] - } else if (silabs_mcu == "MGM240SD22VNA") { - libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240sd22vna_gcc.a" ] - defines += [ "SLI_RADIOAES_REQUIRES_MASKING=1" ] - } - - defines += [ - "MGM24", - "EFR32_SERIES2_CONFIG4_MICRO", - ] - } - - if (use_wf200) { - _include_dirs += [ - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver", - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/bus", - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/firmware", - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/pds/brd8022a", - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/secure_link", - ] - } - cflags = [] foreach(include_dir, _include_dirs) { cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ] @@ -616,7 +624,7 @@ template("efr32_sdk") { cflags += [ "-Wno-shadow" ] - if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { + if (is_series_2) { cflags += [ "-mcmse" ] } @@ -930,7 +938,8 @@ template("efr32_sdk") { sources += [ "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Source/startup_efr32mg24.c", "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Source/system_efr32mg24.c", - "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_curves_efr32.c", + "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg24.c", + "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg24.c", ] } else if (silabs_family == "mgm24") { sources += [ @@ -938,11 +947,21 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/Device/SiliconLabs/MGM24/Source/system_mgm24.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/sl_fem_util.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/sl_rail_util_rssi.c", + "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg24.c", + "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg24.c", + ] + } else if (silabs_family == "efr32mg26") { + sources += [ + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG26/Source/startup_efr32mg26.c", + "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG26/Source/system_efr32mg26.c", + "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg26.c", + "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg26.c", ] } - if (silabs_family == "mgm24" || silabs_family == "efr32mg24") { + if (is_series_2) { sources += [ + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/pa_curves_efr32.c", "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_sequencer/sl_rail_util_sequencer.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager.c", "${efr32_sdk_root}/platform/security/sl_component/se_manager/src/sl_se_manager_attestation.c", @@ -975,8 +994,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/service/clock_manager/src/sl_clock_manager_hal_s2.c", "${efr32_sdk_root}/platform/service/clock_manager/src/sl_clock_manager_init_hal_s2.c", "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dcdc_s2.c", - "${efr32_sdk_root}/platform/service/device_manager/clocks/sl_device_clock_efr32xg24.c", - "${efr32_sdk_root}/platform/service/device_manager/devices/sl_device_peripheral_hal_efr32xg24.c", "${efr32_sdk_root}/platform/service/hfxo_manager/src/sl_hfxo_manager_hal_s2.c", "${efr32_sdk_root}/platform/service/power_manager/src/sl_power_manager_hal_s2.c", "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c", diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 256bb77c094980..04d6c602dd76c8 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 256bb77c094980316e342fa493df06ec652f060f +Subproject commit 04d6c602dd76c8ed1619436c840b3726cb030a6e diff --git a/third_party/silabs/silabs_arm.gni b/third_party/silabs/silabs_arm.gni index 30e6ed6ed09af8..f5e77f0d3ee736 100644 --- a/third_party/silabs/silabs_arm.gni +++ b/third_party/silabs/silabs_arm.gni @@ -20,7 +20,8 @@ if (silabs_family == "SiWx917-common") { arm_cpu = "cortex-m4" arm_float_abi = "softfp" arm_fpu = "fpv4-sp-d16" -} else if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { +} else if (silabs_family == "efr32mg24" || silabs_family == "mgm24" || + silabs_family == "efr32mg26") { arm_arch = "armv8-m.main+dsp" arm_abi = "aapcs" arm_cpu = "cortex-m33" diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni index 6b69fb59b9af06..7c1d77d036a41f 100644 --- a/third_party/silabs/silabs_board.gni +++ b/third_party/silabs/silabs_board.gni @@ -64,10 +64,13 @@ if (silabs_board == "") { assert(silabs_board != "", "silabs_board must be specified") +# Si917 WIFI board ---------- if (silabs_board == "BRD4338A") { silabs_family = "SiWx917-common" silabs_mcu = "SiWG917M111MGTBA" wifi_soc = true + + # EFR32 MG24 series ---------- } else if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") { variant = string_replace(silabs_board, "A", "C") print( @@ -95,6 +98,8 @@ if (silabs_board == "BRD4338A") { use_external_flash = false show_qr_code = false disable_lcd = true + + # EFR32 MG24 Modules series ---------- } else if (silabs_board == "BRD4316A") { silabs_family = "mgm24" silabs_mcu = "MGM240PB22VNA" @@ -130,6 +135,24 @@ if (silabs_board == "BRD4338A") { } else if (silabs_board == "BRD4318A") { silabs_family = "mgm24" silabs_mcu = "MGM240SD22VNA" + + # EFR32 MG26 series ---------- +} else if (silabs_board == "BRD4116A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B410F3200IM48" +} else if (silabs_board == "BRD4117A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B420F3200IM48" +} else if (silabs_board == "BRD4118A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B510F3200IL136" +} else if (silabs_board == "BRD2608A") { + silabs_family = "efr32mg26" + silabs_mcu = "EFR32MG26B510F3200IM68" + + # ThunderBoards don't have a LCD, + show_qr_code = false + disable_lcd = true } else { assert( false, From fa256737c60ac09acc4637f31a53727c145275db Mon Sep 17 00:00:00 2001 From: Pradip De Date: Wed, 3 Jul 2024 15:51:33 -0700 Subject: [PATCH 14/15] Minor fixes in TCP Disconnect to simplify the logic. (#34142) Use the available IPAddress and port info in the member PeerAddress in the ActiveConnection object to compare with the passed PeerAddress instead of calling GetPeerInfo() from within TCPEndPoint to fetch those. Log the connection closure in the CloseConnectionInternal function which is also called by CloseActiveConnections() from the TCPBase destructor. --- src/transport/raw/TCP.cpp | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index 3c3e6da15c2b58..8a15f754d54027 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -398,6 +398,10 @@ void TCPBase::CloseConnectionInternal(ActiveTCPConnectionState * connection, CHI if (connection->mConnectionState != TCPState::kClosed && connection->mEndPoint) { + char addrStr[Transport::PeerAddress::kMaxToStringSize]; + connection->mPeerAddr.ToString(addrStr); + ChipLogProgress(Inet, "Closing connection with peer %s.", addrStr); + if (err == CHIP_NO_ERROR) { connection->mEndPoint->Close(); @@ -616,36 +620,20 @@ CHIP_ERROR TCPBase::TCPConnect(const PeerAddress & address, Transport::AppTCPCon void TCPBase::TCPDisconnect(const PeerAddress & address) { - CHIP_ERROR err = CHIP_NO_ERROR; // Closes an existing connection for (size_t i = 0; i < mActiveConnectionsSize; i++) { if (mActiveConnections[i].IsConnected()) { - Inet::IPAddress ipAddress; - uint16_t port; - Inet::InterfaceId interfaceId; - - err = mActiveConnections[i].mEndPoint->GetPeerInfo(&ipAddress, &port); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Inet, "TCPDisconnect: GetPeerInfo error: %" CHIP_ERROR_FORMAT, err.Format()); - return; - } - - err = mActiveConnections[i].mEndPoint->GetInterfaceId(&interfaceId); - if (err != CHIP_NO_ERROR) + const Inet::IPAddress & ipAddress = mActiveConnections[i].mPeerAddr.GetIPAddress(); + uint16_t port = mActiveConnections[i].mPeerAddr.GetPort(); + + // Ignoring the InterfaceID in the check as it may not have been provided in + // the PeerAddress during connection establishment. The IPAddress and Port + // are the necessary and sufficient set of parameters for searching + // through the connections. + if (ipAddress == address.GetIPAddress() && port == address.GetPort() && address.GetTransportType() == Type::kTcp) { - ChipLogError(Inet, "TCPDisconnect: GetInterfaceId error: %" CHIP_ERROR_FORMAT, err.Format()); - return; - } - // if (address == PeerAddress::TCP(ipAddress, port, interfaceId)) - if (ipAddress == address.GetIPAddress() && port == address.GetPort()) - { - char addrStr[Transport::PeerAddress::kMaxToStringSize]; - address.ToString(addrStr); - ChipLogProgress(Inet, "Disconnecting with peer %s.", addrStr); - // NOTE: this leaves the socket in TIME_WAIT. // Calling Abort() would clean it since SO_LINGER would be set to 0, // however this seems not to be useful. From 5e37260895ff32e59a7b9fb68b543c9aab476504 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 3 Jul 2024 16:27:55 -0700 Subject: [PATCH 15/15] Update UniqueID in the BasicInformationCluster to align with the spec (#34166) * Update UniqueID in the BasicInformationCluster * Run codegen --- .../air-purifier-app.matter | 2 +- .../air-quality-sensor-app.matter | 2 +- .../all-clusters-app.matter | 2 +- .../all-clusters-minimal-app.matter | 3 +- .../all-clusters-minimal-app.zap | 58 ++++++++++++------- .../bridge-common/bridge-app.matter | 2 +- ...p_rootnode_dimmablelight_bCwGYSDpoe.matter | 2 +- .../rootnode_airpurifier_73a6fe2651.matter | 2 +- ...umiditysensor_thermostat_56de3d5f45.matter | 2 +- ...ootnode_airqualitysensor_e63187f6c9.matter | 2 +- ...ootnode_basicvideoplayer_0ff86e943b.matter | 2 +- ...de_colortemperaturelight_hbUnzYVeyn.matter | 2 +- .../rootnode_contactsensor_27f76aeaf5.matter | 2 +- .../rootnode_contactsensor_lFAGG1bfRO.matter | 2 +- .../rootnode_dimmablelight_bCwGYSDpoe.matter | 2 +- ...tnode_dimmablepluginunit_f8a9a0b9d4.matter | 2 +- .../rootnode_dishwasher_cc105034fe.matter | 2 +- .../rootnode_doorlock_aNKYAreMXE.matter | 2 +- ...tnode_extendedcolorlight_8lcaaYJVAa.matter | 2 +- .../devices/rootnode_fan_7N2TobIlOX.matter | 2 +- .../rootnode_flowsensor_1zVxHedlaV.matter | 2 +- .../rootnode_genericswitch_2dfff6e516.matter | 2 +- .../rootnode_genericswitch_9866e35d0b.matter | 2 +- ...tnode_heatingcoolingunit_ncdGai1E5a.matter | 2 +- .../rootnode_humiditysensor_Xyj4gda6Hb.matter | 2 +- .../rootnode_laundrywasher_fb10d238c8.matter | 2 +- .../rootnode_lightsensor_lZQycTFcJK.matter | 2 +- ...rootnode_occupancysensor_iHyVgifZuo.matter | 2 +- .../rootnode_onofflight_bbs1b7IaOV.matter | 2 +- .../rootnode_onofflight_samplemei.matter | 2 +- ...ootnode_onofflightswitch_FsPlMr090Q.matter | 2 +- ...rootnode_onoffpluginunit_Wtf8ss5EBY.matter | 2 +- .../rootnode_pressuresensor_s0qC9wLH4k.matter | 2 +- .../devices/rootnode_pump_5f904818cc.matter | 3 +- .../chef/devices/rootnode_pump_5f904818cc.zap | 16 +++++ .../devices/rootnode_pump_a811bb33a0.matter | 3 +- .../chef/devices/rootnode_pump_a811bb33a0.zap | 16 +++++ ...eraturecontrolledcabinet_ffdb696680.matter | 2 +- ...ode_roboticvacuumcleaner_1807ff0c49.matter | 2 +- ...tnode_roomairconditioner_9cf3607804.matter | 2 +- .../rootnode_smokecoalarm_686fe0dcb8.matter | 2 +- .../rootnode_speaker_RpzeXdimqA.matter | 2 +- ...otnode_temperaturesensor_Qy1zkNW7c3.matter | 2 +- .../rootnode_thermostat_bm3fb8dhYi.matter | 2 +- .../rootnode_windowcovering_RLCxaGi9Yx.matter | 2 +- .../contact-sensor-app.matter | 2 +- .../nxp/zap-lit/contact-sensor-app.matter | 3 +- .../nxp/zap-lit/contact-sensor-app.zap | 16 +++++ .../nxp/zap-sit/contact-sensor-app.matter | 3 +- .../nxp/zap-sit/contact-sensor-app.zap | 16 +++++ .../dishwasher-common/dishwasher-app.matter | 2 +- .../energy-management-app.matter | 3 +- .../energy-management-app.zap | 16 +++++ .../fabric-bridge-app.matter | 2 +- .../nxp/zap/laundry-washer-app.matter | 2 +- .../light-switch-app.matter | 2 +- .../light-switch-app/qpg/zap/switch.matter | 2 +- .../data_model/lighting-app-ethernet.matter | 2 +- .../data_model/lighting-app-thread.matter | 2 +- .../data_model/lighting-app-wifi.matter | 2 +- .../lighting-common/lighting-app.matter | 2 +- .../nxp/zap/lighting-on-off.matter | 3 +- .../lighting-app/nxp/zap/lighting-on-off.zap | 16 +++++ examples/lighting-app/qpg/zap/light.matter | 2 +- .../data_model/lighting-thread-app.matter | 2 +- .../data_model/lighting-wifi-app.matter | 2 +- .../lit-icd-common/lit-icd-server-app.matter | 3 +- .../lit-icd-common/lit-icd-server-app.zap | 16 +++++ examples/lock-app/lock-common/lock-app.matter | 2 +- examples/lock-app/nxp/zap/lock-app.matter | 3 +- examples/lock-app/nxp/zap/lock-app.zap | 16 +++++ examples/lock-app/qpg/zap/lock.matter | 2 +- .../microwave-oven-app.matter | 2 +- .../network-manager-app.matter | 2 +- .../ota-provider-app.matter | 2 +- .../ota-requestor-app.matter | 2 +- .../placeholder/linux/apps/app1/config.matter | 4 +- .../placeholder/linux/apps/app2/config.matter | 4 +- examples/pump-app/pump-common/pump-app.matter | 3 +- examples/pump-app/pump-common/pump-app.zap | 16 +++++ .../silabs/data_model/pump-thread-app.matter | 3 +- .../silabs/data_model/pump-thread-app.zap | 16 +++++ .../silabs/data_model/pump-wifi-app.matter | 3 +- .../silabs/data_model/pump-wifi-app.zap | 16 +++++ .../pump-controller-app.matter | 3 +- .../pump-controller-app.zap | 16 +++++ .../refrigerator-app.matter | 2 +- examples/rvc-app/rvc-common/rvc-app.matter | 2 +- .../smoke-co-alarm-app.matter | 2 +- .../temperature-measurement.matter | 2 +- .../nxp/zap/thermostat_matter_thread.matter | 2 +- .../nxp/zap/thermostat_matter_wifi.matter | 2 +- .../qpg/zap/thermostaticRadiatorValve.matter | 2 +- .../thermostat-common/thermostat.matter | 2 +- examples/tv-app/tv-common/tv-app.matter | 2 +- .../tv-casting-common/tv-casting-app.matter | 2 +- .../virtual-device-app.matter | 2 +- examples/window-app/common/window-app.matter | 2 +- .../chip/basic-information-cluster.xml | 2 +- .../chip/bridged-device-basic-information.xml | 2 +- .../data_model/controller-clusters.matter | 4 +- .../clusters/BasicInformationCluster.kt | 18 ++---- .../BridgedDeviceBasicInformationCluster.kt | 18 ++---- .../python/chip/clusters/Objects.py | 16 ++--- 104 files changed, 349 insertions(+), 148 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter index a43824252c78c1..7dd6e1762ce1c7 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter index d3ecbc8e36075b..1191c5f55c0c67 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index c4636b60e07b9b..fb634514fc9802 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -820,7 +820,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 707e74cf1fa87c..19eb0d0b954746 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -713,7 +713,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -5983,6 +5983,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 0f9b7495212b56..090dda6a70e2e5 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -19,18 +19,18 @@ "package": [ { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/zcl/zcl.json", - "type": "zcl-properties", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", "category": "matter", - "version": 1, - "description": "Matter SDK ZCL data" + "version": "chip-v1" }, { "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", + "path": "../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", "category": "matter", - "version": "chip-v1" + "version": 1, + "description": "Matter SDK ZCL data" } ], "endpointTypes": [ @@ -900,6 +900,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, @@ -9049,6 +9065,14 @@ "isIncoming": 1, "isEnabled": 1 }, + { + "name": "StringEchoResponse", + "code": 13, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, { "name": "TestEnumsRequest", "code": 14, @@ -9122,32 +9146,24 @@ "isEnabled": 1 }, { - "name": "TestDifferentVendorMeiRequest", - "code": 4294049962, + "name": "StringEchoRequest", + "code": 24, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "TestDifferentVendorMeiResponse", - "code": 4294049979, - "mfgCode": null, - "source": "server", - "isIncoming": 0, - "isEnabled": 1 - }, - { - "name": "StringEchoRequest", - "code": 24, + "name": "TestDifferentVendorMeiRequest", + "code": 4294049962, "mfgCode": null, "source": "client", "isIncoming": 1, "isEnabled": 1 }, { - "name": "StringEchoResponse", - "code": 13, + "name": "TestDifferentVendorMeiResponse", + "code": 4294049979, "mfgCode": null, "source": "server", "isIncoming": 0, diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index ec5d045647a4bd..3600cfdcc740cb 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -711,7 +711,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index 372503cef8bad1..b5922f3082632b 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter index 95a5ebba08d8e5..7d9b2a51326aa1 100644 --- a/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter +++ b/examples/chef/devices/rootnode_airpurifier_73a6fe2651.matter @@ -313,7 +313,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter index ace9e7a92793d2..d85bd9fa866873 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter index 2dab6c7a1a71df..bac48320116f79 100644 --- a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter +++ b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter index b1fa4a5e38adb3..319b6b25104be0 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.matter @@ -438,7 +438,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index 3a4ed13ea40f55..66aa1eabaab2c8 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter index 46f2f9de05ba19..49df10bf2cd3aa 100644 --- a/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter +++ b/examples/chef/devices/rootnode_contactsensor_27f76aeaf5.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index 8855108dbd76ec..37d2d4554e7156 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index a44ffef19ce24b..dcc7f2724d5b03 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter index 95ccd3897c1e6f..9d51e5c047e8cf 100644 --- a/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter +++ b/examples/chef/devices/rootnode_dimmablepluginunit_f8a9a0b9d4.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter index 4bbbf1e7545e71..e0587dbd481463 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter index e2ca298b2d9e77..3b4feb2216aa0e 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index fdd3a420d0da1c..4f81dc1f1a4580 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index bb1d31727454b2..c98aa70af8f82e 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter index a0eb473709e253..e46fa09b3111fb 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter index bd71d94f7c871b..1c58822f13aa71 100644 --- a/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter +++ b/examples/chef/devices/rootnode_genericswitch_2dfff6e516.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter index 4088d0b741a03e..58eb58d22deb9f 100644 --- a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter +++ b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 20f10bcaaa3a86..8bf334f5d7c66d 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter index 2a7cb52cd353a8..23a9bc8a578a95 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter index 4c8b7a266357b3..4b4762ce78bb46 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter index 4e4a814a012e49..7e744cafc5409c 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index 778bb2daa5e0b6..4406f572f99dfb 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter index edfcf8f75c58f8..68956182340faf 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_onofflight_samplemei.matter b/examples/chef/devices/rootnode_onofflight_samplemei.matter index d0f453f5b7b15b..242a210ecf0f4c 100644 --- a/examples/chef/devices/rootnode_onofflight_samplemei.matter +++ b/examples/chef/devices/rootnode_onofflight_samplemei.matter @@ -536,7 +536,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter index 3be01f97735caf..bf818da2a37cb9 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter @@ -483,7 +483,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter index 810bd5ae92d7a1..37ab328bad6886 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter @@ -411,7 +411,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index e2acfce11f40ba..83b7eba578d8b0 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.matter b/examples/chef/devices/rootnode_pump_5f904818cc.matter index 39092cebbc1673..89a69529465401 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.matter +++ b/examples/chef/devices/rootnode_pump_5f904818cc.matter @@ -313,7 +313,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1271,6 +1271,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.zap b/examples/chef/devices/rootnode_pump_5f904818cc.zap index c93cf13214ca17..ca8e1ad91d30fc 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.zap +++ b/examples/chef/devices/rootnode_pump_5f904818cc.zap @@ -569,6 +569,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.matter b/examples/chef/devices/rootnode_pump_a811bb33a0.matter index 9c465891d3343d..c748c1ed56cd84 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.matter +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.matter @@ -313,7 +313,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1214,6 +1214,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.zap b/examples/chef/devices/rootnode_pump_a811bb33a0.zap index 6a68b8566319b4..ad107294293b67 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.zap +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.zap @@ -569,6 +569,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter index 27f4165cbb8140..b8664ec2e38a0b 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter index 97cd5c65913b70..eaf2ff0d0dd339 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter index 6c37c883be1909..3d730b7474395e 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.matter @@ -390,7 +390,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter index 288b76c6d48dc0..60b79acd4c07b9 100644 --- a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter +++ b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter index 6245e0efca2cfe..b1e4870d7ccffb 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter @@ -459,7 +459,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter index b3fe19b27c738a..51eb8ddd45a282 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index f76b5208c97ceb..2ee66aec3362e1 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index a274c36636594a..f69d11d92bd19a 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter index 9b1e4ba906ea19..03b8cdf10bc55c 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter index 9bffee1c83dce2..47f4845661fd74 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1452,6 +1452,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap index 90183a0e214f94..7cba96b7f511d6 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap @@ -553,6 +553,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter index 70cae9e994c4fd..d44ca7ddd07d4b 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1452,6 +1452,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap index c8607e299d782c..3caa58a4d7f042 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap @@ -553,6 +553,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter index eb98a004051f5c..db68c2ddea702d 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.matter @@ -339,7 +339,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.matter b/examples/energy-management-app/energy-management-common/energy-management-app.matter index a5c23df3301be4..3035f377a13475 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.matter +++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1993,6 +1993,7 @@ endpoint 0 { callback attribute softwareVersion; callback attribute softwareVersionString; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.zap b/examples/energy-management-app/energy-management-common/energy-management-app.zap index 57ae22f51c9aab..597247dbc6998c 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.zap +++ b/examples/energy-management-app/energy-management-common/energy-management-app.zap @@ -617,6 +617,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter index 394a724877a8ea..7f3de425528f64 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.matter @@ -316,7 +316,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter index c59228b7e12612..727e4c3b097302 100644 --- a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter +++ b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.matter @@ -411,7 +411,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index 1380e672e747b2..dbc415a9f76771 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -461,7 +461,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter index f42b1f07744809..1965ae66663150 100644 --- a/examples/light-switch-app/qpg/zap/switch.matter +++ b/examples/light-switch-app/qpg/zap/switch.matter @@ -586,7 +586,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter index 047dda758dc373..e9fbd295547920 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter index 1f0428c061de3e..312e1d244992eb 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter index 676295ad2892f9..bd6285c06f472e 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 4be0b2c2529409..bf90ec6343f364 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.matter b/examples/lighting-app/nxp/zap/lighting-on-off.matter index 4e79aafcef7495..504b4618b4c124 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.matter +++ b/examples/lighting-app/nxp/zap/lighting-on-off.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1562,6 +1562,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.zap b/examples/lighting-app/nxp/zap/lighting-on-off.zap index 2e01bf3d298255..beccb5480ca340 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.zap +++ b/examples/lighting-app/nxp/zap/lighting-on-off.zap @@ -489,6 +489,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/lighting-app/qpg/zap/light.matter b/examples/lighting-app/qpg/zap/light.matter index f2d62f56d5f6c0..f0624ae0a83f48 100644 --- a/examples/lighting-app/qpg/zap/light.matter +++ b/examples/lighting-app/qpg/zap/light.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index a3d394e217e8ab..064f69b601374c 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter index 3d2e7083c3d541..3f04c35e57d154 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter @@ -515,7 +515,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter index 79f26232c3a727..ec9f0764564372 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1561,6 +1561,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap index cd8e9083ef2f4b..ba855b3908feae 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap @@ -702,6 +702,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index a484b095516dc6..d53a80f7402b1c 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/lock-app/nxp/zap/lock-app.matter b/examples/lock-app/nxp/zap/lock-app.matter index a8c73faab0fc20..cef586575e2bb3 100644 --- a/examples/lock-app/nxp/zap/lock-app.matter +++ b/examples/lock-app/nxp/zap/lock-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1784,6 +1784,7 @@ endpoint 0 { callback attribute hardwareVersionString; callback attribute softwareVersion; callback attribute softwareVersionString; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/lock-app/nxp/zap/lock-app.zap b/examples/lock-app/nxp/zap/lock-app.zap index abf9d2e6bf2a6c..ff1ead7297c757 100644 --- a/examples/lock-app/nxp/zap/lock-app.zap +++ b/examples/lock-app/nxp/zap/lock-app.zap @@ -489,6 +489,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/lock-app/qpg/zap/lock.matter b/examples/lock-app/qpg/zap/lock.matter index a8628316139252..a935c4e7ce3c17 100644 --- a/examples/lock-app/qpg/zap/lock.matter +++ b/examples/lock-app/qpg/zap/lock.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter index 997f99aa2136b6..c50956a64841c2 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.matter b/examples/network-manager-app/network-manager-common/network-manager-app.matter index 641d45571e1216..bee7b9d2df4c61 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.matter +++ b/examples/network-manager-app/network-manager-common/network-manager-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter index ebb9f79e7b2009..17c6e8fb8dbea3 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.matter @@ -266,7 +266,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index 9e0b0c61ea0704..f3eadf7c9db5d2 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -390,7 +390,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index c4141255ad55f3..f8663f2cf3da08 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -939,7 +939,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2353,7 +2353,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<64> productLabel = 14; readonly attribute optional char_string<32> serialNumber = 15; readonly attribute boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index e5a389e2e4813d..22ba33760fc585 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -939,7 +939,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2310,7 +2310,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<64> productLabel = 14; readonly attribute optional char_string<32> serialNumber = 15; readonly attribute boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index fa81bdc7452213..dc18d83cc89bc3 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -459,7 +459,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1721,6 +1721,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/pump-app/pump-common/pump-app.zap b/examples/pump-app/pump-common/pump-app.zap index cf2045a9d88ca9..c456f068835755 100644 --- a/examples/pump-app/pump-common/pump-app.zap +++ b/examples/pump-app/pump-common/pump-app.zap @@ -665,6 +665,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.matter b/examples/pump-app/silabs/data_model/pump-thread-app.matter index 42f463b17e256e..864ba8cef14e27 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.matter +++ b/examples/pump-app/silabs/data_model/pump-thread-app.matter @@ -459,7 +459,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1721,6 +1721,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.zap b/examples/pump-app/silabs/data_model/pump-thread-app.zap index 411699e5e59f33..c338b8de8155af 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.zap +++ b/examples/pump-app/silabs/data_model/pump-thread-app.zap @@ -665,6 +665,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.matter b/examples/pump-app/silabs/data_model/pump-wifi-app.matter index 42f463b17e256e..864ba8cef14e27 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.matter +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.matter @@ -459,7 +459,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1721,6 +1721,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.zap b/examples/pump-app/silabs/data_model/pump-wifi-app.zap index 411699e5e59f33..c338b8de8155af 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.zap +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.zap @@ -665,6 +665,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 57e2e9846e2c6d..b23e832c0d7d88 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -334,7 +334,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -1536,6 +1536,7 @@ endpoint 0 { callback attribute productURL; callback attribute productLabel; callback attribute serialNumber; + callback attribute uniqueID; callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap index 7b71c3e3116090..168ddcd01592a5 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap @@ -665,6 +665,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UniqueID", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "CapabilityMinima", "code": 19, diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter index 46545497d2a146..685893ec111f89 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.matter @@ -191,7 +191,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index 20faad7d18d333..3c9ef5e4d817c1 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -241,7 +241,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter index 9ed425b817255d..ceb5b931a22b69 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter index 6c95f5022ef2c8..ea8faa4892d428 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.matter @@ -191,7 +191,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index 0d702b5e3e291d..1ea6115cc9e85f 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -389,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 3db5e3fc306e4c..e0c7ca67a73518 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -389,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter index ff8ca04ecd4a89..775b1d38bbb160 100644 --- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter +++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter @@ -389,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter index 039eda02a21854..3268c9aa5263cb 100644 --- a/examples/thermostat/thermostat-common/thermostat.matter +++ b/examples/thermostat/thermostat-common/thermostat.matter @@ -389,7 +389,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index e7ed8d2996728e..998cac0791b12c 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -430,7 +430,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index d4064ec1dccc64..e58845e4f8823b 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -590,7 +590,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter index 0de556963e6953..b6b1aac3565ed0 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.matter @@ -411,7 +411,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter index f39cb7187446bc..a313e96e0a94c6 100644 --- a/examples/window-app/common/window-app.matter +++ b/examples/window-app/common/window-app.matter @@ -318,7 +318,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; diff --git a/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml index a9c0f7f620e42a..7f6320a5880dc9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/basic-information-cluster.xml @@ -104,7 +104,7 @@ limitations under the License. Reachable - UniqueID + UniqueID CapabilityMinima ProductAppearance SpecificationVersion diff --git a/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml b/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml index 3c4499d6d7a28e..702ea8754795b1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml +++ b/src/app/zap-templates/zcl/data-model/chip/bridged-device-basic-information.xml @@ -85,7 +85,7 @@ limitations under the License. ProductLabel SerialNumber Reachable - UniqueID + UniqueID ProductAppearance diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 42771c75bf41f2..961ac180ef36a3 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -760,7 +760,7 @@ cluster BasicInformation = 40 { readonly attribute optional char_string<32> serialNumber = 15; attribute access(write: manage) optional boolean localConfigDisabled = 16; readonly attribute optional boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute int32u specificationVersion = 21; @@ -2258,7 +2258,7 @@ cluster BridgedDeviceBasicInformation = 57 { readonly attribute optional char_string<64> productLabel = 14; readonly attribute optional char_string<32> serialNumber = 15; readonly attribute boolean reachable = 17; - readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute char_string<32> uniqueID = 18; readonly attribute optional ProductAppearanceStruct productAppearance = 20; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt index b3ca847f528a3c..e60bab759236b3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/BasicInformationCluster.kt @@ -1792,7 +1792,7 @@ class BasicInformationCluster( } } - suspend fun readUniqueIDAttribute(): String? { + suspend fun readUniqueIDAttribute(): String { val ATTRIBUTE_ID: UInt = 18u val attributePath = @@ -1818,12 +1818,7 @@ class BasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) return decodedValue } @@ -1867,14 +1862,9 @@ class BasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) - decodedValue?.let { emit(StringSubscriptionState.Success(it)) } + emit(StringSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { emit(StringSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt index 905c46fb0adb17..73f0502017eee1 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/BridgedDeviceBasicInformationCluster.kt @@ -1411,7 +1411,7 @@ class BridgedDeviceBasicInformationCluster( } } - suspend fun readUniqueIDAttribute(): String? { + suspend fun readUniqueIDAttribute(): String { val ATTRIBUTE_ID: UInt = 18u val attributePath = @@ -1437,12 +1437,7 @@ class BridgedDeviceBasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) return decodedValue } @@ -1486,14 +1481,9 @@ class BridgedDeviceBasicInformationCluster( // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: String? = - if (tlvReader.isNextTag(AnonymousTag)) { - tlvReader.getString(AnonymousTag) - } else { - null - } + val decodedValue: String = tlvReader.getString(AnonymousTag) - decodedValue?.let { emit(StringSubscriptionState.Success(it)) } + emit(StringSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { emit(StringSubscriptionState.SubscriptionEstablished) diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 9a6c6a55a7f420..de7708f8bcb318 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -3411,7 +3411,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="serialNumber", Tag=0x0000000F, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="localConfigDisabled", Tag=0x00000010, Type=typing.Optional[bool]), ClusterObjectFieldDescriptor(Label="reachable", Tag=0x00000011, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=str), ClusterObjectFieldDescriptor(Label="capabilityMinima", Tag=0x00000013, Type=BasicInformation.Structs.CapabilityMinimaStruct), ClusterObjectFieldDescriptor(Label="productAppearance", Tag=0x00000014, Type=typing.Optional[BasicInformation.Structs.ProductAppearanceStruct]), ClusterObjectFieldDescriptor(Label="specificationVersion", Tag=0x00000015, Type=uint), @@ -3442,7 +3442,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: serialNumber: 'typing.Optional[str]' = None localConfigDisabled: 'typing.Optional[bool]' = None reachable: 'typing.Optional[bool]' = None - uniqueID: 'typing.Optional[str]' = None + uniqueID: 'str' = None capabilityMinima: 'BasicInformation.Structs.CapabilityMinimaStruct' = None productAppearance: 'typing.Optional[BasicInformation.Structs.ProductAppearanceStruct]' = None specificationVersion: 'uint' = None @@ -3838,9 +3838,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[str]) + return ClusterObjectFieldDescriptor(Type=str) - value: 'typing.Optional[str]' = None + value: 'str' = "" @dataclass class CapabilityMinima(ClusterAttributeDescriptor): @@ -11350,7 +11350,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="productLabel", Tag=0x0000000E, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="serialNumber", Tag=0x0000000F, Type=typing.Optional[str]), ClusterObjectFieldDescriptor(Label="reachable", Tag=0x00000011, Type=bool), - ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=typing.Optional[str]), + ClusterObjectFieldDescriptor(Label="uniqueID", Tag=0x00000012, Type=str), ClusterObjectFieldDescriptor(Label="productAppearance", Tag=0x00000014, Type=typing.Optional[BridgedDeviceBasicInformation.Structs.ProductAppearanceStruct]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), @@ -11374,7 +11374,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: productLabel: 'typing.Optional[str]' = None serialNumber: 'typing.Optional[str]' = None reachable: 'bool' = None - uniqueID: 'typing.Optional[str]' = None + uniqueID: 'str' = None productAppearance: 'typing.Optional[BridgedDeviceBasicInformation.Structs.ProductAppearanceStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None @@ -11676,9 +11676,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[str]) + return ClusterObjectFieldDescriptor(Type=str) - value: 'typing.Optional[str]' = None + value: 'str' = "" @dataclass class ProductAppearance(ClusterAttributeDescriptor):