From 138997171b6d444500df48252405c6dda22ee3c7 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 20 Jan 2023 13:10:25 -0500 Subject: [PATCH] Stop putting selectors on subclasses of command params structs. (#24543) That violates assumptions about being able to cast between the old and new names. Fixes https://github.com/project-chip/connectedhomeip/issues/24542 --- .../templates/MTRCommandPayloadsObjc-src.zapt | 9 ++------- .../CHIP/templates/MTRCommandPayloadsObjc.zapt | 12 ++---------- .../Framework/CHIP/templates/availability.yaml | 14 ++++++++++++++ .../zap-generated/MTRCommandPayloadsObjc.h | 18 ++++++++++-------- .../zap-generated/MTRCommandPayloadsObjc.mm | 6 ++++++ 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt index 521a1545088c8a..77a2c7b0a26d82 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt @@ -58,12 +58,6 @@ NS_ASSUME_NONNULL_BEGIN {{#*inline "oldNameImpl"}} @implementation MTR{{cluster}}Cluster{{command}}Params -{{#zcl_command_arguments}} -{{#if (hasOldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}} - -{{> renamed_struct_field_impl cluster=parent.parent.name type=type newName=label oldName=(oldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_command_arguments}} @end {{/inline}} {{#if (not (wasRemoved (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true)))}} @@ -74,7 +68,8 @@ NS_ASSUME_NONNULL_BEGIN (not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}} {{> oldNameImpl cluster=(compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)}} -{{else if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} +{{/if}} +{{#if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} {{#*inline "deprecatedImpl"}} @implementation MTR{{cluster}}Cluster{{command}}Params (Deprecated) diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt index 5951653fec9fc7..920ad066e14908 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt @@ -66,15 +66,6 @@ NS_ASSUME_NONNULL_BEGIN {{availability cluster command=command deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params")}} @interface MTR{{cluster}}Cluster{{command}}Params : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name}}Params -{{#zcl_command_arguments}} -{{#*inline "oldNameFieldDecl"}} - -{{> struct_field_decl cluster=parent.parent.name type=type label=commandField}} {{availability ../cluster command=../command commandField=commandField deprecationMessage=(concat "Please use " (asStructPropertyName label))}}; -{{/inline}} -{{#if (hasOldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}} -{{> oldNameFieldDecl commandField=(oldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}} -{{/if}} -{{/zcl_command_arguments}} @end {{/inline}} @@ -86,7 +77,8 @@ NS_ASSUME_NONNULL_BEGIN (not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}} {{> oldNameDecl cluster=(compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)}} -{{else if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} +{{/if}} +{{#if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}} {{#*inline "deprecatedDecl"}} @interface MTR{{cluster}}Cluster{{command}}Params (Deprecated) diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index de0b1294bf8c6e..7b3ffc45ca63e7 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -4954,6 +4954,9 @@ - location - requestorCanConsent - metadataForProvider + # Next two were introduced and deprecated at the same time, effectively + - vendorId + - productId QueryImageResponse: - status - delayedActionTime @@ -4979,6 +4982,9 @@ - announcementReason - metadataForNode - endpoint + # Next two were introduced and deprecated at the same time, effectively + - providerNodeId + - vendorId ClientMonitoring: RegisterClientMonitoring: - clientNodeId @@ -5647,6 +5653,14 @@ ColorControl: MoveToColorTemperature: - colorTemperature + OTASoftwareUpdateProvider: + QueryImage: + - vendorId + - productId + OTASoftwareUpdateRequestor: + AnnounceOTAProvider: + - providerNodeId + - vendorId structs: Descriptor: - DeviceType diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h index 31885d524ffdbe..97517f2d3d9362 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h @@ -1531,12 +1531,13 @@ MTR_NEWLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_NEWLY_DEPRECATED("Please use MTROTASoftwareUpdateProviderClusterQueryImageParams") @interface MTROtaSoftwareUpdateProviderClusterQueryImageParams : MTROTASoftwareUpdateProviderClusterQueryImageParams +@end + +@interface MTROTASoftwareUpdateProviderClusterQueryImageParams (Deprecated) -@property (nonatomic, copy) NSNumber * _Nonnull vendorId API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use vendorID"); +@property (nonatomic, copy) NSNumber * _Nonnull vendorId MTR_NEWLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull productId API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use productID"); +@property (nonatomic, copy) NSNumber * _Nonnull productId MTR_NEWLY_AVAILABLE; @end MTR_NEWLY_AVAILABLE @@ -1700,12 +1701,13 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_NEWLY_DEPRECATED("Please use MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams") @interface MTROtaSoftwareUpdateRequestorClusterAnnounceOtaProviderParams : MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams +@end + +@interface MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams (Deprecated) -@property (nonatomic, copy) NSNumber * _Nonnull providerNodeId API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use providerNodeID"); +@property (nonatomic, copy) NSNumber * _Nonnull providerNodeId MTR_NEWLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nonnull vendorId API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) - MTR_NEWLY_DEPRECATED("Please use vendorID"); +@property (nonatomic, copy) NSNumber * _Nonnull vendorId MTR_NEWLY_AVAILABLE; @end API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index d897cf6be7ca78..a43eb9531d91b4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -2144,6 +2144,9 @@ - (NSString *)description @end @implementation MTROtaSoftwareUpdateProviderClusterQueryImageParams +@end + +@implementation MTROTASoftwareUpdateProviderClusterQueryImageParams (Deprecated) - (void)setVendorId:(NSNumber * _Nonnull)vendorId { @@ -2374,6 +2377,9 @@ - (NSString *)description @end @implementation MTROtaSoftwareUpdateRequestorClusterAnnounceOtaProviderParams +@end + +@implementation MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams (Deprecated) - (void)setProviderNodeId:(NSNumber * _Nonnull)providerNodeId {