From b0ef8c13640ff2fe5e46d0c77b2d04d0490aba64 Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Thu, 25 Jan 2024 16:33:37 +0100 Subject: [PATCH] Update xml command names --- .../zcl/data-model/chip/messages-cluster.xml | 12 ++-- .../data_model/controller-clusters.matter | 6 +- .../chip/devicecontroller/ChipClusters.java | 12 ++-- .../devicecontroller/ChipEventStructs.java | 20 +++--- .../devicecontroller/ClusterIDMapping.java | 2 +- .../devicecontroller/ClusterInfoMapping.java | 6 +- .../MessagesClusterMessageCompleteEvent.kt | 27 +++++-- .../cluster/clusters/MessagesCluster.kt | 10 +-- .../MessagesClusterMessageCompleteEvent.kt | 27 +++++-- .../CHIPEventTLVValueDecoder.cpp | 43 +++++++---- .../python/chip/clusters/CHIPClusters.py | 2 +- .../python/chip/clusters/Objects.py | 12 ++-- .../zap-generated/MTRCommandPayloadsObjc.h | 2 +- .../zap-generated/MTRCommandPayloadsObjc.mm | 72 ++++--------------- .../zap-generated/MTREventTLVValueDecoder.mm | 30 +++++--- .../zap-generated/cluster-objects.cpp | 6 +- .../zap-generated/cluster-objects.h | 14 ++-- .../zap-generated/cluster/Commands.h | 7 +- .../zap-generated/cluster/Commands.h | 52 ++------------ 19 files changed, 167 insertions(+), 195 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml index 74f894df0b575a..c0aeb0017aed28 100644 --- a/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/messages-cluster.xml @@ -83,13 +83,13 @@ limitations under the License. Command for requesting messages be presented - + Command for cancelling message present requests - + This event SHALL be generated when the message is confirmed by the user, or when the expiration date of the message is reached. @@ -101,10 +101,10 @@ limitations under the License. This event SHALL be generated when the message is confirmed by the user, or when the expiration date of the message is reached. - - - - + + + + \ No newline at end of file diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 0c9111c840c533..8dc020203e1e94 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4432,8 +4432,8 @@ provisional cluster Messages = 151 { info event MessageComplete = 2 { octet_string messageID = 0; - nullable int32u responseID = 1; - nullable char_string reply = 2; + optional nullable int32u responseID = 1; + optional nullable char_string reply = 2; nullable FutureMessagePreferenceEnum futureMessagesPreference = 3; } @@ -4451,7 +4451,7 @@ provisional cluster Messages = 151 { } request struct CancelMessagesRequestRequest { - MessageStruct messages[] = 0; + octet_string messageIDs[] = 0; } /** Command for requesting messages be presented */ diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index d51df515ffd7ef..ad08fb7e893c8d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -29228,17 +29228,17 @@ public void onResponse(StructType invokeStructValue) { }}, commandId, value, timedInvokeTimeoutMs); } - public void cancelMessagesRequest(DefaultClusterCallback callback, ArrayList messages) { - cancelMessagesRequest(callback, messages, 0); + public void cancelMessagesRequest(DefaultClusterCallback callback, ArrayList messageIDs) { + cancelMessagesRequest(callback, messageIDs, 0); } - public void cancelMessagesRequest(DefaultClusterCallback callback, ArrayList messages, int timedInvokeTimeoutMs) { + public void cancelMessagesRequest(DefaultClusterCallback callback, ArrayList messageIDs, int timedInvokeTimeoutMs) { final long commandId = 1L; ArrayList elements = new ArrayList<>(); - final long messagesFieldID = 0L; - BaseTLVType messagestlvValue = ArrayType.generateArrayType(messages, (elementmessages) -> elementmessages.encodeTlv()); - elements.add(new StructElement(messagesFieldID, messagestlvValue)); + final long messageIDsFieldID = 0L; + BaseTLVType messageIDstlvValue = ArrayType.generateArrayType(messageIDs, (elementmessageIDs) -> new ByteArrayType(elementmessageIDs)); + elements.add(new StructElement(messageIDsFieldID, messageIDstlvValue)); StructType value = new StructType(elements); invoke(new InvokeCallbackImpl(callback) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index e2bdd550db54df..b759822df155b5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -3854,8 +3854,8 @@ public String toString() { } public static class MessagesClusterMessageCompleteEvent { public byte[] messageID; - public @Nullable Long responseID; - public @Nullable String reply; + public @Nullable Optional responseID; + public @Nullable Optional reply; public @Nullable Integer futureMessagesPreference; private static final long MESSAGE_I_D_ID = 0L; private static final long RESPONSE_I_D_ID = 1L; @@ -3864,8 +3864,8 @@ public static class MessagesClusterMessageCompleteEvent { public MessagesClusterMessageCompleteEvent( byte[] messageID, - @Nullable Long responseID, - @Nullable String reply, + @Nullable Optional responseID, + @Nullable Optional reply, @Nullable Integer futureMessagesPreference ) { this.messageID = messageID; @@ -3877,8 +3877,8 @@ public MessagesClusterMessageCompleteEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(MESSAGE_I_D_ID, new ByteArrayType(messageID))); - values.add(new StructElement(RESPONSE_I_D_ID, responseID != null ? new UIntType(responseID) : new NullType())); - values.add(new StructElement(REPLY_ID, reply != null ? new StringType(reply) : new NullType())); + values.add(new StructElement(RESPONSE_I_D_ID, responseID != null ? responseID.map((nonOptionalresponseID) -> new UIntType(nonOptionalresponseID)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(REPLY_ID, reply != null ? reply.map((nonOptionalreply) -> new StringType(nonOptionalreply)).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(FUTURE_MESSAGES_PREFERENCE_ID, futureMessagesPreference != null ? new UIntType(futureMessagesPreference) : new NullType())); return new StructType(values); @@ -3889,8 +3889,8 @@ public static MessagesClusterMessageCompleteEvent decodeTlv(BaseTLVType tlvValue return null; } byte[] messageID = null; - @Nullable Long responseID = null; - @Nullable String reply = null; + @Nullable Optional responseID = null; + @Nullable Optional reply = null; @Nullable Integer futureMessagesPreference = null; for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == MESSAGE_I_D_ID) { @@ -3901,12 +3901,12 @@ public static MessagesClusterMessageCompleteEvent decodeTlv(BaseTLVType tlvValue } else if (element.contextTagNum() == RESPONSE_I_D_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); - responseID = castingValue.value(Long.class); + responseID = Optional.of(castingValue.value(Long.class)); } } else if (element.contextTagNum() == REPLY_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); - reply = castingValue.value(String.class); + reply = Optional.of(castingValue.value(String.class)); } } else if (element.contextTagNum() == FUTURE_MESSAGES_PREFERENCE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 4e5e3dd6cc0ff0..92a679fe443b26 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -9406,7 +9406,7 @@ public static PresentMessagesRequestCommandField value(int id) throws NoSuchFiel } throw new NoSuchFieldError(); } - }public enum CancelMessagesRequestCommandField {Messages(0),; + }public enum CancelMessagesRequestCommandField {MessageIDs(0),; private final int id; CancelMessagesRequestCommandField(int id) { this.id = id; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 03741c90a4c5fd..70c1e3f12787d7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -23740,12 +23740,14 @@ public Map> getCommandMap() { Map messagescancelMessagesRequestCommandParams = new LinkedHashMap(); + CommandParameterInfo messagescancelMessagesRequestmessageIDsCommandParameterInfo = new CommandParameterInfo("messageIDs", ArrayList.class, ArrayList.class); + messagescancelMessagesRequestCommandParams.put("messageIDs",messagescancelMessagesRequestmessageIDsCommandParameterInfo); InteractionInfo messagescancelMessagesRequestInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.MessagesCluster) cluster) .cancelMessagesRequest((DefaultClusterCallback) callback - , (ArrayList) - commandArguments.get("messages") + , (ArrayList) + commandArguments.get("messageIDs") ); }, () -> new DelegatedDefaultClusterCallback(), diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt index e63fb99aa307fa..d885f26d3d9b8b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt @@ -17,6 +17,7 @@ package chip.devicecontroller.cluster.eventstructs import chip.devicecontroller.cluster.* +import java.util.Optional import matter.tlv.ContextSpecificTag import matter.tlv.Tag import matter.tlv.TlvReader @@ -24,8 +25,8 @@ import matter.tlv.TlvWriter class MessagesClusterMessageCompleteEvent( val messageID: ByteArray, - val responseID: ULong?, - val reply: String?, + val responseID: Optional?, + val reply: Optional?, val futureMessagesPreference: UInt? ) { override fun toString(): String = buildString { @@ -42,12 +43,18 @@ class MessagesClusterMessageCompleteEvent( startStructure(tlvTag) put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) if (responseID != null) { - put(ContextSpecificTag(TAG_RESPONSE_I_D), responseID) + if (responseID.isPresent) { + val optresponseID = responseID.get() + put(ContextSpecificTag(TAG_RESPONSE_I_D), optresponseID) + } } else { putNull(ContextSpecificTag(TAG_RESPONSE_I_D)) } if (reply != null) { - put(ContextSpecificTag(TAG_REPLY), reply) + if (reply.isPresent) { + val optreply = reply.get() + put(ContextSpecificTag(TAG_REPLY), optreply) + } } else { putNull(ContextSpecificTag(TAG_REPLY)) } @@ -71,14 +78,22 @@ class MessagesClusterMessageCompleteEvent( val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) val responseID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_RESPONSE_I_D)) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RESPONSE_I_D))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_RESPONSE_I_D))) + } else { + Optional.empty() + } } else { tlvReader.getNull(ContextSpecificTag(TAG_RESPONSE_I_D)) null } val reply = if (!tlvReader.isNull()) { - tlvReader.getString(ContextSpecificTag(TAG_REPLY)) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_REPLY))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_REPLY))) + } else { + Optional.empty() + } } else { tlvReader.getNull(ContextSpecificTag(TAG_REPLY)) null diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt index 80e32913643bf8..7793725b8d9cce 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt @@ -130,7 +130,7 @@ class MessagesCluster(private val controller: MatterController, private val endp } suspend fun cancelMessagesRequest( - messages: List, + messageIDs: List, timedInvokeTimeout: Duration? = null ) { val commandId: UInt = 1u @@ -138,10 +138,10 @@ class MessagesCluster(private val controller: MatterController, private val endp val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_MESSAGES_REQ: Int = 0 - tlvWriter.startArray(ContextSpecificTag(TAG_MESSAGES_REQ)) - for (item in messages.iterator()) { - item.toTlv(AnonymousTag, tlvWriter) + val TAG_MESSAGE_I_DS_REQ: Int = 0 + tlvWriter.startArray(ContextSpecificTag(TAG_MESSAGE_I_DS_REQ)) + for (item in messageIDs.iterator()) { + tlvWriter.put(AnonymousTag, item) } tlvWriter.endArray() tlvWriter.endStructure() diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt index 5e6a42209e1616..4c30c4ec20bd82 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt @@ -16,6 +16,7 @@ */ package matter.controller.cluster.eventstructs +import java.util.Optional import matter.controller.cluster.* import matter.tlv.ContextSpecificTag import matter.tlv.Tag @@ -24,8 +25,8 @@ import matter.tlv.TlvWriter class MessagesClusterMessageCompleteEvent( val messageID: ByteArray, - val responseID: UInt?, - val reply: String?, + val responseID: Optional?, + val reply: Optional?, val futureMessagesPreference: UByte? ) { override fun toString(): String = buildString { @@ -42,12 +43,18 @@ class MessagesClusterMessageCompleteEvent( startStructure(tlvTag) put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) if (responseID != null) { - put(ContextSpecificTag(TAG_RESPONSE_I_D), responseID) + if (responseID.isPresent) { + val optresponseID = responseID.get() + put(ContextSpecificTag(TAG_RESPONSE_I_D), optresponseID) + } } else { putNull(ContextSpecificTag(TAG_RESPONSE_I_D)) } if (reply != null) { - put(ContextSpecificTag(TAG_REPLY), reply) + if (reply.isPresent) { + val optreply = reply.get() + put(ContextSpecificTag(TAG_REPLY), optreply) + } } else { putNull(ContextSpecificTag(TAG_REPLY)) } @@ -71,14 +78,22 @@ class MessagesClusterMessageCompleteEvent( val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) val responseID = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_RESPONSE_I_D)) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RESPONSE_I_D))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_RESPONSE_I_D))) + } else { + Optional.empty() + } } else { tlvReader.getNull(ContextSpecificTag(TAG_RESPONSE_I_D)) null } val reply = if (!tlvReader.isNull()) { - tlvReader.getString(ContextSpecificTag(TAG_REPLY)) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_REPLY))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_REPLY))) + } else { + Optional.empty() + } } else { tlvReader.getNull(ContextSpecificTag(TAG_REPLY)) null diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 220a882210eb76..4795647b3e242f 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -5218,28 +5218,47 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & value_messageID = value_messageIDByteArray; jobject value_responseID; - if (cppValue.responseID.IsNull()) + if (!cppValue.responseID.HasValue()) { - value_responseID = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_responseID); } else { - std::string value_responseIDClassName = "java/lang/Long"; - std::string value_responseIDCtorSignature = "(J)V"; - jlong jnivalue_responseID = static_cast(cppValue.responseID.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject(value_responseIDClassName.c_str(), - value_responseIDCtorSignature.c_str(), - jnivalue_responseID, value_responseID); + jobject value_responseIDInsideOptional; + if (cppValue.responseID.Value().IsNull()) + { + value_responseIDInsideOptional = nullptr; + } + else + { + std::string value_responseIDInsideOptionalClassName = "java/lang/Long"; + std::string value_responseIDInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_responseIDInsideOptional = static_cast(cppValue.responseID.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_responseIDInsideOptionalClassName.c_str(), value_responseIDInsideOptionalCtorSignature.c_str(), + jnivalue_responseIDInsideOptional, value_responseIDInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_responseIDInsideOptional, value_responseID); } jobject value_reply; - if (cppValue.reply.IsNull()) + if (!cppValue.reply.HasValue()) { - value_reply = nullptr; + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_reply); } else { - LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(cppValue.reply.Value(), value_reply)); + jobject value_replyInsideOptional; + if (cppValue.reply.Value().IsNull()) + { + value_replyInsideOptional = nullptr; + } + else + { + LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(cppValue.reply.Value().Value(), + value_replyInsideOptional)); + } + chip::JniReferences::GetInstance().CreateOptional(value_replyInsideOptional, value_reply); } jobject value_futureMessagesPreference; @@ -5268,7 +5287,7 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & jmethodID messageCompleteStructCtor; err = chip::JniReferences::GetInstance().FindMethod(env, messageCompleteStructClass, "", - "([BLjava/lang/Long;Ljava/lang/String;Ljava/lang/Integer;)V", + "([BLjava/util/Optional;Ljava/util/Optional;Ljava/lang/Integer;)V", &messageCompleteStructCtor); if (err != CHIP_NO_ERROR || messageCompleteStructCtor == nullptr) { diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index f9c83663ca72e5..3d2d8ead23e721 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6575,7 +6575,7 @@ class ChipClusters: "commandId": 0x00000001, "commandName": "CancelMessagesRequest", "args": { - "messages": "MessageStruct", + "messageIDs": "bytes", }, }, }, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index d9f83e869bf7ce..d3bc8372e5525b 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -23287,10 +23287,10 @@ class CancelMessagesRequest(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="messages", Tag=0, Type=typing.List[Messages.Structs.MessageStruct]), + ClusterObjectFieldDescriptor(Label="messageIDs", Tag=0, Type=typing.List[bytes]), ]) - messages: 'typing.List[Messages.Structs.MessageStruct]' = field(default_factory=lambda: []) + messageIDs: 'typing.List[bytes]' = field(default_factory=lambda: []) class Attributes: @dataclass @@ -23475,14 +23475,14 @@ def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ ClusterObjectFieldDescriptor(Label="messageID", Tag=0, Type=bytes), - ClusterObjectFieldDescriptor(Label="responseID", Tag=1, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="reply", Tag=2, Type=typing.Union[Nullable, str]), + ClusterObjectFieldDescriptor(Label="responseID", Tag=1, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="reply", Tag=2, Type=typing.Union[None, Nullable, str]), ClusterObjectFieldDescriptor(Label="futureMessagesPreference", Tag=3, Type=typing.Union[Nullable, Messages.Enums.FutureMessagePreferenceEnum]), ]) messageID: 'bytes' = b"" - responseID: 'typing.Union[Nullable, uint]' = NullValue - reply: 'typing.Union[Nullable, str]' = NullValue + responseID: 'typing.Union[None, Nullable, uint]' = None + reply: 'typing.Union[None, Nullable, str]' = None futureMessagesPreference: 'typing.Union[Nullable, Messages.Enums.FutureMessagePreferenceEnum]' = NullValue diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 35c5e3ed233baf..6dd11137d0f2d8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -5544,7 +5544,7 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRMessagesClusterCancelMessagesRequestParams : NSObject -@property (nonatomic, copy) NSArray * _Nonnull messages MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull messageIDs 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 68efecd78be904..aef5a0b8d4dbae 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -15568,7 +15568,7 @@ - (instancetype)init { if (self = [super init]) { - _messages = [NSArray array]; + _messageIDs = [NSArray array]; _timedInvokeTimeoutMs = nil; _serverSideProcessingTimeout = nil; } @@ -15579,7 +15579,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; { auto other = [[MTRMessagesClusterCancelMessagesRequestParams alloc] init]; - other.messages = self.messages; + other.messageIDs = self.messageIDs; other.timedInvokeTimeoutMs = self.timedInvokeTimeoutMs; other.serverSideProcessingTimeout = self.serverSideProcessingTimeout; @@ -15588,7 +15588,7 @@ - (id)copyWithZone:(NSZone * _Nullable)zone; - (NSString *)description { - NSString * descriptionString = [NSString stringWithFormat:@"<%@: messages:%@; >", NSStringFromClass([self class]), _messages]; + NSString * descriptionString = [NSString stringWithFormat:@"<%@: messageIDs:%@; >", NSStringFromClass([self class]), _messageIDs]; return descriptionString; } @@ -15602,73 +15602,25 @@ - (CHIP_ERROR)_encodeToTLVReader:(chip::System::PacketBufferTLVReader &)reader ListFreer listFreer; { { - using ListType_0 = std::remove_reference_t; + using ListType_0 = std::remove_reference_t; using ListMemberType_0 = ListMemberTypeGetter::Type; - if (self.messages.count != 0) { - auto * listHolder_0 = new ListHolder(self.messages.count); + if (self.messageIDs.count != 0) { + auto * listHolder_0 = new ListHolder(self.messageIDs.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.messages.count; ++i_0) { - if (![self.messages[i_0] isKindOfClass:[MTRMessagesClusterMessageStruct class]]) { + for (size_t i_0 = 0; i_0 < self.messageIDs.count; ++i_0) { + if (![self.messageIDs[i_0] isKindOfClass:[NSData class]]) { // Wrong kind of value. return CHIP_ERROR_INVALID_ARGUMENT; } - auto element_0 = (MTRMessagesClusterMessageStruct *) self.messages[i_0]; - listHolder_0->mList[i_0].messageID = AsByteSpan(element_0.messageID); - listHolder_0->mList[i_0].priority = static_castmList[i_0].priority)>>(element_0.priority.unsignedCharValue); - listHolder_0->mList[i_0].messageControl = static_castmList[i_0].messageControl)>>(element_0.messageControl.unsignedCharValue); - if (element_0.startTime == nil) { - listHolder_0->mList[i_0].startTime.SetNull(); - } else { - auto & nonNullValue_2 = listHolder_0->mList[i_0].startTime.SetNonNull(); - nonNullValue_2 = element_0.startTime.unsignedIntValue; - } - if (element_0.duration == nil) { - listHolder_0->mList[i_0].duration.SetNull(); - } else { - auto & nonNullValue_2 = listHolder_0->mList[i_0].duration.SetNonNull(); - nonNullValue_2 = element_0.duration.unsignedShortValue; - } - listHolder_0->mList[i_0].messageText = AsCharSpan(element_0.messageText); - if (element_0.responses != nil) { - auto & definedValue_2 = listHolder_0->mList[i_0].responses.Emplace(); - { - using ListType_3 = std::remove_reference_t; - using ListMemberType_3 = ListMemberTypeGetter::Type; - if (element_0.responses.count != 0) { - auto * listHolder_3 = new ListHolder(element_0.responses.count); - if (listHolder_3 == nullptr || listHolder_3->mList == nullptr) { - return CHIP_ERROR_INVALID_ARGUMENT; - } - listFreer.add(listHolder_3); - for (size_t i_3 = 0; i_3 < element_0.responses.count; ++i_3) { - if (![element_0.responses[i_3] isKindOfClass:[MTRMessagesClusterMessageResponseOptionStruct class]]) { - // Wrong kind of value. - return CHIP_ERROR_INVALID_ARGUMENT; - } - auto element_3 = (MTRMessagesClusterMessageResponseOptionStruct *) element_0.responses[i_3]; - if (element_3.messageResponseID != nil) { - auto & definedValue_5 = listHolder_3->mList[i_3].messageResponseID.Emplace(); - definedValue_5 = element_3.messageResponseID.unsignedIntValue; - } - if (element_3.label != nil) { - auto & definedValue_5 = listHolder_3->mList[i_3].label.Emplace(); - definedValue_5 = AsCharSpan(element_3.label); - } - } - definedValue_2 = ListType_3(listHolder_3->mList, element_0.responses.count); - } else { - definedValue_2 = ListType_3(); - } - } - } - listHolder_0->mList[i_0].fabricIndex = element_0.fabricIndex.unsignedCharValue; + auto element_0 = (NSData *) self.messageIDs[i_0]; + listHolder_0->mList[i_0] = AsByteSpan(element_0); } - encodableStruct.messages = ListType_0(listHolder_0->mList, self.messages.count); + encodableStruct.messageIDs = ListType_0(listHolder_0->mList, self.messageIDs.count); } else { - encodableStruct.messages = ListType_0(); + encodableStruct.messageIDs = ListType_0(); } } } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index a8228964b5d353..431d29dac94ef3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2844,24 +2844,32 @@ static id _Nullable DecodeEventPayloadForMessagesCluster(EventId aEventId, TLV:: } while (0); do { NSNumber * _Nullable memberValue; - if (cppValue.responseID.IsNull()) { - memberValue = nil; + if (cppValue.responseID.HasValue()) { + if (cppValue.responseID.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedInt:cppValue.responseID.Value().Value()]; + } } else { - memberValue = [NSNumber numberWithUnsignedInt:cppValue.responseID.Value()]; + memberValue = nil; } value.responseID = memberValue; } while (0); do { NSString * _Nullable memberValue; - if (cppValue.reply.IsNull()) { - memberValue = nil; - } else { - memberValue = AsString(cppValue.reply.Value()); - if (memberValue == nil) { - CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; - *aError = err; - return nil; + if (cppValue.reply.HasValue()) { + if (cppValue.reply.Value().IsNull()) { + memberValue = nil; + } else { + memberValue = AsString(cppValue.reply.Value().Value()); + if (memberValue == nil) { + CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; + *aError = err; + return nil; + } } + } else { + memberValue = nil; } value.reply = memberValue; } while (0); 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 d402dc9b205aa3..5bd0f13ade5424 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 @@ -15018,7 +15018,7 @@ namespace CancelMessagesRequest { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; - encoder.Encode(to_underlying(Fields::kMessages), messages); + encoder.Encode(to_underlying(Fields::kMessageIDs), messageIDs); return encoder.Finalize(); } @@ -15036,9 +15036,9 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kMessages)) + if (__context_tag == to_underlying(Fields::kMessageIDs)) { - err = DataModel::Decode(reader, messages); + err = DataModel::Decode(reader, messageIDs); } else { 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 c8c37288e42495..f88ea53814db98 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 @@ -21144,7 +21144,7 @@ struct DecodableType namespace CancelMessagesRequest { enum class Fields : uint8_t { - kMessages = 0, + kMessageIDs = 0, }; struct Type @@ -21154,7 +21154,7 @@ struct Type static constexpr CommandId GetCommandId() { return Commands::CancelMessagesRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Messages::Id; } - DataModel::List messages; + DataModel::List messageIDs; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -21169,7 +21169,7 @@ struct DecodableType static constexpr CommandId GetCommandId() { return Commands::CancelMessagesRequest::Id; } static constexpr ClusterId GetClusterId() { return Clusters::Messages::Id; } - DataModel::DecodableList messages; + DataModel::DecodableList messageIDs; CHIP_ERROR Decode(TLV::TLVReader & reader); }; }; // namespace CancelMessagesRequest @@ -21345,8 +21345,8 @@ struct Type static constexpr bool kIsFabricScoped = false; chip::ByteSpan messageID; - DataModel::Nullable responseID; - DataModel::Nullable reply; + Optional> responseID; + Optional> reply; DataModel::Nullable futureMessagesPreference; CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; @@ -21360,8 +21360,8 @@ struct DecodableType static constexpr ClusterId GetClusterId() { return Clusters::Messages::Id; } chip::ByteSpan messageID; - DataModel::Nullable responseID; - DataModel::Nullable reply; + Optional> responseID; + Optional> reply; DataModel::Nullable futureMessagesPreference; CHIP_ERROR Decode(TLV::TLVReader & reader); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 489089495e4e8d..ac81a48f41d711 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -6867,9 +6867,9 @@ class MessagesCancelMessagesRequest : public ClusterCommand { public: MessagesCancelMessagesRequest(CredentialIssuerCommands * credsIssuerConfig) : - ClusterCommand("cancel-messages-request", credsIssuerConfig), mComplex_Messages(&mRequest.messages) + ClusterCommand("cancel-messages-request", credsIssuerConfig), mComplex_MessageIDs(&mRequest.messageIDs) { - AddArgument("Messages", &mComplex_Messages); + AddArgument("MessageIDs", &mComplex_MessageIDs); ClusterCommand::AddArguments(); } @@ -6896,8 +6896,7 @@ class MessagesCancelMessagesRequest : public ClusterCommand private: chip::app::Clusters::Messages::Commands::CancelMessagesRequest::Type mRequest; - TypedComplexArgument> - mComplex_Messages; + TypedComplexArgument> mComplex_MessageIDs; }; /*----------------------------------------------------------------------------*\ 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 eecffe8adcfb01..e2c6a5640ba401 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -79174,10 +79174,10 @@ class MessagesCancelMessagesRequest : public ClusterCommand { public: MessagesCancelMessagesRequest() : ClusterCommand("cancel-messages-request") - , mComplex_Messages(&mRequest.messages) + , mComplex_MessageIDs(&mRequest.messageIDs) { #if MTR_ENABLE_PROVISIONAL - AddArgument("Messages", &mComplex_Messages); + AddArgument("MessageIDs", &mComplex_MessageIDs); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } @@ -79196,50 +79196,12 @@ class MessagesCancelMessagesRequest : public ClusterCommand { #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; - for (auto & entry_0 : mRequest.messages) { - MTRMessagesClusterMessageStruct * newElement_0; - newElement_0 = [MTRMessagesClusterMessageStruct new]; - newElement_0.messageID = [NSData dataWithBytes:entry_0.messageID.data() length:entry_0.messageID.size()]; - newElement_0.priority = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.priority)]; - newElement_0.messageControl = [NSNumber numberWithUnsignedChar:entry_0.messageControl.Raw()]; - if (entry_0.startTime.IsNull()) { - newElement_0.startTime = nil; - } else { - newElement_0.startTime = [NSNumber numberWithUnsignedInt:entry_0.startTime.Value()]; - } - if (entry_0.duration.IsNull()) { - newElement_0.duration = nil; - } else { - newElement_0.duration = [NSNumber numberWithUnsignedShort:entry_0.duration.Value()]; - } - newElement_0.messageText = [[NSString alloc] initWithBytes:entry_0.messageText.data() length:entry_0.messageText.size() encoding:NSUTF8StringEncoding]; - if (entry_0.responses.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - for (auto & entry_3 : entry_0.responses.Value()) { - MTRMessagesClusterMessageResponseOptionStruct * newElement_3; - newElement_3 = [MTRMessagesClusterMessageResponseOptionStruct new]; - if (entry_3.messageResponseID.HasValue()) { - newElement_3.messageResponseID = [NSNumber numberWithUnsignedInt:entry_3.messageResponseID.Value()]; - } else { - newElement_3.messageResponseID = nil; - } - if (entry_3.label.HasValue()) { - newElement_3.label = [[NSString alloc] initWithBytes:entry_3.label.Value().data() length:entry_3.label.Value().size() encoding:NSUTF8StringEncoding]; - } else { - newElement_3.label = nil; - } - [array_3 addObject:newElement_3]; - } - newElement_0.responses = array_3; - } - } else { - newElement_0.responses = nil; - } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + for (auto & entry_0 : mRequest.messageIDs) { + NSData * newElement_0; + newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; [array_0 addObject:newElement_0]; } - params.messages = array_0; + params.messageIDs = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); @@ -79263,7 +79225,7 @@ class MessagesCancelMessagesRequest : public ClusterCommand { private: chip::app::Clusters::Messages::Commands::CancelMessagesRequest::Type mRequest; - TypedComplexArgument> mComplex_Messages; + TypedComplexArgument> mComplex_MessageIDs; }; #endif // MTR_ENABLE_PROVISIONAL