Skip to content

Commit c4d4686

Browse files
Deprecate some clusters in Matter.framework that should never have shipped (#35584)
* Temporarily add clusters that should never have shipped to availability.yaml as deprecated. BarrierControl, BinaryInputBasic, ElectricalMeasurement, OnOffSwitchConfiguration were never certifiable and should not have shipped. Add them as deprecated with a dummy release that has some future-enough version numbers. * Regenerate generated code with deprecations. * Mark these clusters as removed and move them out of generated code and into manual shims. This should only have moved code, not new code. * Regenerate generated code with the clusters removed. This has no changes to API headers. * Regenerate darwin-framework-tool.
1 parent 54127b9 commit c4d4686

25 files changed

+128114
-146572
lines changed

src/darwin/Framework/CHIP/MTRBackwardsCompatShims.h

+3,197
Large diffs are not rendered by default.

src/darwin/Framework/CHIP/MTRBackwardsCompatShims.mm

+14,888
Large diffs are not rendered by default.

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
1616
*
1717
* {{description}}
1818
*/
19-
{{availability (asUpperCamelCase name preserveAcronyms=true)}}
19+
{{availability (asUpperCamelCase name preserveAcronyms=true) deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}}
2020
@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRGenericBaseCluster
2121

2222
{{#zcl_commands}}
@@ -29,20 +29,20 @@ NS_ASSUME_NONNULL_BEGIN
2929
*
3030
* {{description}}
3131
*/
32-
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
32+
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField }}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
3333
{{#unless commandHasRequiredField}}
3434
- (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion
3535
{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }}
3636
{{#if (and (isStrEqual command "KeySetReadAllIndices")
3737
(isStrEqual cluster "GroupKeyManagement"))}}
38-
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}};
38+
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691" deprecationMessage="This command is deprecated"}};
3939
{{else}}
4040
{{#if (isInConfigList
4141
(concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true))
4242
"LegacyCommandsWithOnlyOptionalArguments")}}
43-
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A"}};
43+
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A" deprecationMessage="This command is deprecated"}};
4444
{{else}}
45-
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
45+
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
4646
{{/if}}
4747
{{/if}}
4848
{{/unless}}
@@ -62,16 +62,16 @@ NS_ASSUME_NONNULL_BEGIN
6262
{{~else~}}
6363
Completion:
6464
{{~/if_is_fabric_scoped_struct~}}
65-
(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
65+
(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
6666
{{#if (or isWritableAttribute
6767
(isInConfigList (concat (asUpperCamelCase parent.name) "::" label) "DarwinForceWritable"))}}
68-
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
69-
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
68+
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
69+
- (void)write{{>attribute}}WithValue:({{asObjectiveCType type parent.name}})value params:(MTRWriteParams * _Nullable)params completion:(MTRStatusCompletion)completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
7070
{{/if}}
7171
{{#if isReportableAttribute}}
7272
- (void) subscribe{{>attribute}}WithParams:(MTRSubscribeParams *)params
73-
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
74-
+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
73+
subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished reportHandler:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))reportHandler {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
74+
+ (void) read{{>attribute}}WithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error))completion {{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This attribute is deprecated"}};
7575
{{/if}}
7676
{{/if}}
7777
{{/zcl_attributes_server}}
@@ -89,7 +89,7 @@ subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptio
8989
*/
9090
- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device
9191
endpointID:(NSNumber *)endpointID
92-
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
92+
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}};
9393

9494
@end
9595
{{/if}}

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

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ MTRCluster{{compatClusterNameRemapping label}}ID {{availability (compatClusterNa
1818
MTRClusterIDType{{>cluster}}ID {{availability (asUpperCamelCase label preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" isForIds=true deprecationMessage=(concat "The " (asUpperCamelCase label preserveAcronyms=true) " cluster will be removed")}} = {{asMEI manufacturerCode code}},
1919
{{/if}}
2020
{{/zcl_clusters}}
21+
22+
{{> cluster_id_shims}}
2123
};
2224

2325
#pragma mark - Attributes IDs
@@ -112,6 +114,8 @@ MTRAttributeIDTypeCluster{{compatClusterNameRemapping ../clusterName}}Attribute{
112114

113115
{{> attributeIDs clusterName=label}}
114116
{{/zcl_clusters}}
117+
118+
{{> attribute_id_shims}}
115119
};
116120

117121
#pragma mark - Commands IDs
@@ -174,6 +178,8 @@ MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{availability cluster co
174178

175179
{{> commandIDs clusterName=label}}
176180
{{/zcl_clusters}}
181+
182+
{{> command_id_shims}}
177183
};
178184

179185
#pragma mark - Events IDs

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ NS_ASSUME_NONNULL_BEGIN
1616
* Cluster {{name}}
1717
* {{description}}
1818
*/
19-
{{availability (asUpperCamelCase name preserveAcronyms=true)}}
19+
{{availability (asUpperCamelCase name preserveAcronyms=true) deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}}
2020
@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRGenericCluster
2121

2222
{{#zcl_commands}}
2323
{{#if (is_str_equal source 'client')}}
2424
{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }}
2525
{{#*inline "commandDecl"}}
2626
{{#if (isSupported cluster command=command)}}
27-
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
27+
- (void){{asLowerCamelCase name}}WithParams:(MTR{{cluster}}Cluster{{command}}Params * {{#unless commandHasRequiredField}}_Nullable{{/unless}})params expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion {{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
2828
{{#unless commandHasRequiredField}}
2929
- (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion
3030
{{! KeySetReadAllIndices grew this params-less API later _after_ it had already been shipped, so it needs to be special-cased here }}
3131
{{#if (and (isStrEqual command "KeySetReadAllIndices")
3232
(isStrEqual cluster "GroupKeyManagement"))}}
33-
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691"}};
33+
{{availability cluster command=command minimalRelease="3C23F160-13CE-4397-BC65-122B61E4D691" deprecationMessage="This command is deprecated"}};
3434
{{else}}
3535
{{#if (isInConfigList
3636
(concat (asUpperCamelCase cluster preserveAcronyms=true) "::" (asUpperCamelCase command preserveAcronyms=true))
3737
"LegacyCommandsWithOnlyOptionalArguments")}}
38-
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A"}};
38+
{{availability cluster command=command minimalRelease="ADDB2DC1-4701-4696-87EB-87CD1123BE1A" deprecationMessage="This command is deprecated"}};
3939
{{else}}
40-
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
40+
{{availability cluster command=command minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage="This command is deprecated"}};
4141
{{/if}}
4242
{{/if}}
4343
{{/unless}}
@@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
5454
(isSupported (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)))}}
5555
{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}}
5656
{{#*inline "availability"}}
57-
{{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true)}}
57+
{{availability (asUpperCamelCase parent.name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true) deprecationMessage="This attribute is deprecated"}}
5858
{{/inline}}
5959
- (NSDictionary<NSString *, id> * _Nullable)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params {{> availability}};
6060
{{#if (or isWritableAttribute
@@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN
8585
*/
8686
- (instancetype _Nullable)initWithDevice:(MTRDevice *)device
8787
endpointID:(NSNumber *)endpointID
88-
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE"}};
88+
queue:(dispatch_queue_t)queue {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="267F4B03-3256-4056-A62D-5237640FDCFE" deprecationMessage=(concat (asUpperCamelCase name preserveAcronyms=true) " is deprecated and will be removed")}};
8989

9090
@end
9191

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ NS_ASSUME_NONNULL_BEGIN
3636
- (NSDictionary<NSString *, id> * _Nullable)_encodeAsDataValue:(NSError * __autoreleasing *)error;
3737
@end
3838

39-
NS_ASSUME_NONNULL_END
39+
NS_ASSUME_NONNULL_END

src/darwin/Framework/CHIP/templates/availability.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -9937,6 +9937,11 @@
99379937
- ColorCapabilities
99389938
- ColorLoopUpdateFlags
99399939
removed:
9940+
clusters:
9941+
- BarrierControl
9942+
- BinaryInputBasic
9943+
- ElectricalMeasurement
9944+
- OnOffSwitchConfiguration
99409945
enum values:
99419946
ColorControl:
99429947
# Don't expose the new value names on the old enum names

0 commit comments

Comments
 (0)