Skip to content

Commit 3801260

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Fix some loose ends from the acronym casing Darwin changes. (#23845)
* Fix deprecation messages to reference the right selectors. * Fix bitmaps to handle cluster renames the same way enums do, instead of hardcoding UnitTesting/TestCluster.
1 parent b4b7505 commit 3801260

File tree

2 files changed

+37
-43
lines changed

2 files changed

+37
-43
lines changed

src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt

+14-20
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ MTR_NEWLY_DEPRECATED("Please use {{objCEnumName (asUpperCamelCase ../name preser
8888
{{/unless}}
8989
;
9090

91-
{{#if (isStrEqual (asUpperCamelCase ../name) "UnitTesting")}}
92-
93-
{{/if}}
9491
{{/zcl_enums}}
9592
{{#zcl_bitmaps}}
9693
{{#*inline "bitmapDef"}}
@@ -100,29 +97,26 @@ typedef NS_OPTIONS({{asUnderlyingZclType name}}, {{objCEnumName clusterName labe
10097
{{/zcl_bitmap_items}}
10198
}
10299
{{! TODO: We need a better setup for the API_AVALABLE annotations here; this does not scale at all sanely. }}
103-
{{#if (isStrEqual (asUpperCamelCase ../name) "Switch")}}
100+
{{#if (isStrEqual (asUpperCamelCase clusterName) "Switch")}}
104101
{{#if (isStrEqual (asUpperCamelCase label) "SwitchFeature")}}
105102
API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2))
106103
{{/if}}
107104
{{/if}}
108-
{{#if (isStrEqual (asUpperCamelCase ../name) "MediaPlayback")}}
105+
{{#if (isStrEqual (asUpperCamelCase clusterName) "MediaPlayback")}}
109106
{{#if (isStrEqual (asUpperCamelCase label) "MediaPlaybackFeature")}}
110107
API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2))
111108
{{/if}}
112109
{{/if}}
113-
{{#if (isStrEqual (asUpperCamelCase clusterName) "UnitTesting")}}
114-
MTR_NEWLY_AVAILABLE
115-
{{else if (isStrEqual (asUpperCamelCase clusterName) "TestCluster")}}
116-
MTR_NEWLY_DEPRECATED("Please use {{objCEnumName "UnitTesting" label}}")
117-
{{/if}}
118-
;
119110
{{/inline}}
120-
{{> bitmapDef name=name clusterName=../name label=label}}
111+
{{> bitmapDef name=name clusterName=(asUpperCamelCase ../name preserveAcronyms=true) label=label}}
112+
{{#unless (isStrEqual (asUpperCamelCase ../name preserveAcronyms=true) (compatClusterNameRemapping ../name))}}
113+
MTR_NEWLY_AVAILABLE;
121114

122-
{{#if (isStrEqual (asUpperCamelCase ../name) "UnitTesting")}}
123-
{{> bitmapDef name=name clusterName="TestCluster" label=label}}
115+
{{> bitmapDef name=name clusterName=(compatClusterNameRemapping ../name) label=label}}
116+
MTR_NEWLY_DEPRECATED("Please use {{objCEnumName (asUpperCamelCase ../name preserveAcronyms=true) label}}")
117+
{{/unless}}
118+
;
124119

125-
{{/if}}
126120
{{/zcl_bitmaps}}
127121
{{/zcl_clusters}}
128122

@@ -153,21 +147,21 @@ MTR_NEWLY_DEPRECATED("Please use {{objCEnumName "UnitTesting" label}}")
153147
CompletionHandler:
154148
{{~/if_is_fabric_scoped_struct~}}
155149
(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{#if (isStrEqual (asUpperCamelCase parent.name) "UnitTesting")}}{{#if (isStrEqual (asUpperCamelCase name) "WriteOnlyInt8u")}}API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)){{/if}}{{/if}}
156-
MTR_NEWLY_DEPRECATED("Please use read{{>attribute}}With{{#if_is_fabric_scoped_struct type}}Params:completion:{{else}}Completion:{{/if_is_fabric_scoped_struct}}");
150+
MTR_NEWLY_DEPRECATED("Please use readAttribute{{asUpperCamelCase name preserveAcronyms=true}}With{{#if_is_fabric_scoped_struct type}}Params:completion:{{else}}Completion:{{/if_is_fabric_scoped_struct}}");
157151
{{#if isWritableAttribute}}
158152
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value completionHandler:(MTRStatusCompletion)completionHandler {{#if (isStrEqual (asUpperCamelCase parent.name) "UnitTesting")}}{{#if (isStrEqual (asUpperCamelCase name) "WriteOnlyInt8u")}}API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)){{/if}}{{/if}}
159-
MTR_NEWLY_DEPRECATED("Please use write{{>attribute}}WithValue:completion:");
153+
MTR_NEWLY_DEPRECATED("Please use writeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithValue:completion:");
160154
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name compatRemapClusterName=true}})value params:(MTRWriteParams * _Nullable)params completionHandler:(MTRStatusCompletion)completionHandler {{#if (isStrEqual (asUpperCamelCase parent.name) "UnitTesting")}}{{#if (isStrEqual (asUpperCamelCase name) "WriteOnlyInt8u")}}API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)){{/if}}{{/if}}
161-
MTR_NEWLY_DEPRECATED("Please use write{{>attribute}}WithValue:params:completion:");
155+
MTR_NEWLY_DEPRECATED("Please use writeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithValue:params:completion:");
162156
{{/if}}
163157
{{#if isReportableAttribute}}
164158
{{! TODO: We need a better setup for the API_AVALABLE annotations here; this does not scale at all sanely. }}
165159
- (void) subscribe{{>attribute}}WithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval
166160
params:(MTRSubscribeParams * _Nullable)params
167161
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))reportHandler {{#if (isStrEqual (asUpperCamelCase parent.name) "UnitTesting")}}{{#if (isStrEqual (asUpperCamelCase name) "WriteOnlyInt8u")}}API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)){{/if}}{{/if}}
168-
MTR_NEWLY_DEPRECATED("Please use subscribe{{>attribute}}WithParams:subscriptionEstablished:");
162+
MTR_NEWLY_DEPRECATED("Please use subscribeAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithParams:subscriptionEstablished:");
169163
+ (void) read{{>attribute}}WithAttributeCache:(MTRAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler:(void (^)({{asObjectiveCClass type parent.name compatRemapClusterName=true}} * _Nullable value, NSError * _Nullable error))completionHandler {{#if (isStrEqual (asUpperCamelCase parent.name) "UnitTesting")}}{{#if (isStrEqual (asUpperCamelCase name) "WriteOnlyInt8u")}}API_AVAILABLE(ios(16.2), macos(13.1), watchos(9.2), tvos(16.2)){{/if}}{{/if}}
170-
MTR_NEWLY_DEPRECATED("Please use read{{>attribute}}WithAttributeCache:endpoint:queue:completion:");
164+
MTR_NEWLY_DEPRECATED("Please use readAttribute{{asUpperCamelCase name preserveAcronyms=true}}WithAttributeCache:endpoint:queue:completion:");
171165
{{/if}}
172166
{{/chip_server_cluster_attributes}}
173167

src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

+23-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)