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 43260d5ecc2f04..eefb773e8c4683 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 @@ -2607,6 +2607,8 @@ server cluster TestCluster = 1295 { readonly attribute LONG_OCTET_STRING listLongOctetString[] = 42; readonly attribute TestFabricScoped listFabricScoped[] = 43; attribute boolean timedWriteBoolean = 48; + attribute boolean generalErrorBoolean = 49; + attribute boolean clusterErrorBoolean = 50; attribute nullable boolean nullableBoolean = 32768; attribute nullable bitmap8 nullableBitmap8 = 32769; attribute nullable bitmap16 nullableBitmap16 = 32770; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index f6a66b319e1f8a..127bb9c5c7c210 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1718,7 +1718,7 @@ "reportableChange": 0 }, { - "name": "CalendarType", + "name": "ActiveCalendarType", "code": 1, "mfgCode": null, "side": "server", @@ -16549,6 +16549,36 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "general_error_boolean", + "code": 49, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "cluster_error_boolean", + "code": 50, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "unsupported", "code": 255, @@ -17069,7 +17099,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -17084,7 +17114,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -20465,5 +20495,6 @@ "endpointVersion": 1, "deviceIdentifier": 256 } - ] -} + ], + "log": [] +} \ No newline at end of file diff --git a/src/app/MessageDef/AttributeReportIBs.cpp b/src/app/MessageDef/AttributeReportIBs.cpp index 5d626f7e5361ae..ef23d39c5895a7 100644 --- a/src/app/MessageDef/AttributeReportIBs.cpp +++ b/src/app/MessageDef/AttributeReportIBs.cpp @@ -96,5 +96,29 @@ AttributeReportIBs::Builder & AttributeReportIBs::Builder::EndOfAttributeReportI EndOfContainer(); return *this; } + +CHIP_ERROR AttributeReportIBs::Builder::EncodeAttributeStatus(const ConcreteReadAttributePath & aPath, const StatusIB & aStatus) +{ + AttributeReportIB::Builder & attributeReport = CreateAttributeReport(); + ReturnErrorOnFailure(GetError()); + AttributeStatusIB::Builder & attributeStatusIBBuilder = attributeReport.CreateAttributeStatus(); + ReturnErrorOnFailure(attributeReport.GetError()); + AttributePathIB::Builder & attributePathIBBuilder = attributeStatusIBBuilder.CreatePath(); + ReturnErrorOnFailure(attributeStatusIBBuilder.GetError()); + + attributePathIBBuilder.Endpoint(aPath.mEndpointId) + .Cluster(aPath.mClusterId) + .Attribute(aPath.mAttributeId) + .EndOfAttributePathIB(); + ReturnErrorOnFailure(attributePathIBBuilder.GetError()); + StatusIB::Builder & statusIBBuilder = attributeStatusIBBuilder.CreateErrorStatus(); + ReturnErrorOnFailure(attributeStatusIBBuilder.GetError()); + statusIBBuilder.EncodeStatusIB(aStatus); + ReturnErrorOnFailure(statusIBBuilder.GetError()); + + ReturnErrorOnFailure(attributeStatusIBBuilder.EndOfAttributeStatusIB().GetError()); + return attributeReport.EndOfAttributeReportIB().GetError(); +} + } // namespace app } // namespace chip diff --git a/src/app/MessageDef/AttributeReportIBs.h b/src/app/MessageDef/AttributeReportIBs.h index 3f241cedfb798f..16baa7b9ed3c5c 100644 --- a/src/app/MessageDef/AttributeReportIBs.h +++ b/src/app/MessageDef/AttributeReportIBs.h @@ -28,6 +28,8 @@ #include "AttributeReportIB.h" #include +#include +#include #include #include #include @@ -77,6 +79,11 @@ class Builder : public ArrayBuilder */ AttributeReportIBs::Builder & EndOfAttributeReportIBs(); + /** + * Encode an AttributeReportIB containing an AttributeStatus. + */ + CHIP_ERROR EncodeAttributeStatus(const ConcreteReadAttributePath & aPath, const StatusIB & aStatus); + private: AttributeReportIB::Builder mAttributeReport; }; diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index 209246c68e9f62..357b99341f4921 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -173,7 +173,14 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData const ConcreteAttributePath concretePath = ConcreteAttributePath(clusterInfo.mEndpointId, clusterInfo.mClusterId, clusterInfo.mAttributeId); MatterPreAttributeWriteCallback(concretePath); + TLV::TLVWriter backup; + mWriteResponseBuilder.Checkpoint(backup); err = WriteSingleClusterData(subjectDescriptor, clusterInfo, dataReader, this); + if (err != CHIP_NO_ERROR) + { + mWriteResponseBuilder.Rollback(backup); + err = AddStatus(concretePath, StatusIB(err)); + } MatterPostAttributeWriteCallback(concretePath); } SuccessOrExit(err); @@ -253,8 +260,12 @@ Status WriteHandler::ProcessWriteRequest(System::PacketBufferHandle && aPayload, return status; } -CHIP_ERROR WriteHandler::AddStatus(const AttributePathParams & aAttributePathParams, - const Protocols::InteractionModel::Status aStatus) +CHIP_ERROR WriteHandler::AddStatus(const ConcreteAttributePath & aPath, const Protocols::InteractionModel::Status aStatus) +{ + return AddStatus(aPath, StatusIB(aStatus)); +} + +CHIP_ERROR WriteHandler::AddStatus(const ConcreteAttributePath & aPath, const StatusIB & aStatus) { AttributeStatusIBs::Builder & writeResponses = mWriteResponseBuilder.GetWriteResponses(); AttributeStatusIB::Builder & attributeStatusIB = writeResponses.CreateAttributeStatus(); @@ -262,13 +273,11 @@ CHIP_ERROR WriteHandler::AddStatus(const AttributePathParams & aAttributePathPar AttributePathIB::Builder & path = attributeStatusIB.CreatePath(); ReturnErrorOnFailure(attributeStatusIB.GetError()); - ReturnErrorOnFailure(path.Encode(aAttributePathParams)); + ReturnErrorOnFailure(path.Encode(AttributePathParams(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId))); - StatusIB statusIB; - statusIB.mStatus = aStatus; StatusIB::Builder & statusIBBuilder = attributeStatusIB.CreateErrorStatus(); ReturnErrorOnFailure(attributeStatusIB.GetError()); - statusIBBuilder.EncodeStatusIB(statusIB); + statusIBBuilder.EncodeStatusIB(aStatus); ReturnErrorOnFailure(statusIBBuilder.GetError()); attributeStatusIB.EndOfAttributeStatusIB(); ReturnErrorOnFailure(attributeStatusIB.GetError()); diff --git a/src/app/WriteHandler.h b/src/app/WriteHandler.h index b6c838641f8b87..1f8b1629d215dc 100644 --- a/src/app/WriteHandler.h +++ b/src/app/WriteHandler.h @@ -75,7 +75,8 @@ class WriteHandler CHIP_ERROR ProcessAttributeDataIBs(TLV::TLVReader & aAttributeDataIBsReader); - CHIP_ERROR AddStatus(const AttributePathParams & aAttributePathParams, const Protocols::InteractionModel::Status aStatus); + CHIP_ERROR AddStatus(const ConcreteAttributePath & aPath, const Protocols::InteractionModel::Status aStatus); + CHIP_ERROR AddStatus(const ConcreteAttributePath & aPath, const StatusIB & aStatus); CHIP_ERROR AddClusterSpecificSuccess(const AttributePathParams & aAttributePathParams, uint8_t aClusterStatus) { diff --git a/src/app/clusters/test-cluster-server/test-cluster-server.cpp b/src/app/clusters/test-cluster-server/test-cluster-server.cpp index 5281598cf27309..4f39351ede060f 100644 --- a/src/app/clusters/test-cluster-server/test-cluster-server.cpp +++ b/src/app/clusters/test-cluster-server/test-cluster-server.cpp @@ -134,6 +134,12 @@ CHIP_ERROR TestAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attribu case NullableStruct::Id: { return ReadNullableStruct(aEncoder); } + case GeneralErrorBoolean::Id: { + return StatusIB(Protocols::InteractionModel::Status::InvalidDataType).ToChipError(); + } + case ClusterErrorBoolean::Id: { + return StatusIB(Protocols::InteractionModel::Status::Failure, 17).ToChipError(); + } default: { break; } @@ -164,6 +170,12 @@ CHIP_ERROR TestAttrAccess::Write(const ConcreteDataAttributePath & aPath, Attrib case NullableStruct::Id: { return WriteNullableStruct(aDecoder); } + case GeneralErrorBoolean::Id: { + return StatusIB(Protocols::InteractionModel::Status::InvalidDataType).ToChipError(); + } + case ClusterErrorBoolean::Id: { + return StatusIB(Protocols::InteractionModel::Status::Failure, 17).ToChipError(); + } default: { break; } diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index c28ef733332ea2..063fb8d27f8904 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -126,7 +126,7 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu "Error retrieving data from clusterId: " ChipLogFormatMEI ", err = %" CHIP_ERROR_FORMAT, ChipLogValueMEI(pathForRetrieval.mClusterId), err.Format()); - if (encodeState.AllowPartialData()) + if (encodeState.AllowPartialData() && ((err == CHIP_ERROR_BUFFER_TOO_SMALL) || (err == CHIP_ERROR_NO_MEMORY))) { // Encoding is aborted but partial data is allowed, then we don't rollback and save the state for next chunk. apReadHandler->SetAttributeEncodeState(encodeState); @@ -137,6 +137,14 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu // attributeReportIB to avoid any partial data. attributeReportIBs.Rollback(attributeBackup); apReadHandler->SetAttributeEncodeState(AttributeValueEncoder::AttributeEncodeState()); + + // Try to encode our error as a status response. + err = attributeReportIBs.EncodeAttributeStatus(pathForRetrieval, StatusIB(err)); + if (err != CHIP_NO_ERROR) + { + // OK, just roll back again and give up. + attributeReportIBs.Rollback(attributeBackup); + } } } SuccessOrExit(err); diff --git a/src/app/tests/TestWriteInteraction.cpp b/src/app/tests/TestWriteInteraction.cpp index 0f87a42cddcb09..3b13a9ae7e8e88 100644 --- a/src/app/tests/TestWriteInteraction.cpp +++ b/src/app/tests/TestWriteInteraction.cpp @@ -107,12 +107,9 @@ void TestWriteInteraction::AddAttributeDataIB(nlTestSuite * apSuite, void * apCo void TestWriteInteraction::AddAttributeStatus(nlTestSuite * apSuite, void * apContext, WriteHandler & aWriteHandler) { CHIP_ERROR err = CHIP_NO_ERROR; - AttributePathParams attributePathParams; - attributePathParams.mEndpointId = 2; - attributePathParams.mClusterId = 3; - attributePathParams.mAttributeId = 4; + ConcreteAttributePath attributePath(2, 3, 4); - err = aWriteHandler.AddStatus(attributePathParams, Protocols::InteractionModel::Status::Success); + err = aWriteHandler.AddStatus(attributePath, Protocols::InteractionModel::Status::Success); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } @@ -310,7 +307,7 @@ CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDesc writer.CopyElement(TLV::AnonymousTag(), aReader); attributeDataTLVLen = writer.GetLengthWritten(); return aWriteHandler->AddStatus( - AttributePathParams(aClusterInfo.mEndpointId, aClusterInfo.mClusterId, aClusterInfo.mAttributeId), + ConcreteAttributePath(aClusterInfo.mEndpointId, aClusterInfo.mClusterId, aClusterInfo.mAttributeId), Protocols::InteractionModel::Status::Success); } diff --git a/src/app/tests/integration/chip_im_responder.cpp b/src/app/tests/integration/chip_im_responder.cpp index e615b5a2d3bbfa..aeacfba944d004 100644 --- a/src/app/tests/integration/chip_im_responder.cpp +++ b/src/app/tests/integration/chip_im_responder.cpp @@ -118,11 +118,8 @@ CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDesc TLV::TLVReader & aReader, WriteHandler * apWriteHandler) { CHIP_ERROR err = CHIP_NO_ERROR; - AttributePathParams attributePathParams; - attributePathParams.mEndpointId = 2; - attributePathParams.mClusterId = 3; - attributePathParams.mAttributeId = 4; - err = apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::Success); + ConcreteAttributePath attributePath(2, 3, 4); + err = apWriteHandler->AddStatus(attributePath, Protocols::InteractionModel::Status::Success); return err; } } // namespace app diff --git a/src/app/tests/suites/TestCluster.yaml b/src/app/tests/suites/TestCluster.yaml index 290a243d75f630..4fbb5cfbedd186 100644 --- a/src/app/tests/suites/TestCluster.yaml +++ b/src/app/tests/suites/TestCluster.yaml @@ -3709,3 +3709,35 @@ tests: attribute: "nullable_range_restricted_int16s" response: value: null + + - label: "Write attribute that returns general status on write" + command: "writeAttribute" + attribute: "general_error_boolean" + arguments: + value: false + response: + error: INVALID_DATA_TYPE + + - label: "Write attribute that returns cluster-specific status on write" + command: "writeAttribute" + attribute: "cluster_error_boolean" + arguments: + value: false + response: + # TODO: We don't have a way to represent cluster-specific status + # here yet. + error: FAILURE + + - label: "Read attribute that returns general status on read" + command: "readAttribute" + attribute: "general_error_boolean" + response: + error: INVALID_DATA_TYPE + + - label: "read attribute that returns cluster-specific status on read" + command: "readAttribute" + attribute: "cluster_error_boolean" + response: + # TODO: We don't have a way to represent cluster-specific status + # here yet. + error: FAILURE diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index 45494a42aed398..35fac665d0e523 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -254,30 +254,14 @@ CHIP_ERROR SendSuccessStatus(AttributeReportIB::Builder & aAttributeReport, Attr return aAttributeReport.EndOfAttributeReportIB().GetError(); } -CHIP_ERROR SendFailureStatus(const ConcreteAttributePath & aPath, AttributeReportIB::Builder & aAttributeReport, +CHIP_ERROR SendFailureStatus(const ConcreteAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, Protocols::InteractionModel::Status aStatus, TLV::TLVWriter * aReportCheckpoint) { if (aReportCheckpoint != nullptr) { - aAttributeReport.Rollback(*aReportCheckpoint); + aAttributeReports.Rollback(*aReportCheckpoint); } - AttributeStatusIB::Builder & attributeStatusIBBuilder = aAttributeReport.CreateAttributeStatus(); - ReturnErrorOnFailure(aAttributeReport.GetError()); - AttributePathIB::Builder & attributePathIBBuilder = attributeStatusIBBuilder.CreatePath(); - ReturnErrorOnFailure(attributeStatusIBBuilder.GetError()); - - attributePathIBBuilder.Endpoint(aPath.mEndpointId) - .Cluster(aPath.mClusterId) - .Attribute(aPath.mAttributeId) - .EndOfAttributePathIB(); - ReturnErrorOnFailure(attributePathIBBuilder.GetError()); - StatusIB::Builder & statusIBBuilder = attributeStatusIBBuilder.CreateErrorStatus(); - ReturnErrorOnFailure(attributeStatusIBBuilder.GetError()); - statusIBBuilder.EncodeStatusIB(StatusIB(aStatus)); - ReturnErrorOnFailure(statusIBBuilder.GetError()); - - ReturnErrorOnFailure(attributeStatusIBBuilder.EndOfAttributeStatusIB().GetError()); - return aAttributeReport.EndOfAttributeReportIB().GetError(); + return aAttributeReports.EncodeAttributeStatus(aPath, StatusIB(aStatus)); } // This reader should never actually be registered; we do manual dispatch to it @@ -336,8 +320,6 @@ CHIP_ERROR ReadViaAccessInterface(FabricIndex aAccessingFabricIndex, bool aIsFab AttributeValueEncoder::AttributeEncodeState * aEncoderState, AttributeAccessInterface * aAccessInterface, bool * aTriedEncode) { - // TODO: We should probably clone the writer and convert failures here - // into status responses, unless our caller already does that. AttributeValueEncoder::AttributeEncodeState state = (aEncoderState == nullptr ? AttributeValueEncoder::AttributeEncodeState() : *aEncoderState); AttributeValueEncoder valueEncoder(aAttributeReports, aAccessingFabricIndex, aPath, kTemporaryDataVersion, aIsFabricFiltered, @@ -388,9 +370,7 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b if (attributeCluster == nullptr && attributeMetadata == nullptr) { - AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); - ReturnErrorOnFailure(aAttributeReports.GetError()); - return SendFailureStatus(aPath, attributeReport, Protocols::InteractionModel::Status::UnsupportedAttribute, nullptr); + return SendFailureStatus(aPath, aAttributeReports, Protocols::InteractionModel::Status::UnsupportedAttribute, nullptr); } // Check access control. A failed check will disallow the operation, and may or may not generate an attribute report @@ -410,9 +390,7 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b } else { - AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); - ReturnErrorOnFailure(aAttributeReports.GetError()); - return SendFailureStatus(aPath, attributeReport, Protocols::InteractionModel::Status::UnsupportedAccess, nullptr); + return SendFailureStatus(aPath, aAttributeReports, Protocols::InteractionModel::Status::UnsupportedAccess, nullptr); } } } @@ -434,12 +412,12 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b // Read attribute using Ember, if it doesn't have an override. + TLV::TLVWriter backup; + aAttributeReports.Checkpoint(backup); + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); ReturnErrorOnFailure(aAttributeReports.GetError()); - TLV::TLVWriter backup; - attributeReport.Checkpoint(backup); - AttributeDataIB::Builder & attributeDataIBBuilder = attributeReport.CreateAttributeData(); ReturnErrorOnFailure(attributeDataIBBuilder.GetError()); @@ -670,7 +648,7 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b return SendSuccessStatus(attributeReport, attributeDataIBBuilder); } - return SendFailureStatus(aPath, attributeReport, imStatus, &backup); + return SendFailureStatus(aPath, aAttributeReports, imStatus, &backup); } namespace { @@ -820,16 +798,14 @@ CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, const EmberAfAttributeMetadata * attributeMetadata = emberAfLocateAttributeMetadata(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId, CLUSTER_MASK_SERVER); - AttributePathParams attributePathParams(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId); - if (attributeMetadata == nullptr) { - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::UnsupportedAttribute); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::UnsupportedAttribute); } if (attributeMetadata->IsReadOnly()) { - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::UnsupportedWrite); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::UnsupportedWrite); } { @@ -841,13 +817,13 @@ CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, { ReturnErrorCodeIf(err != CHIP_ERROR_ACCESS_DENIED, err); // TODO: when wildcard/group writes are supported, handle them to discard rather than fail with status - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::UnsupportedAccess); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::UnsupportedAccess); } } if (attributeMetadata->MustUseTimedWrite() && !apWriteHandler->IsTimedWrite()) { - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::NeedsTimedInteraction); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::NeedsTimedInteraction); } if (auto * attrOverride = findAttributeAccessOverride(aClusterInfo.mEndpointId, aClusterInfo.mClusterId)) @@ -858,7 +834,7 @@ CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, if (valueDecoder.TriedDecode()) { MatterReportingAttributeChangeCallback(aPath); - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::Success); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::Success); } } @@ -867,19 +843,19 @@ CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, if ((preparationError = prepareWriteData(attributeMetadata, aReader, dataLen)) != CHIP_NO_ERROR) { ChipLogDetail(Zcl, "Failed to prepare data to write: %s", ErrorStr(preparationError)); - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::InvalidValue); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::InvalidValue); } if (dataLen > attributeMetadata->size) { ChipLogDetail(Zcl, "Data to write exceedes the attribute size claimed."); - return apWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::InvalidValue); + return apWriteHandler->AddStatus(aPath, Protocols::InteractionModel::Status::InvalidValue); } auto status = ToInteractionModelStatus(emberAfWriteAttributeExternal(aPath.mEndpointId, aPath.mClusterId, aPath.mAttributeId, CLUSTER_MASK_SERVER, attributeData, attributeMetadata->attributeType)); - return apWriteHandler->AddStatus(attributePathParams, status); + return apWriteHandler->AddStatus(aPath, status); } } // namespace app diff --git a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml index fb98cd3e02ad60..7730ffab49c181 100644 --- a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml @@ -153,6 +153,12 @@ limitations under the License. list_fabric_scoped timed_write_boolean + + general_error_boolean + cluster_error_boolean nullable_boolean nullable_bitmap8 diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 4dc73c46e6342c..fcb80bb3e6e29a 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2847,6 +2847,8 @@ client cluster TestCluster = 1295 { attribute int16s rangeRestrictedInt16s = 41; readonly attribute LONG_OCTET_STRING listLongOctetString[] = 42; attribute boolean timedWriteBoolean = 48; + attribute boolean generalErrorBoolean = 49; + attribute boolean clusterErrorBoolean = 50; attribute boolean unsupported = 255; attribute nullable boolean nullableBoolean = 32768; attribute nullable bitmap8 nullableBitmap8 = 32769; diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 5030da10b28f07..9cc4889125e260 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -2578,7 +2578,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "1", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2614,13 +2614,13 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "CalendarType", + "name": "ActiveCalendarType", "code": 1, "mfgCode": null, "side": "server", @@ -2629,7 +2629,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2644,7 +2644,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2659,7 +2659,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2674,7 +2674,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2689,7 +2689,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "1", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -6275,7 +6275,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -6380,7 +6380,7 @@ "singleton": 0, "bounded": 0, "defaultValue": "0", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -13618,6 +13618,21 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "list_fabric_scoped", + "code": 43, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "timed_write_boolean", "code": 48, @@ -13633,6 +13648,36 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "general_error_boolean", + "code": 49, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "cluster_error_boolean", + "code": 50, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "unsupported", "code": 255, @@ -14158,6 +14203,21 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -14420,5 +14480,6 @@ "endpointVersion": 1, "deviceIdentifier": 22 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index ac6a92e8fcc1f5..e800fac4b34e7a 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -1046,6 +1046,10 @@ typedef void (*CHIPTestClusterClusterListLongOctetStringAttributeCallbackType)( void *, const chip::app::Clusters::TestCluster::Attributes::ListLongOctetString::TypeInfo::DecodableType &); typedef void (*CHIPTestClusterClusterTimedWriteBooleanAttributeCallbackType)( void *, chip::app::Clusters::TestCluster::Attributes::TimedWriteBoolean::TypeInfo::DecodableArgType); +typedef void (*CHIPTestClusterClusterGeneralErrorBooleanAttributeCallbackType)( + void *, chip::app::Clusters::TestCluster::Attributes::GeneralErrorBoolean::TypeInfo::DecodableArgType); +typedef void (*CHIPTestClusterClusterClusterErrorBooleanAttributeCallbackType)( + void *, chip::app::Clusters::TestCluster::Attributes::ClusterErrorBoolean::TypeInfo::DecodableArgType); typedef void (*CHIPTestClusterClusterUnsupportedAttributeCallbackType)( void *, chip::app::Clusters::TestCluster::Attributes::Unsupported::TypeInfo::DecodableArgType); typedef void (*CHIPTestClusterClusterNullableBooleanAttributeCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 74ff4a49e41c95..d2ffd7ea4394ed 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -26606,6 +26606,80 @@ JNI_METHOD(void, TestClusterCluster, subscribeTimedWriteBooleanAttribute) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, subscribeGeneralErrorBooleanAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::GeneralErrorBoolean::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBooleanAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, TestClusterCluster, subscribeClusterErrorBooleanAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback, true), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ClusterErrorBoolean::TypeInfo; + auto successFn = chip::Callback::Callback::FromCancelable( + onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + err = cppCluster->SubscribeAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall, + static_cast(minInterval), static_cast(maxInterval), + CHIPBooleanAttributeCallback::OnSubscriptionEstablished); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} JNI_METHOD(void, TestClusterCluster, subscribeUnsupportedAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index a7bb6833e628a9..98facbf08d9f67 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -5476,6 +5476,110 @@ JNI_METHOD(void, TestClusterCluster, writeTimedWriteBooleanAttribute) onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, writeGeneralErrorBooleanAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::GeneralErrorBoolean::TypeInfo; + TypeInfo::Type cppValue; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, writeClusterErrorBooleanAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::ClusterErrorBoolean::TypeInfo; + TypeInfo::Type cppValue; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + + cppValue = + static_cast>(chip::JniReferences::GetInstance().BooleanToPrimitive(value)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, TestClusterCluster, writeUnsupportedAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index f1eb3dc746ad59..8e231e7b1d751e 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -13531,6 +13531,42 @@ public void subscribeTimedWriteBooleanAttribute( subscribeTimedWriteBooleanAttribute(chipClusterPtr, callback, minInterval, maxInterval); } + public void readGeneralErrorBooleanAttribute(BooleanAttributeCallback callback) { + readGeneralErrorBooleanAttribute(chipClusterPtr, callback); + } + + public void writeGeneralErrorBooleanAttribute(DefaultClusterCallback callback, Boolean value) { + writeGeneralErrorBooleanAttribute(chipClusterPtr, callback, value, null); + } + + public void writeGeneralErrorBooleanAttribute( + DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { + writeGeneralErrorBooleanAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeGeneralErrorBooleanAttribute( + BooleanAttributeCallback callback, int minInterval, int maxInterval) { + subscribeGeneralErrorBooleanAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readClusterErrorBooleanAttribute(BooleanAttributeCallback callback) { + readClusterErrorBooleanAttribute(chipClusterPtr, callback); + } + + public void writeClusterErrorBooleanAttribute(DefaultClusterCallback callback, Boolean value) { + writeClusterErrorBooleanAttribute(chipClusterPtr, callback, value, null); + } + + public void writeClusterErrorBooleanAttribute( + DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { + writeClusterErrorBooleanAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeClusterErrorBooleanAttribute( + BooleanAttributeCallback callback, int minInterval, int maxInterval) { + subscribeClusterErrorBooleanAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readUnsupportedAttribute(BooleanAttributeCallback callback) { readUnsupportedAttribute(chipClusterPtr, callback); } @@ -14671,6 +14707,30 @@ private native void writeTimedWriteBooleanAttribute( private native void subscribeTimedWriteBooleanAttribute( long chipClusterPtr, BooleanAttributeCallback callback, int minInterval, int maxInterval); + private native void readGeneralErrorBooleanAttribute( + long chipClusterPtr, BooleanAttributeCallback callback); + + private native void writeGeneralErrorBooleanAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + Boolean value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeGeneralErrorBooleanAttribute( + long chipClusterPtr, BooleanAttributeCallback callback, int minInterval, int maxInterval); + + private native void readClusterErrorBooleanAttribute( + long chipClusterPtr, BooleanAttributeCallback callback); + + private native void writeClusterErrorBooleanAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + Boolean value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeClusterErrorBooleanAttribute( + long chipClusterPtr, BooleanAttributeCallback callback, int minInterval, int maxInterval); + private native void readUnsupportedAttribute( long chipClusterPtr, BooleanAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 705f36262fdcdd..f60562d8a6603d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -5966,6 +5966,34 @@ public Map> getReadAttributeMap() { readTestClusterTimedWriteBooleanCommandParams); readTestClusterInteractionInfo.put( "readTimedWriteBooleanAttribute", readTestClusterTimedWriteBooleanAttributeInteractionInfo); + Map readTestClusterGeneralErrorBooleanCommandParams = + new LinkedHashMap(); + InteractionInfo readTestClusterGeneralErrorBooleanAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .readGeneralErrorBooleanAttribute( + (ChipClusters.BooleanAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedBooleanAttributeCallback(), + readTestClusterGeneralErrorBooleanCommandParams); + readTestClusterInteractionInfo.put( + "readGeneralErrorBooleanAttribute", + readTestClusterGeneralErrorBooleanAttributeInteractionInfo); + Map readTestClusterClusterErrorBooleanCommandParams = + new LinkedHashMap(); + InteractionInfo readTestClusterClusterErrorBooleanAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .readClusterErrorBooleanAttribute( + (ChipClusters.BooleanAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedBooleanAttributeCallback(), + readTestClusterClusterErrorBooleanCommandParams); + readTestClusterInteractionInfo.put( + "readClusterErrorBooleanAttribute", + readTestClusterClusterErrorBooleanAttributeInteractionInfo); Map readTestClusterUnsupportedCommandParams = new LinkedHashMap(); InteractionInfo readTestClusterUnsupportedAttributeInteractionInfo = diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 04df1c40eedd72..6f8a07f65c856d 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -1568,6 +1568,42 @@ public Map> getWriteAttributeMap() { writeTestClusterInteractionInfo.put( "writeTimedWriteBooleanAttribute", writeTestClusterTimedWriteBooleanAttributeInteractionInfo); + Map writeTestClusterGeneralErrorBooleanCommandParams = + new LinkedHashMap(); + CommandParameterInfo testClustergeneralErrorBooleanCommandParameterInfo = + new CommandParameterInfo("value", Boolean.class); + writeTestClusterGeneralErrorBooleanCommandParams.put( + "value", testClustergeneralErrorBooleanCommandParameterInfo); + InteractionInfo writeTestClusterGeneralErrorBooleanAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .writeGeneralErrorBooleanAttribute( + (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeTestClusterGeneralErrorBooleanCommandParams); + writeTestClusterInteractionInfo.put( + "writeGeneralErrorBooleanAttribute", + writeTestClusterGeneralErrorBooleanAttributeInteractionInfo); + Map writeTestClusterClusterErrorBooleanCommandParams = + new LinkedHashMap(); + CommandParameterInfo testClusterclusterErrorBooleanCommandParameterInfo = + new CommandParameterInfo("value", Boolean.class); + writeTestClusterClusterErrorBooleanCommandParams.put( + "value", testClusterclusterErrorBooleanCommandParameterInfo); + InteractionInfo writeTestClusterClusterErrorBooleanAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .writeClusterErrorBooleanAttribute( + (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeTestClusterClusterErrorBooleanCommandParams); + writeTestClusterInteractionInfo.put( + "writeClusterErrorBooleanAttribute", + writeTestClusterClusterErrorBooleanAttributeInteractionInfo); Map writeTestClusterUnsupportedCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterunsupportedCommandParameterInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 9eb0fce503667a..2efae0bb4d84d9 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -4502,6 +4502,20 @@ class ChipClusters: "reportable": True, "writable": True, }, + 0x00000031: { + "attributeName": "GeneralErrorBoolean", + "attributeId": 0x00000031, + "type": "bool", + "reportable": True, + "writable": True, + }, + 0x00000032: { + "attributeName": "ClusterErrorBoolean", + "attributeId": 0x00000032, + "type": "bool", + "reportable": True, + "writable": True, + }, 0x000000FF: { "attributeName": "Unsupported", "attributeId": 0x000000FF, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 50d11744eca07c..b66e5a9f8103ad 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -29821,6 +29821,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="listLongOctetString", Tag=0x0000002A, Type=typing.List[bytes]), ClusterObjectFieldDescriptor(Label="listFabricScoped", Tag=0x0000002B, Type=typing.List[TestCluster.Structs.TestFabricScoped]), ClusterObjectFieldDescriptor(Label="timedWriteBoolean", Tag=0x00000030, Type=bool), + ClusterObjectFieldDescriptor(Label="generalErrorBoolean", Tag=0x00000031, Type=bool), + ClusterObjectFieldDescriptor(Label="clusterErrorBoolean", Tag=0x00000032, Type=bool), ClusterObjectFieldDescriptor(Label="unsupported", Tag=0x000000FF, Type=bool), ClusterObjectFieldDescriptor(Label="nullableBoolean", Tag=0x00008000, Type=typing.Union[Nullable, bool]), ClusterObjectFieldDescriptor(Label="nullableBitmap8", Tag=0x00008001, Type=typing.Union[Nullable, uint]), @@ -29905,6 +29907,8 @@ def descriptor(cls) -> ClusterObjectDescriptor: listLongOctetString: 'typing.List[bytes]' = None listFabricScoped: 'typing.List[TestCluster.Structs.TestFabricScoped]' = None timedWriteBoolean: 'bool' = None + generalErrorBoolean: 'bool' = None + clusterErrorBoolean: 'bool' = None unsupported: 'bool' = None nullableBoolean: 'typing.Union[Nullable, bool]' = None nullableBitmap8: 'typing.Union[Nullable, uint]' = None @@ -31398,6 +31402,38 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'bool' = False + @dataclass + class GeneralErrorBoolean(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000031 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=bool) + + value: 'bool' = False + + @dataclass + class ClusterErrorBoolean(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x050F + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000032 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=bool) + + value: 'bool' = False + @dataclass class Unsupported(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/controller/tests/data_model/TestWrite.cpp b/src/controller/tests/data_model/TestWrite.cpp index 40ed9bb67c2b4b..274948956792f7 100644 --- a/src/controller/tests/data_model/TestWrite.cpp +++ b/src/controller/tests/data_model/TestWrite.cpp @@ -90,13 +90,13 @@ CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDesc VerifyOrReturnError(i == 4, CHIP_ERROR_INVALID_ARGUMENT); - AttributePathParams attributePathParams(aClusterInfo.mClusterId, aClusterInfo.mEndpointId, aClusterInfo.mAttributeId); - aWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::Success); + ConcreteAttributePath attributePath(aClusterInfo.mClusterId, aClusterInfo.mEndpointId, aClusterInfo.mAttributeId); + aWriteHandler->AddStatus(attributePath, Protocols::InteractionModel::Status::Success); } else { - AttributePathParams attributePathParams(aClusterInfo.mClusterId, aClusterInfo.mEndpointId, aClusterInfo.mAttributeId); - aWriteHandler->AddStatus(attributePathParams, Protocols::InteractionModel::Status::Failure); + ConcreteAttributePath attributePath(aClusterInfo.mClusterId, aClusterInfo.mEndpointId, aClusterInfo.mAttributeId); + aWriteHandler->AddStatus(attributePath, Protocols::InteractionModel::Status::Failure); } return CHIP_NO_ERROR; diff --git a/src/darwin/Framework/CHIP/CHIPError.h b/src/darwin/Framework/CHIP/CHIPError.h index 1c4c2ba5304ff1..883d38f5e83402 100644 --- a/src/darwin/Framework/CHIP/CHIPError.h +++ b/src/darwin/Framework/CHIP/CHIPError.h @@ -37,6 +37,7 @@ typedef NS_ERROR_ENUM(CHIPErrorDomain, CHIPErrorCode){ CHIPErrorCodeUnsupportedAttribute = 0x86, CHIPErrorCodeConstraintError = 0x87, CHIPErrorCodeUnsupportedWrite = 0x88, + CHIPErrorCodeInvalidDataType = 0x8D, CHIPErrorCodeUnsupportedCluster = 0xC3, }; // clang-format on diff --git a/src/darwin/Framework/CHIP/CHIPError.mm b/src/darwin/Framework/CHIP/CHIPError.mm index 47fae0d0e87d5d..776acdfe61ee5d 100644 --- a/src/darwin/Framework/CHIP/CHIPError.mm +++ b/src/darwin/Framework/CHIP/CHIPError.mm @@ -128,6 +128,11 @@ + (NSError *)errorForZCLErrorCode:(uint8_t)errorCode errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeUnsupportedWrite userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"Attempt to write read-only attribute.", nil) }]; + case EMBER_ZCL_STATUS_INVALID_DATA_TYPE: + return [NSError + errorWithDomain:CHIPErrorDomain + code:CHIPErrorCodeInvalidDataType + userInfo:@{ NSLocalizedDescriptionKey : NSLocalizedString(@"Data type is not correct for a field.", nil) }]; case EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER: return [NSError errorWithDomain:CHIPErrorDomain diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index a39953a0c5992c..33451ed2d5128a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -7131,6 +7131,28 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader value = [NSNumber numberWithBool:cppValue]; return value; } + case Attributes::GeneralErrorBoolean::Id: { + using TypeInfo = Attributes::GeneralErrorBoolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::ClusterErrorBoolean::Id: { + using TypeInfo = Attributes::ClusterErrorBoolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } case Attributes::Unsupported::Id: { using TypeInfo = Attributes::Unsupported::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 3b4e0e28db5768..0ed67303418d4c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -4336,6 +4336,26 @@ NS_ASSUME_NONNULL_BEGIN reportHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; +- (void)readAttributeGeneralErrorBooleanWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +- (void)writeAttributeGeneralErrorBooleanWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)subscribeAttributeGeneralErrorBooleanWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; + +- (void)readAttributeClusterErrorBooleanWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +- (void)writeAttributeClusterErrorBooleanWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)subscribeAttributeClusterErrorBooleanWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; + - (void)readAttributeUnsupportedWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)writeAttributeUnsupportedWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 5fdd006a010e3c..53fb76b873117c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -18866,6 +18866,102 @@ new CHIPBooleanAttributeCallbackSubscriptionBridge( subscriptionEstablishedHandler); } +- (void)readAttributeGeneralErrorBooleanWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPBooleanAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = TestCluster::Attributes::GeneralErrorBoolean::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeGeneralErrorBooleanWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = TestCluster::Attributes::GeneralErrorBoolean::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.boolValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeGeneralErrorBooleanWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPBooleanAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = TestCluster::Attributes::GeneralErrorBoolean::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + minInterval, maxInterval, CHIPBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + }, + subscriptionEstablishedHandler); +} + +- (void)readAttributeClusterErrorBooleanWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPBooleanAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = TestCluster::Attributes::ClusterErrorBoolean::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeClusterErrorBooleanWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = TestCluster::Attributes::ClusterErrorBoolean::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.boolValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeClusterErrorBooleanWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + subscriptionEstablished: + (SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPBooleanAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = TestCluster::Attributes::ClusterErrorBoolean::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + minInterval, maxInterval, CHIPBooleanAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished); + }, + subscriptionEstablishedHandler); +} + - (void)readAttributeUnsupportedWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index aee830b46e5bba..0a427ba2b96d9d 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -37010,6 +37010,87 @@ - (void)testSendClusterTestCluster_000471_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTestCluster_000472_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute that returns general status on write"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id generalErrorBooleanArgument; + generalErrorBooleanArgument = [NSNumber numberWithBool:false]; + [cluster writeAttributeGeneralErrorBooleanWithValue:generalErrorBooleanArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write attribute that returns general status on write Error: %@", err); + + XCTAssertEqual( + [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_DATA_TYPE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000473_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write attribute that returns cluster-specific status on write"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id clusterErrorBooleanArgument; + clusterErrorBooleanArgument = [NSNumber numberWithBool:false]; + [cluster writeAttributeClusterErrorBooleanWithValue:clusterErrorBooleanArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write attribute that returns cluster-specific status on write Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_FAILURE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000474_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute that returns general status on read"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGeneralErrorBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read attribute that returns general status on read Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_INVALID_DATA_TYPE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestCluster_000475_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"read attribute that returns cluster-specific status on read"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTestCluster * cluster = [[CHIPTestTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterErrorBooleanWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read attribute that returns cluster-specific status on read Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_FAILURE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTestSaveAs_000000_WaitForCommissionee { diff --git a/src/darwin/Framework/CHIPTests/CHIPErrorTestUtils.mm b/src/darwin/Framework/CHIPTests/CHIPErrorTestUtils.mm index 585a743c81dc84..a1674fcfc13810 100644 --- a/src/darwin/Framework/CHIPTests/CHIPErrorTestUtils.mm +++ b/src/darwin/Framework/CHIPTests/CHIPErrorTestUtils.mm @@ -52,6 +52,8 @@ + (uint8_t)errorToZCLErrorCode:(NSError * _Nullable)error return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; case CHIPErrorCodeUnsupportedWrite: return EMBER_ZCL_STATUS_UNSUPPORTED_WRITE; + case CHIPErrorCodeInvalidDataType: + return EMBER_ZCL_STATUS_INVALID_DATA_TYPE; case CHIPErrorCodeUnsupportedCluster: return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER; default: diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 6f22cff1c26495..4e9e49d90fc4f0 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1499,7 +1499,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 620 +#define GENERATED_ATTRIBUTE_COUNT 622 #define GENERATED_ATTRIBUTES \ { \ \ @@ -2293,6 +2293,10 @@ ZAP_EMPTY_DEFAULT() }, /* list_fabric_scoped */ \ { 0x00000030, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(MUST_USE_TIMED_WRITE), \ ZAP_EMPTY_DEFAULT() }, /* timed_write_boolean */ \ + { 0x00000031, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* general_error_boolean */ \ + { 0x00000032, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* cluster_error_boolean */ \ { 0x00008000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(false) }, /* nullable_boolean */ \ { 0x00008001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -2734,28 +2738,28 @@ 0x0000050E, ZAP_ATTRIBUTE_INDEX(510), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x0000050F, ZAP_ATTRIBUTE_INDEX(511), 79, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0000050F, ZAP_ATTRIBUTE_INDEX(511), 81, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x00000B04, ZAP_ATTRIBUTE_INDEX(590), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x00000B04, ZAP_ATTRIBUTE_INDEX(592), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ { 0x00000004, \ - ZAP_ATTRIBUTE_INDEX(602), \ + ZAP_ATTRIBUTE_INDEX(604), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 2, Cluster: Groups (server) */ \ { 0x00000006, \ - ZAP_ATTRIBUTE_INDEX(604), \ + ZAP_ATTRIBUTE_INDEX(606), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/Off (server) */ \ { \ - 0x0000001D, ZAP_ATTRIBUTE_INDEX(611), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0000001D, ZAP_ATTRIBUTE_INDEX(613), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Descriptor (server) */ \ { 0x00000406, \ - ZAP_ATTRIBUTE_INDEX(616), \ + ZAP_ATTRIBUTE_INDEX(618), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index b5c25b8a5fcf8d..cae3e77266e600 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -1504,6 +1504,8 @@ #define ZCL_LIST_LONG_OCTET_STRING_ATTRIBUTE_ID (0x002A) #define ZCL_LIST_FABRIC_SCOPED_ATTRIBUTE_ID (0x002B) #define ZCL_TIMED_WRITE_BOOLEAN_ATTRIBUTE_ID (0x0030) +#define ZCL_GENERAL_ERROR_BOOLEAN_ATTRIBUTE_ID (0x0031) +#define ZCL_CLUSTER_ERROR_BOOLEAN_ATTRIBUTE_ID (0x0032) #define ZCL_UNSUPPORTED_ATTRIBUTE_ID (0x00FF) #define ZCL_NULLABLE_BOOLEAN_ATTRIBUTE_ID (0x8000) #define ZCL_NULLABLE_BITMAP8_ATTRIBUTE_ID (0x8001) 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 0810ceddde561b..40abe2f017d48d 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 @@ -32070,6 +32070,68 @@ EmberAfStatus Set(chip::EndpointId endpoint, bool value) } // namespace TimedWriteBoolean +namespace GeneralErrorBoolean { + +EmberAfStatus Get(chip::EndpointId endpoint, bool * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, bool value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +} // namespace GeneralErrorBoolean + +namespace ClusterErrorBoolean { + +EmberAfStatus Get(chip::EndpointId endpoint, bool * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::TestCluster::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, bool value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::TestCluster::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); +} + +} // namespace ClusterErrorBoolean + namespace Unsupported { EmberAfStatus Get(chip::EndpointId endpoint, bool * 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 8a56f0319eefcf..7754bb5ab3410d 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 @@ -5651,6 +5651,16 @@ EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean EmberAfStatus Set(chip::EndpointId endpoint, bool value); } // namespace TimedWriteBoolean +namespace GeneralErrorBoolean { +EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean +EmberAfStatus Set(chip::EndpointId endpoint, bool value); +} // namespace GeneralErrorBoolean + +namespace ClusterErrorBoolean { +EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean +EmberAfStatus Set(chip::EndpointId endpoint, bool value); +} // namespace ClusterErrorBoolean + namespace Unsupported { EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean EmberAfStatus Set(chip::EndpointId endpoint, bool value); 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 dbf2ae0d1cb7d4..d462126bed1946 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 @@ -23484,6 +23484,12 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::TimedWriteBoolean::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, timedWriteBoolean)); break; + case Attributes::GeneralErrorBoolean::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, generalErrorBoolean)); + break; + case Attributes::ClusterErrorBoolean::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, clusterErrorBoolean)); + break; case Attributes::Unsupported::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, unsupported)); break; 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 7b106d73f87dad..b46c1cbef6488c 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 @@ -35559,6 +35559,30 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return true; } }; } // namespace TimedWriteBoolean +namespace GeneralErrorBoolean { +struct TypeInfo +{ + using Type = bool; + using DecodableType = bool; + using DecodableArgType = bool; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::GeneralErrorBoolean::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace GeneralErrorBoolean +namespace ClusterErrorBoolean { +struct TypeInfo +{ + using Type = bool; + using DecodableType = bool; + using DecodableArgType = bool; + + static constexpr ClusterId GetClusterId() { return Clusters::TestCluster::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ClusterErrorBoolean::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ClusterErrorBoolean namespace Unsupported { struct TypeInfo { @@ -36057,8 +36081,10 @@ struct TypeInfo Attributes::RangeRestrictedInt16s::TypeInfo::DecodableType rangeRestrictedInt16s = static_cast(0); Attributes::ListLongOctetString::TypeInfo::DecodableType listLongOctetString; Attributes::ListFabricScoped::TypeInfo::DecodableType listFabricScoped; - Attributes::TimedWriteBoolean::TypeInfo::DecodableType timedWriteBoolean = static_cast(0); - Attributes::Unsupported::TypeInfo::DecodableType unsupported = static_cast(0); + Attributes::TimedWriteBoolean::TypeInfo::DecodableType timedWriteBoolean = static_cast(0); + Attributes::GeneralErrorBoolean::TypeInfo::DecodableType generalErrorBoolean = static_cast(0); + Attributes::ClusterErrorBoolean::TypeInfo::DecodableType clusterErrorBoolean = static_cast(0); + Attributes::Unsupported::TypeInfo::DecodableType unsupported = static_cast(0); Attributes::NullableBoolean::TypeInfo::DecodableType nullableBoolean; Attributes::NullableBitmap8::TypeInfo::DecodableType nullableBitmap8; Attributes::NullableBitmap16::TypeInfo::DecodableType nullableBitmap16; 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 6db88919c598c5..81e1fe13726633 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 @@ -5280,6 +5280,14 @@ namespace TimedWriteBoolean { static constexpr AttributeId Id = 0x00000030; } // namespace TimedWriteBoolean +namespace GeneralErrorBoolean { +static constexpr AttributeId Id = 0x00000031; +} // namespace GeneralErrorBoolean + +namespace ClusterErrorBoolean { +static constexpr AttributeId Id = 0x00000032; +} // namespace ClusterErrorBoolean + namespace Unsupported { static constexpr AttributeId Id = 0x000000FF; } // namespace Unsupported diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 99435cfb2ffc72..79c2a9406a29f5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -41752,6 +41752,8 @@ class ReportTemperatureMeasurementClusterRevision : public ModelCommand | * RangeRestrictedInt16s | 0x0029 | | * ListLongOctetString | 0x002A | | * TimedWriteBoolean | 0x0030 | +| * GeneralErrorBoolean | 0x0031 | +| * ClusterErrorBoolean | 0x0032 | | * Unsupported | 0x00FF | | * NullableBoolean | 0x8000 | | * NullableBitmap8 | 0x8001 | @@ -46265,6 +46267,196 @@ class ReportTestClusterTimedWriteBoolean : public ModelCommand bool mWait; }; +/* + * Attribute GeneralErrorBoolean + */ +class ReadTestClusterGeneralErrorBoolean : public ModelCommand +{ +public: + ReadTestClusterGeneralErrorBoolean() : ModelCommand("read") + { + AddArgument("attr-name", "general-error-boolean"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterGeneralErrorBoolean() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00000031) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute( + this, OnAttributeResponse, OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, bool value) + { + OnGeneralAttributeEventResponse(context, "TestCluster.GeneralErrorBoolean response", value); + } +}; + +class WriteTestClusterGeneralErrorBoolean : public ModelCommand +{ +public: + WriteTestClusterGeneralErrorBoolean() : ModelCommand("write") + { + AddArgument("attr-name", "general-error-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterGeneralErrorBoolean() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00000031) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + bool mValue; +}; + +class ReportTestClusterGeneralErrorBoolean : public ModelCommand +{ +public: + ReportTestClusterGeneralErrorBoolean() : ModelCommand("report") + { + AddArgument("attr-name", "general-error-boolean"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterGeneralErrorBoolean() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00000031) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, bool value) { LogValue("TestCluster.GeneralErrorBoolean report", 0, value); } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + +/* + * Attribute ClusterErrorBoolean + */ +class ReadTestClusterClusterErrorBoolean : public ModelCommand +{ +public: + ReadTestClusterClusterErrorBoolean() : ModelCommand("read") + { + AddArgument("attr-name", "cluster-error-boolean"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterClusterErrorBoolean() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00000032) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute( + this, OnAttributeResponse, OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, bool value) + { + OnGeneralAttributeEventResponse(context, "TestCluster.ClusterErrorBoolean response", value); + } +}; + +class WriteTestClusterClusterErrorBoolean : public ModelCommand +{ +public: + WriteTestClusterClusterErrorBoolean() : ModelCommand("write") + { + AddArgument("attr-name", "cluster-error-boolean"); + AddArgument("attr-value", 0, 1, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterClusterErrorBoolean() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00000032) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + bool mValue; +}; + +class ReportTestClusterClusterErrorBoolean : public ModelCommand +{ +public: + ReportTestClusterClusterErrorBoolean() : ModelCommand("report") + { + AddArgument("attr-name", "cluster-error-boolean"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterClusterErrorBoolean() {} + + CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00000032) on endpoint %" PRIu16, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, bool value) { LogValue("TestCluster.ClusterErrorBoolean report", 0, value); } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute Unsupported */ @@ -62367,6 +62559,12 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index dcc177858908c9..5de673191d5bf4 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -48906,6 +48906,22 @@ class TestCluster : public TestCommand " ***** Test Step 471 : Verify nullable range-restricted signed 16-bit integer value is null\n"); err = TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsNull_471(); break; + case 472: + ChipLogProgress(chipTool, " ***** Test Step 472 : Write attribute that returns general status on write\n"); + err = TestWriteAttributeThatReturnsGeneralStatusOnWrite_472(); + break; + case 473: + ChipLogProgress(chipTool, " ***** Test Step 473 : Write attribute that returns cluster-specific status on write\n"); + err = TestWriteAttributeThatReturnsClusterSpecificStatusOnWrite_473(); + break; + case 474: + ChipLogProgress(chipTool, " ***** Test Step 474 : Read attribute that returns general status on read\n"); + err = TestReadAttributeThatReturnsGeneralStatusOnRead_474(); + break; + case 475: + ChipLogProgress(chipTool, " ***** Test Step 475 : read attribute that returns cluster-specific status on read\n"); + err = TestReadAttributeThatReturnsClusterSpecificStatusOnRead_475(); + break; } if (CHIP_NO_ERROR != err) @@ -48917,7 +48933,7 @@ class TestCluster : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 472; + const uint16_t mTestCount = 476; chip::Optional mCluster; chip::Optional mEndpoint; @@ -52787,6 +52803,40 @@ class TestCluster : public TestCommand (static_cast(context))->OnSuccessResponse_471(nullableRangeRestrictedInt16s); } + static void OnFailureCallback_472(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_472(error); + } + + static void OnSuccessCallback_472(void * context) { (static_cast(context))->OnSuccessResponse_472(); } + + static void OnFailureCallback_473(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_473(error); + } + + static void OnSuccessCallback_473(void * context) { (static_cast(context))->OnSuccessResponse_473(); } + + static void OnFailureCallback_474(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_474(error); + } + + static void OnSuccessCallback_474(void * context, bool generalErrorBoolean) + { + (static_cast(context))->OnSuccessResponse_474(generalErrorBoolean); + } + + static void OnFailureCallback_475(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_475(error); + } + + static void OnSuccessCallback_475(void * context, bool clusterErrorBoolean) + { + (static_cast(context))->OnSuccessResponse_475(clusterErrorBoolean); + } + // // Tests methods // @@ -64783,6 +64833,92 @@ class TestCluster : public TestCommand NextTest(); } + + CHIP_ERROR TestWriteAttributeThatReturnsGeneralStatusOnWrite_472() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + bool generalErrorBooleanArgument; + generalErrorBooleanArgument = false; + + ReturnErrorOnFailure(cluster.WriteAttribute( + generalErrorBooleanArgument, this, OnSuccessCallback_472, OnFailureCallback_472)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_472(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); + NextTest(); + } + + void OnSuccessResponse_472() { ThrowSuccessResponse(); } + + CHIP_ERROR TestWriteAttributeThatReturnsClusterSpecificStatusOnWrite_473() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + bool clusterErrorBooleanArgument; + clusterErrorBooleanArgument = false; + + ReturnErrorOnFailure(cluster.WriteAttribute( + clusterErrorBooleanArgument, this, OnSuccessCallback_473, OnFailureCallback_473)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_473(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + } + + void OnSuccessResponse_473() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeThatReturnsGeneralStatusOnRead_474() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_474, OnFailureCallback_474)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_474(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); + NextTest(); + } + + void OnSuccessResponse_474(bool generalErrorBoolean) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadAttributeThatReturnsClusterSpecificStatusOnRead_475() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TestClusterClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_475, OnFailureCallback_475)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_475(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + } + + void OnSuccessResponse_475(bool clusterErrorBoolean) { ThrowSuccessResponse(); } }; class TestClusterComplexTypes : public TestCommand