From 2528656e3006b6411b2bbf0ec92188daec58cc72 Mon Sep 17 00:00:00 2001 From: William Date: Tue, 6 Aug 2024 18:23:58 +0100 Subject: [PATCH] Service Area: Remove nullable qualities to match the latest spec (#34732) * Updated the golabl data type's XMLs, removing the cluster entries. * Zap generated after XML update. * Fixed namespaces used of global structs. * Restyled by clang-format * Renamed LocationInfoStruct to AreaInfoStruct. * Zap generated after XML update. * Renamed LocationStruct to AreaStruct and its LocationID and LocationDesc fields. * Zap generated after XML update. * Updated SDK and example code to match the new naming. * Updated the ProgressStruct's LocationID name to AreaID. * Zap generated after XML update. * Updated the SDK code following name changes. * Updated the SelectLocationsStatus and SkipLocationStatus enum names and some of their enums. * Zap generated after XML update. * Updated the SelectLocationsStatus and SkipCurrentLocationStatus names and their enum names. * Updated the names of the SupportedLocations, SelectedLocations and CurrentLocation attributes. * Zap generated after XML update. * Updated the changed names in the SDK. * Updated the service area command names in XML. * Zap generated after XML update. * Updated the service area command names in the SDK. * Updated the rvc-example zap file. * Refactored LocationStructureWrapper to AreaStructureWrapper. * Restyled by clang-format * Regenerated zap files due to changes upsteram. * Removed unused generated file. * Updated the Service Area XML marking previously nullabel attributes as not-nullable. * Zap generated after XML update. * Updated the attribute encoding and some server logic following the romoval of the nullable quality for some attributes. * spacing changes form zap regen. * Fixed minor mistake during merge. --------- Co-authored-by: Restyled.io --- examples/rvc-app/rvc-common/rvc-app.matter | 8 +- .../service-area-server.cpp | 21 +- .../data-model/chip/service-area-cluster.xml | 8 +- .../data_model/controller-clusters.matter | 8 +- .../chip/devicecontroller/ChipClusters.java | 24 +- .../devicecontroller/ClusterInfoMapping.java | 6 +- .../cluster/clusters/ServiceAreaCluster.kt | 126 +++----- .../CHIPAttributeTLVValueDecoder.cpp | 275 ++++++++---------- .../python/chip/clusters/Objects.py | 28 +- .../MTRAttributeTLVValueDecoder.mm | 140 ++++----- .../zap-generated/MTRCommandPayloadsObjc.h | 2 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 41 ++- .../zap-generated/cluster-objects.h | 31 +- .../zap-generated/cluster/Commands.h | 12 +- .../cluster/logging/DataModelLogger.cpp | 10 +- .../zap-generated/cluster/Commands.h | 20 +- 16 files changed, 337 insertions(+), 423 deletions(-) diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index 596fde4138576a..7a87e9e83dbe90 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -1480,11 +1480,11 @@ provisional cluster ServiceArea = 336 { } readonly attribute AreaStruct supportedAreas[] = 0; - readonly attribute nullable MapStruct supportedMaps[] = 1; - readonly attribute nullable int32u selectedAreas[] = 2; + readonly attribute MapStruct supportedMaps[] = 1; + readonly attribute int32u selectedAreas[] = 2; readonly attribute optional nullable int32u currentArea = 3; readonly attribute optional nullable epoch_s estimatedEndTime = 4; - readonly attribute optional nullable ProgressStruct progress[] = 5; + readonly attribute optional ProgressStruct progress[] = 5; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1493,7 +1493,7 @@ provisional cluster ServiceArea = 336 { readonly attribute int16u clusterRevision = 65533; request struct SelectAreasRequest { - nullable int32u newAreas[] = 0; + int32u newAreas[] = 0; } response struct SelectAreasResponse = 1 { diff --git a/src/app/clusters/service-area-server/service-area-server.cpp b/src/app/clusters/service-area-server/service-area-server.cpp index 66556acd03ea0b..fa5d626a5ab06c 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -134,7 +134,7 @@ CHIP_ERROR Instance::ReadSupportedAreas(AttributeValueEncoder & aEncoder) { if (mDelegate->GetNumberOfSupportedAreas() == 0) { - return aEncoder.EncodeNull(); + return aEncoder.EncodeEmptyList(); } return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR { @@ -153,7 +153,7 @@ CHIP_ERROR Instance::ReadSupportedMaps(AttributeValueEncoder & aEncoder) { if (mDelegate->GetNumberOfSupportedMaps() == 0) { - return aEncoder.EncodeNull(); + return aEncoder.EncodeEmptyList(); } return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR { @@ -172,7 +172,7 @@ CHIP_ERROR Instance::ReadSelectedAreas(AttributeValueEncoder & aEncoder) { if (mDelegate->GetNumberOfSelectedAreas() == 0) { - return aEncoder.EncodeNull(); + return aEncoder.EncodeEmptyList(); } return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR { @@ -191,7 +191,7 @@ CHIP_ERROR Instance::ReadProgress(AttributeValueEncoder & aEncoder) { if (mDelegate->GetNumberOfProgressElements() == 0) { - return aEncoder.EncodeNull(); + return aEncoder.EncodeEmptyList(); } return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR { @@ -224,9 +224,8 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select size_t numberOfLocations = 0; // Get the number of Selected Locations in the command parameter and check that it is valid. - if (!req.newAreas.IsNull()) { - if (CHIP_NO_ERROR != req.newAreas.Value().ComputeSize(&numberOfLocations)) + if (CHIP_NO_ERROR != req.newAreas.ComputeSize(&numberOfLocations)) { ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::InvalidCommand); return; @@ -244,14 +243,14 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select // if number of selected locations in parameter matches number in attribute - the locations *might* be the same bool matchesCurrentSelectedAreas = (numberOfLocations == mDelegate->GetNumberOfSelectedAreas()); - if (!req.newAreas.IsNull()) + if (numberOfLocations != 0) { // do as much parameter validation as we can { uint32_t ignoredIndex = 0; uint32_t oldSelectedLocation; uint32_t i = 0; - auto iLocationIter = req.newAreas.Value().begin(); + auto iLocationIter = req.newAreas.begin(); while (iLocationIter.Next()) { uint32_t aSelectedLocation = iLocationIter.GetValue(); @@ -266,7 +265,7 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select // Checking for duplicate locations. uint32_t j = 0; - auto jLocationIter = req.newAreas.Value().begin(); + auto jLocationIter = req.newAreas.begin(); while (j < i) { jLocationIter @@ -343,9 +342,9 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select // and the SelectedAreas attribute SHALL be set to the value of the newAreas field. mDelegate->ClearSelectedAreas(); - if (!req.newAreas.IsNull()) + if (numberOfLocations != 0) { - auto locationIter = req.newAreas.Value().begin(); + auto locationIter = req.newAreas.begin(); uint32_t ignored; while (locationIter.Next()) { diff --git a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml index f78e8966a11b94..e7b190456a2ef8 100644 --- a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml @@ -89,18 +89,18 @@ limitations under the License. SupportedAreas - SupportedMaps - SelectedAreas + SupportedMaps + SelectedAreas CurrentArea EstimatedEndTime - Progress + Progress Command used to select a set of device areas, where the device is to operate. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 589f832c0ca39b..810f82819c1a19 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -6502,11 +6502,11 @@ provisional cluster ServiceArea = 336 { } readonly attribute AreaStruct supportedAreas[] = 0; - readonly attribute nullable MapStruct supportedMaps[] = 1; - readonly attribute nullable int32u selectedAreas[] = 2; + readonly attribute MapStruct supportedMaps[] = 1; + readonly attribute int32u selectedAreas[] = 2; readonly attribute optional nullable int32u currentArea = 3; readonly attribute optional nullable epoch_s estimatedEndTime = 4; - readonly attribute optional nullable ProgressStruct progress[] = 5; + readonly attribute optional ProgressStruct progress[] = 5; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -6515,7 +6515,7 @@ provisional cluster ServiceArea = 336 { readonly attribute int16u clusterRevision = 65533; request struct SelectAreasRequest { - nullable int32u newAreas[] = 0; + int32u newAreas[] = 0; } response struct SelectAreasResponse = 1 { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index c6a65ba56a6ae6..10863976c661a8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -39073,16 +39073,16 @@ public long initWithDevice(long devicePtr, int endpointId) { return 0L; } - public void selectAreas(SelectAreasResponseCallback callback, @Nullable ArrayList newAreas) { + public void selectAreas(SelectAreasResponseCallback callback, ArrayList newAreas) { selectAreas(callback, newAreas, 0); } - public void selectAreas(SelectAreasResponseCallback callback, @Nullable ArrayList newAreas, int timedInvokeTimeoutMs) { + public void selectAreas(SelectAreasResponseCallback callback, ArrayList newAreas, int timedInvokeTimeoutMs) { final long commandId = 0L; ArrayList elements = new ArrayList<>(); final long newAreasFieldID = 0L; - BaseTLVType newAreastlvValue = newAreas != null ? ArrayType.generateArrayType(newAreas, (elementnewAreas) -> new UIntType(elementnewAreas)) : new NullType(); + BaseTLVType newAreastlvValue = ArrayType.generateArrayType(newAreas, (elementnewAreas) -> new UIntType(elementnewAreas)); elements.add(new StructElement(newAreasFieldID, newAreastlvValue)); StructType commandArgs = new StructType(elements); @@ -39156,11 +39156,11 @@ public interface SupportedAreasAttributeCallback extends BaseAttributeCallback { } public interface SupportedMapsAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable List value); + void onSuccess(List value); } public interface SelectedAreasAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable List value); + void onSuccess(List value); } public interface CurrentAreaAttributeCallback extends BaseAttributeCallback { @@ -39172,7 +39172,7 @@ public interface EstimatedEndTimeAttributeCallback extends BaseAttributeCallback } public interface ProgressAttributeCallback extends BaseAttributeCallback { - void onSuccess(@Nullable List value); + void onSuccess(List value); } public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { @@ -39224,7 +39224,7 @@ public void readSupportedMapsAttribute( readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SUPPORTED_MAPS_ATTRIBUTE_ID, true); @@ -39237,7 +39237,7 @@ public void subscribeSupportedMapsAttribute( subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SUPPORTED_MAPS_ATTRIBUTE_ID, minInterval, maxInterval); @@ -39250,7 +39250,7 @@ public void readSelectedAreasAttribute( readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SELECTED_AREAS_ATTRIBUTE_ID, true); @@ -39263,7 +39263,7 @@ public void subscribeSelectedAreasAttribute( subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, SELECTED_AREAS_ATTRIBUTE_ID, minInterval, maxInterval); @@ -39328,7 +39328,7 @@ public void readProgressAttribute( readAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, PROGRESS_ATTRIBUTE_ID, true); @@ -39341,7 +39341,7 @@ public void subscribeProgressAttribute( subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override public void onSuccess(byte[] tlv) { - @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } }, PROGRESS_ATTRIBUTE_ID, minInterval, maxInterval); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 7b3f36e2f0fb83..d2703a0146de5a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -13193,7 +13193,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(@Nullable List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); @@ -13214,7 +13214,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(@Nullable List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); @@ -13277,7 +13277,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) { } @Override - public void onSuccess(@Nullable List valueList) { + public void onSuccess(List valueList) { Map responseValues = new LinkedHashMap<>(); CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); responseValues.put(commandResponseInfo, valueList); diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt index 3f7aad29ed5a42..08376006435cf1 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt @@ -55,10 +55,10 @@ class ServiceAreaCluster(private val controller: MatterController, private val e object SubscriptionEstablished : SupportedAreasAttributeSubscriptionState() } - class SupportedMapsAttribute(val value: List?) + class SupportedMapsAttribute(val value: List) sealed class SupportedMapsAttributeSubscriptionState { - data class Success(val value: List?) : + data class Success(val value: List) : SupportedMapsAttributeSubscriptionState() data class Error(val exception: Exception) : SupportedMapsAttributeSubscriptionState() @@ -66,10 +66,10 @@ class ServiceAreaCluster(private val controller: MatterController, private val e object SubscriptionEstablished : SupportedMapsAttributeSubscriptionState() } - class SelectedAreasAttribute(val value: List?) + class SelectedAreasAttribute(val value: List) sealed class SelectedAreasAttributeSubscriptionState { - data class Success(val value: List?) : SelectedAreasAttributeSubscriptionState() + data class Success(val value: List) : SelectedAreasAttributeSubscriptionState() data class Error(val exception: Exception) : SelectedAreasAttributeSubscriptionState() @@ -148,7 +148,7 @@ class ServiceAreaCluster(private val controller: MatterController, private val e } suspend fun selectAreas( - newAreas: List?, + newAreas: List, timedInvokeTimeout: Duration? = null, ): SelectAreasResponse { val commandId: UInt = 0u @@ -157,13 +157,11 @@ class ServiceAreaCluster(private val controller: MatterController, private val e tlvWriter.startStructure(AnonymousTag) val TAG_NEW_AREAS_REQ: Int = 0 - newAreas?.let { - tlvWriter.startArray(ContextSpecificTag(TAG_NEW_AREAS_REQ)) - for (item in newAreas.iterator()) { - tlvWriter.put(AnonymousTag, item) - } - tlvWriter.endArray() + tlvWriter.startArray(ContextSpecificTag(TAG_NEW_AREAS_REQ)) + for (item in newAreas.iterator()) { + tlvWriter.put(AnonymousTag, item) } + tlvWriter.endArray() tlvWriter.endStructure() val request: InvokeRequest = @@ -398,18 +396,13 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List? = - if (!tlvReader.isNull()) { - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) } - } else { - tlvReader.getNull(AnonymousTag) - null + tlvReader.exitContainer() } return SupportedMapsAttribute(decodedValue) @@ -454,21 +447,16 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List? = - if (!tlvReader.isNull()) { - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader)) } - } else { - tlvReader.getNull(AnonymousTag) - null + tlvReader.exitContainer() } - decodedValue?.let { emit(SupportedMapsAttributeSubscriptionState.Success(it)) } + emit(SupportedMapsAttributeSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { emit(SupportedMapsAttributeSubscriptionState.SubscriptionEstablished) @@ -503,18 +491,13 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List? = - if (!tlvReader.isNull()) { - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUInt(AnonymousTag)) - } - tlvReader.exitContainer() + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) } - } else { - tlvReader.getNull(AnonymousTag) - null + tlvReader.exitContainer() } return SelectedAreasAttribute(decodedValue) @@ -559,21 +542,16 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) - val decodedValue: List? = - if (!tlvReader.isNull()) { - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUInt(AnonymousTag)) - } - tlvReader.exitContainer() + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) } - } else { - tlvReader.getNull(AnonymousTag) - null + tlvReader.exitContainer() } - decodedValue?.let { emit(SelectedAreasAttributeSubscriptionState.Success(it)) } + emit(SelectedAreasAttributeSubscriptionState.Success(decodedValue)) } SubscriptionState.SubscriptionEstablished -> { emit(SelectedAreasAttributeSubscriptionState.SubscriptionEstablished) @@ -813,20 +791,15 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) val decodedValue: List? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(ServiceAreaClusterProgressStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ServiceAreaClusterProgressStruct.fromTlv(AnonymousTag, tlvReader)) } - } else { - null + tlvReader.exitContainer() } } else { - tlvReader.getNull(AnonymousTag) null } @@ -873,20 +846,15 @@ class ServiceAreaCluster(private val controller: MatterController, private val e // Decode the TLV data into the appropriate type val tlvReader = TlvReader(attributeData.data) val decodedValue: List? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(ServiceAreaClusterProgressStruct.fromTlv(AnonymousTag, tlvReader)) - } - tlvReader.exitContainer() + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(ServiceAreaClusterProgressStruct.fromTlv(AnonymousTag, tlvReader)) } - } else { - null + tlvReader.exitContainer() } } else { - tlvReader.getNull(AnonymousTag) null } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 81cd1313270c54..ebcec56cd2b41a 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -28819,51 +28819,43 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - if (cppValue.IsNull()) - { - value = nullptr; - } - else + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) { - chip::JniReferences::GetInstance().CreateArrayList(value); + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_mapID; + std::string newElement_0_mapIDClassName = "java/lang/Integer"; + std::string newElement_0_mapIDCtorSignature = "(I)V"; + jint jninewElement_0_mapID = static_cast(entry_0.mapID); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mapIDClassName.c_str(), + newElement_0_mapIDCtorSignature.c_str(), + jninewElement_0_mapID, newElement_0_mapID); + jobject newElement_0_name; + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_0.name, newElement_0_name)); - auto iter_value_1 = cppValue.Value().begin(); - while (iter_value_1.Next()) + jclass mapStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterMapStruct", mapStructStructClass_1); + if (err != CHIP_NO_ERROR) { - auto & entry_1 = iter_value_1.GetValue(); - jobject newElement_1; - jobject newElement_1_mapID; - std::string newElement_1_mapIDClassName = "java/lang/Integer"; - std::string newElement_1_mapIDCtorSignature = "(I)V"; - jint jninewElement_1_mapID = static_cast(entry_1.mapID); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_mapIDClassName.c_str(), - newElement_1_mapIDCtorSignature.c_str(), - jninewElement_1_mapID, newElement_1_mapID); - jobject newElement_1_name; - LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_1.name, newElement_1_name)); - - jclass mapStructStructClass_2; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterMapStruct", mapStructStructClass_2); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterMapStruct"); - return nullptr; - } - - jmethodID mapStructStructCtor_2; - err = chip::JniReferences::GetInstance().FindMethod( - env, mapStructStructClass_2, "", "(Ljava/lang/Integer;Ljava/lang/String;)V", &mapStructStructCtor_2); - if (err != CHIP_NO_ERROR || mapStructStructCtor_2 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterMapStruct constructor"); - return nullptr; - } + ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterMapStruct"); + return nullptr; + } - newElement_1 = - env->NewObject(mapStructStructClass_2, mapStructStructCtor_2, newElement_1_mapID, newElement_1_name); - chip::JniReferences::GetInstance().AddToList(value, newElement_1); + jmethodID mapStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, mapStructStructClass_1, "", "(Ljava/lang/Integer;Ljava/lang/String;)V", &mapStructStructCtor_1); + if (err != CHIP_NO_ERROR || mapStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterMapStruct constructor"); + return nullptr; } + + newElement_0 = env->NewObject(mapStructStructClass_1, mapStructStructCtor_1, newElement_0_mapID, newElement_0_name); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; } @@ -28876,26 +28868,19 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - if (cppValue.IsNull()) - { - value = nullptr; - } - else - { - chip::JniReferences::GetInstance().CreateArrayList(value); + chip::JniReferences::GetInstance().CreateArrayList(value); - auto iter_value_1 = cppValue.Value().begin(); - while (iter_value_1.Next()) - { - auto & entry_1 = iter_value_1.GetValue(); - jobject newElement_1; - std::string newElement_1ClassName = "java/lang/Long"; - std::string newElement_1CtorSignature = "(J)V"; - jlong jninewElement_1 = static_cast(entry_1); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1ClassName.c_str(), newElement_1CtorSignature.c_str(), jninewElement_1, newElement_1); - chip::JniReferences::GetInstance().AddToList(value, newElement_1); - } + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; } @@ -28954,112 +28939,102 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - if (cppValue.IsNull()) - { - value = nullptr; - } - else - { - chip::JniReferences::GetInstance().CreateArrayList(value); + chip::JniReferences::GetInstance().CreateArrayList(value); - auto iter_value_1 = cppValue.Value().begin(); - while (iter_value_1.Next()) + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + jobject newElement_0_areaID; + std::string newElement_0_areaIDClassName = "java/lang/Long"; + std::string newElement_0_areaIDCtorSignature = "(J)V"; + jlong jninewElement_0_areaID = static_cast(entry_0.areaID); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_areaIDClassName.c_str(), + newElement_0_areaIDCtorSignature.c_str(), + jninewElement_0_areaID, newElement_0_areaID); + jobject newElement_0_status; + std::string newElement_0_statusClassName = "java/lang/Integer"; + std::string newElement_0_statusCtorSignature = "(I)V"; + jint jninewElement_0_status = static_cast(entry_0.status); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_statusClassName.c_str(), + newElement_0_statusCtorSignature.c_str(), + jninewElement_0_status, newElement_0_status); + jobject newElement_0_totalOperationalTime; + if (!entry_0.totalOperationalTime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_totalOperationalTime); + } + else { - auto & entry_1 = iter_value_1.GetValue(); - jobject newElement_1; - jobject newElement_1_areaID; - std::string newElement_1_areaIDClassName = "java/lang/Long"; - std::string newElement_1_areaIDCtorSignature = "(J)V"; - jlong jninewElement_1_areaID = static_cast(entry_1.areaID); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_areaIDClassName.c_str(), - newElement_1_areaIDCtorSignature.c_str(), - jninewElement_1_areaID, newElement_1_areaID); - jobject newElement_1_status; - std::string newElement_1_statusClassName = "java/lang/Integer"; - std::string newElement_1_statusCtorSignature = "(I)V"; - jint jninewElement_1_status = static_cast(entry_1.status); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_statusClassName.c_str(), - newElement_1_statusCtorSignature.c_str(), - jninewElement_1_status, newElement_1_status); - jobject newElement_1_totalOperationalTime; - if (!entry_1.totalOperationalTime.HasValue()) + jobject newElement_0_totalOperationalTimeInsideOptional; + if (entry_0.totalOperationalTime.Value().IsNull()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_totalOperationalTime); + newElement_0_totalOperationalTimeInsideOptional = nullptr; } else { - jobject newElement_1_totalOperationalTimeInsideOptional; - if (entry_1.totalOperationalTime.Value().IsNull()) - { - newElement_1_totalOperationalTimeInsideOptional = nullptr; - } - else - { - std::string newElement_1_totalOperationalTimeInsideOptionalClassName = "java/lang/Long"; - std::string newElement_1_totalOperationalTimeInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_1_totalOperationalTimeInsideOptional = - static_cast(entry_1.totalOperationalTime.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_totalOperationalTimeInsideOptionalClassName.c_str(), - newElement_1_totalOperationalTimeInsideOptionalCtorSignature.c_str(), - jninewElement_1_totalOperationalTimeInsideOptional, - newElement_1_totalOperationalTimeInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(newElement_1_totalOperationalTimeInsideOptional, - newElement_1_totalOperationalTime); + std::string newElement_0_totalOperationalTimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_totalOperationalTimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_totalOperationalTimeInsideOptional = + static_cast(entry_0.totalOperationalTime.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_totalOperationalTimeInsideOptionalClassName.c_str(), + newElement_0_totalOperationalTimeInsideOptionalCtorSignature.c_str(), + jninewElement_0_totalOperationalTimeInsideOptional, newElement_0_totalOperationalTimeInsideOptional); } - jobject newElement_1_estimatedTime; - if (!entry_1.estimatedTime.HasValue()) + chip::JniReferences::GetInstance().CreateOptional(newElement_0_totalOperationalTimeInsideOptional, + newElement_0_totalOperationalTime); + } + jobject newElement_0_estimatedTime; + if (!entry_0.estimatedTime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_estimatedTime); + } + else + { + jobject newElement_0_estimatedTimeInsideOptional; + if (entry_0.estimatedTime.Value().IsNull()) { - chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_estimatedTime); + newElement_0_estimatedTimeInsideOptional = nullptr; } else { - jobject newElement_1_estimatedTimeInsideOptional; - if (entry_1.estimatedTime.Value().IsNull()) - { - newElement_1_estimatedTimeInsideOptional = nullptr; - } - else - { - std::string newElement_1_estimatedTimeInsideOptionalClassName = "java/lang/Long"; - std::string newElement_1_estimatedTimeInsideOptionalCtorSignature = "(J)V"; - jlong jninewElement_1_estimatedTimeInsideOptional = - static_cast(entry_1.estimatedTime.Value().Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_estimatedTimeInsideOptionalClassName.c_str(), - newElement_1_estimatedTimeInsideOptionalCtorSignature.c_str(), - jninewElement_1_estimatedTimeInsideOptional, newElement_1_estimatedTimeInsideOptional); - } - chip::JniReferences::GetInstance().CreateOptional(newElement_1_estimatedTimeInsideOptional, - newElement_1_estimatedTime); - } - - jclass progressStructStructClass_2; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterProgressStruct", progressStructStructClass_2); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterProgressStruct"); - return nullptr; + std::string newElement_0_estimatedTimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_estimatedTimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_estimatedTimeInsideOptional = + static_cast(entry_0.estimatedTime.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_estimatedTimeInsideOptionalClassName.c_str(), + newElement_0_estimatedTimeInsideOptionalCtorSignature.c_str(), + jninewElement_0_estimatedTimeInsideOptional, newElement_0_estimatedTimeInsideOptional); } + chip::JniReferences::GetInstance().CreateOptional(newElement_0_estimatedTimeInsideOptional, + newElement_0_estimatedTime); + } - jmethodID progressStructStructCtor_2; - err = chip::JniReferences::GetInstance().FindMethod( - env, progressStructStructClass_2, "", - "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", - &progressStructStructCtor_2); - if (err != CHIP_NO_ERROR || progressStructStructCtor_2 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterProgressStruct constructor"); - return nullptr; - } + jclass progressStructStructClass_1; + err = chip::JniReferences::GetInstance().GetLocalClassRef( + env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterProgressStruct", progressStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterProgressStruct"); + return nullptr; + } - newElement_1 = - env->NewObject(progressStructStructClass_2, progressStructStructCtor_2, newElement_1_areaID, - newElement_1_status, newElement_1_totalOperationalTime, newElement_1_estimatedTime); - chip::JniReferences::GetInstance().AddToList(value, newElement_1); + jmethodID progressStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, progressStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V", &progressStructStructCtor_1); + if (err != CHIP_NO_ERROR || progressStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterProgressStruct constructor"); + return nullptr; } + + newElement_0 = env->NewObject(progressStructStructClass_1, progressStructStructCtor_1, newElement_0_areaID, + newElement_0_status, newElement_0_totalOperationalTime, newElement_0_estimatedTime); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); } return value; } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 5f1ca74314b3a3..670c7109a5ccb8 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -31144,11 +31144,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="supportedAreas", Tag=0x00000000, Type=typing.List[ServiceArea.Structs.AreaStruct]), - ClusterObjectFieldDescriptor(Label="supportedMaps", Tag=0x00000001, Type=typing.Union[Nullable, typing.List[ServiceArea.Structs.MapStruct]]), - ClusterObjectFieldDescriptor(Label="selectedAreas", Tag=0x00000002, Type=typing.Union[Nullable, typing.List[uint]]), + ClusterObjectFieldDescriptor(Label="supportedMaps", Tag=0x00000001, Type=typing.List[ServiceArea.Structs.MapStruct]), + ClusterObjectFieldDescriptor(Label="selectedAreas", Tag=0x00000002, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="currentArea", Tag=0x00000003, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="estimatedEndTime", Tag=0x00000004, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="progress", Tag=0x00000005, Type=typing.Union[None, Nullable, typing.List[ServiceArea.Structs.ProgressStruct]]), + ClusterObjectFieldDescriptor(Label="progress", Tag=0x00000005, Type=typing.Optional[typing.List[ServiceArea.Structs.ProgressStruct]]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -31158,11 +31158,11 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) supportedAreas: 'typing.List[ServiceArea.Structs.AreaStruct]' = None - supportedMaps: 'typing.Union[Nullable, typing.List[ServiceArea.Structs.MapStruct]]' = None - selectedAreas: 'typing.Union[Nullable, typing.List[uint]]' = None + supportedMaps: 'typing.List[ServiceArea.Structs.MapStruct]' = None + selectedAreas: 'typing.List[uint]' = None currentArea: 'typing.Union[None, Nullable, uint]' = None estimatedEndTime: 'typing.Union[None, Nullable, uint]' = None - progress: 'typing.Union[None, Nullable, typing.List[ServiceArea.Structs.ProgressStruct]]' = None + progress: 'typing.Optional[typing.List[ServiceArea.Structs.ProgressStruct]]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -31284,10 +31284,10 @@ class SelectAreas(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="newAreas", Tag=0, Type=typing.Union[Nullable, typing.List[uint]]), + ClusterObjectFieldDescriptor(Label="newAreas", Tag=0, Type=typing.List[uint]), ]) - newAreas: 'typing.Union[Nullable, typing.List[uint]]' = NullValue + newAreas: 'typing.List[uint]' = field(default_factory=lambda: []) @dataclass class SelectAreasResponse(ClusterCommand): @@ -31367,9 +31367,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, typing.List[ServiceArea.Structs.MapStruct]]) + return ClusterObjectFieldDescriptor(Type=typing.List[ServiceArea.Structs.MapStruct]) - value: 'typing.Union[Nullable, typing.List[ServiceArea.Structs.MapStruct]]' = NullValue + value: 'typing.List[ServiceArea.Structs.MapStruct]' = field(default_factory=lambda: []) @dataclass class SelectedAreas(ClusterAttributeDescriptor): @@ -31383,9 +31383,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, typing.List[uint]]) + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) - value: 'typing.Union[Nullable, typing.List[uint]]' = NullValue + value: 'typing.List[uint]' = field(default_factory=lambda: []) @dataclass class CurrentArea(ClusterAttributeDescriptor): @@ -31431,9 +31431,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, typing.List[ServiceArea.Structs.ProgressStruct]]) + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[ServiceArea.Structs.ProgressStruct]]) - value: 'typing.Union[None, Nullable, typing.List[ServiceArea.Structs.ProgressStruct]]' = None + value: 'typing.Optional[typing.List[ServiceArea.Structs.ProgressStruct]]' = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index b1c3fb9d486ca5..95001d3ca68720 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -11252,33 +11252,29 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri if (*aError != CHIP_NO_ERROR) { return nil; } - NSArray * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - auto iter_1 = cppValue.Value().begin(); - while (iter_1.Next()) { - auto & entry_1 = iter_1.GetValue(); - MTRServiceAreaClusterMapStruct * newElement_1; - newElement_1 = [MTRServiceAreaClusterMapStruct new]; - newElement_1.mapID = [NSNumber numberWithUnsignedChar:entry_1.mapID]; - newElement_1.name = AsString(entry_1.name); - if (newElement_1.name == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - *aError = err; - return nil; - } - [array_1 addObject:newElement_1]; - } - CHIP_ERROR err = iter_1.GetStatus(); - if (err != CHIP_NO_ERROR) { + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRServiceAreaClusterMapStruct * newElement_0; + newElement_0 = [MTRServiceAreaClusterMapStruct new]; + newElement_0.mapID = [NSNumber numberWithUnsignedChar:entry_0.mapID]; + newElement_0.name = AsString(entry_0.name); + if (newElement_0.name == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; *aError = err; return nil; } - value = array_1; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } + value = array_0; } return value; } @@ -11289,26 +11285,22 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri if (*aError != CHIP_NO_ERROR) { return nil; } - NSArray * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - auto iter_1 = cppValue.Value().begin(); - while (iter_1.Next()) { - auto & entry_1 = iter_1.GetValue(); - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedInt:entry_1]; - [array_1 addObject:newElement_1]; - } - CHIP_ERROR err = iter_1.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_1; + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } + value = array_0; } return value; } @@ -11349,46 +11341,42 @@ static id _Nullable DecodeAttributeValueForServiceAreaCluster(AttributeId aAttri if (*aError != CHIP_NO_ERROR) { return nil; } - NSArray * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - auto iter_1 = cppValue.Value().begin(); - while (iter_1.Next()) { - auto & entry_1 = iter_1.GetValue(); - MTRServiceAreaClusterProgressStruct * newElement_1; - newElement_1 = [MTRServiceAreaClusterProgressStruct new]; - newElement_1.areaID = [NSNumber numberWithUnsignedInt:entry_1.areaID]; - newElement_1.status = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.status)]; - if (entry_1.totalOperationalTime.HasValue()) { - if (entry_1.totalOperationalTime.Value().IsNull()) { - newElement_1.totalOperationalTime = nil; - } else { - newElement_1.totalOperationalTime = [NSNumber numberWithUnsignedInt:entry_1.totalOperationalTime.Value().Value()]; - } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRServiceAreaClusterProgressStruct * newElement_0; + newElement_0 = [MTRServiceAreaClusterProgressStruct new]; + newElement_0.areaID = [NSNumber numberWithUnsignedInt:entry_0.areaID]; + newElement_0.status = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.status)]; + if (entry_0.totalOperationalTime.HasValue()) { + if (entry_0.totalOperationalTime.Value().IsNull()) { + newElement_0.totalOperationalTime = nil; } else { - newElement_1.totalOperationalTime = nil; + newElement_0.totalOperationalTime = [NSNumber numberWithUnsignedInt:entry_0.totalOperationalTime.Value().Value()]; } - if (entry_1.estimatedTime.HasValue()) { - if (entry_1.estimatedTime.Value().IsNull()) { - newElement_1.estimatedTime = nil; - } else { - newElement_1.estimatedTime = [NSNumber numberWithUnsignedInt:entry_1.estimatedTime.Value().Value()]; - } + } else { + newElement_0.totalOperationalTime = nil; + } + if (entry_0.estimatedTime.HasValue()) { + if (entry_0.estimatedTime.Value().IsNull()) { + newElement_0.estimatedTime = nil; } else { - newElement_1.estimatedTime = nil; + newElement_0.estimatedTime = [NSNumber numberWithUnsignedInt:entry_0.estimatedTime.Value().Value()]; } - [array_1 addObject:newElement_1]; - } - CHIP_ERROR err = iter_1.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + } else { + newElement_0.estimatedTime = nil; } - value = array_1; + [array_0 addObject:newElement_0]; } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; } return value; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 88ef499858e1a7..79cc7d4011add6 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -7639,7 +7639,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRServiceAreaClusterSelectAreasParams : NSObject -@property (nonatomic, copy, getter=getNewAreas) NSArray * _Nullable newAreas MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy, getter=getNewAreas) NSArray * _Nonnull newAreas MTR_PROVISIONALLY_AVAILABLE; /** * Controls whether the command is a timed command (using Timed Invoke). * diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 70f3cad514818b..eeb671df165fec 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -21789,7 +21789,7 @@ - (instancetype)init { if (self = [super init]) { - _newAreas = nil; + _newAreas = [NSArray array]; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -21822,31 +21822,26 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader chip::app::Clusters::ServiceArea::Commands::SelectAreas::Type encodableStruct; ListFreer listFreer; { - if (self.newAreas == nil) { - encodableStruct.newAreas.SetNull(); - } else { - auto & nonNullValue_0 = encodableStruct.newAreas.SetNonNull(); - { - using ListType_1 = std::remove_reference_t; - using ListMemberType_1 = ListMemberTypeGetter::Type; - if (self.newAreas.count != 0) { - auto * listHolder_1 = new ListHolder(self.newAreas.count); - if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { + { + using ListType_0 = std::remove_reference_t; + using ListMemberType_0 = ListMemberTypeGetter::Type; + if (self.newAreas.count != 0) { + auto * listHolder_0 = new ListHolder(self.newAreas.count); + if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { + return CHIP_ERROR_INVALID_ARGUMENT; + } + listFreer.add(listHolder_0); + for (size_t i_0 = 0; i_0 < self.newAreas.count; ++i_0) { + if (![self.newAreas[i_0] isKindOfClass:[NSNumber class]]) { + // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - listFreer.add(listHolder_1); - for (size_t i_1 = 0; i_1 < self.newAreas.count; ++i_1) { - if (![self.newAreas[i_1] isKindOfClass:[NSNumber class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_1 = (NSNumber *) self.newAreas[i_1]; - listHolder_1->mList[i_1] = element_1.unsignedIntValue; - } - nonNullValue_0 = ListType_1(listHolder_1->mList, self.newAreas.count); - } else { - nonNullValue_0 = ListType_1(); + auto element_0 = (NSNumber *) self.newAreas[i_0]; + listHolder_0->mList[i_0] = element_0.unsignedIntValue; } + encodableStruct.newAreas = ListType_0(listHolder_0->mList, self.newAreas.count); + } else { + encodableStruct.newAreas = ListType_0(); } } } 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 f280ba39f8577c..07107feb2df637 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 @@ -28487,7 +28487,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::SelectAreas::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } - DataModel::Nullable> newAreas; + DataModel::List newAreas; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -28502,7 +28502,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::SelectAreas::Id; } static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } - DataModel::Nullable> newAreas; + DataModel::DecodableList newAreas; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace SelectAreas @@ -28624,12 +28624,10 @@ struct TypeInfo namespace SupportedMaps { struct TypeInfo { - using Type = chip::app::DataModel::Nullable< - chip::app::DataModel::List>; - using DecodableType = chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList>; - using DecodableArgType = const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> &; + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SupportedMaps::Id; } @@ -28639,9 +28637,9 @@ struct TypeInfo namespace SelectedAreas { struct TypeInfo { - using Type = chip::app::DataModel::Nullable>; - using DecodableType = chip::app::DataModel::Nullable>; - using DecodableArgType = const chip::app::DataModel::Nullable> &; + using Type = chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList; + using DecodableArgType = const chip::app::DataModel::DecodableList &; static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::SelectedAreas::Id; } @@ -28675,12 +28673,11 @@ struct TypeInfo namespace Progress { struct TypeInfo { - using Type = chip::app::DataModel::Nullable< - chip::app::DataModel::List>; - using DecodableType = chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList>; - using DecodableArgType = const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> &; + using Type = chip::app::DataModel::List; + using DecodableType = + chip::app::DataModel::DecodableList; + using DecodableArgType = + const chip::app::DataModel::DecodableList &; static constexpr ClusterId GetClusterId() { return Clusters::ServiceArea::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::Progress::Id; } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index dd6fcb262adee4..98d6d9caee0e97 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -9418,7 +9418,7 @@ class ServiceAreaSelectAreas : public ClusterCommand private: chip::app::Clusters::ServiceArea::Commands::SelectAreas::Type mRequest; - TypedComplexArgument>> mComplex_NewAreas; + TypedComplexArgument> mComplex_NewAreas; }; /* @@ -22794,18 +22794,18 @@ void registerClusterServiceArea(Commands & commands, CredentialIssuerCommands * make_unique< WriteAttributeAsComplex>>( Id, "supported-areas", Attributes::SupportedAreas::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>>( + make_unique< + WriteAttributeAsComplex>>( Id, "supported-maps", Attributes::SupportedMaps::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>>( + make_unique>>( Id, "selected-areas", Attributes::SelectedAreas::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "current-area", 0, UINT32_MAX, Attributes::CurrentArea::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>(Id, "estimated-end-time", 0, UINT32_MAX, Attributes::EstimatedEndTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>>( + make_unique>>( Id, "progress", Attributes::Progress::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, 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 2e3b5bc55ddd6f..afebe69c9407ed 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -14739,14 +14739,12 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("SupportedAreas", 1, value); } case ServiceArea::Attributes::SupportedMaps::Id: { - chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> - value; + chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SupportedMaps", 1, value); } case ServiceArea::Attributes::SelectedAreas::Id: { - chip::app::DataModel::Nullable> value; + chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SelectedAreas", 1, value); } @@ -14761,9 +14759,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("EstimatedEndTime", 1, value); } case ServiceArea::Attributes::Progress::Id: { - chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> - value; + chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("Progress", 1, 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 195bf8b2a5a5b8..8e18e60aaa7e63 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -103900,18 +103900,14 @@ class ServiceAreaSelectAreas : public ClusterCommand { __auto_type * params = [[MTRServiceAreaClusterSelectAreasParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL - if (mRequest.newAreas.IsNull()) { - params.newAreas = nil; - } else { - { // Scope for our temporary variables - auto * array_1 = [NSMutableArray new]; - for (auto & entry_1 : mRequest.newAreas.Value()) { - NSNumber * newElement_1; - newElement_1 = [NSNumber numberWithUnsignedInt:entry_1]; - [array_1 addObject:newElement_1]; - } - params.newAreas = array_1; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + for (auto & entry_0 : mRequest.newAreas) { + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; } + params.newAreas = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); @@ -103941,7 +103937,7 @@ class ServiceAreaSelectAreas : public ClusterCommand { private: chip::app::Clusters::ServiceArea::Commands::SelectAreas::Type mRequest; - TypedComplexArgument>> mComplex_NewAreas; + TypedComplexArgument> mComplex_NewAreas; }; #endif // MTR_ENABLE_PROVISIONAL