Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[darwin] Make sure the prefixes on the enum names match the type #22673

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

typedef NS_ENUM(uint32_t, MTRClusterIDType) {
{{#zcl_clusters}}
MTRCluster{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
MTRClusterIDType{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
{{/zcl_clusters}}
};

#pragma mark - Attributes IDs

typedef NS_ENUM(uint32_t, MTRClusterAttributeIDType) {
typedef NS_ENUM(uint32_t, MTRAttributeIDType) {
// Global attributes
{{#zcl_attributes_server}}
{{#unless clusterRef}}
MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
MTRAttributeIDTypeGlobalAttribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
{{/unless}}
{{/zcl_attributes_server}}

Expand All @@ -27,9 +27,9 @@ MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode
// Cluster {{asUpperCamelCase parent.label}} attributes
{{/first}}
{{#if clusterRef}}
MTRCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
MTRAttributeIDTypeCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
{{else}}
MTRCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID = MTRClusterGlobalAttribute{{asUpperCamelCase label}}ID,
MTRAttributeIDTypeCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID = MTRAttributeIDTypeGlobalAttribute{{asUpperCamelCase label}}ID,
{{/if}}
{{#last}}

Expand All @@ -40,13 +40,13 @@ MTRCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID

#pragma mark - Commands IDs

typedef NS_ENUM(uint32_t, MTRClusterCommandIDType) {
typedef NS_ENUM(uint32_t, MTRCommandIDType) {
{{#zcl_clusters}}
{{#zcl_commands}}
{{#first}}
// Cluster {{asUpperCamelCase parent.label}} commands
{{/first}}
MTRCluster{{asUpperCamelCase parent.label}}Command{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
MTRCommandIDTypeCluster{{asUpperCamelCase parent.label}}Command{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}},
{{#last}}

{{/last}}
Expand All @@ -56,13 +56,13 @@ MTRCluster{{asUpperCamelCase parent.label}}Command{{asUpperCamelCase label}}ID =

#pragma mark - Events IDs

typedef NS_ENUM(uint32_t, MTRClusterEventIDType) {
typedef NS_ENUM(uint32_t, MTREventIDType) {
{{#zcl_clusters}}
{{#zcl_events}}
{{#first}}
// Cluster {{asUpperCamelCase parent.label}} events
{{/first}}
MTRCluster{{asUpperCamelCase parent.label}}Event{{asUpperCamelCase name}}ID = {{asMEI manufacturerCode code}},
MTREventIDTypeCluster{{asUpperCamelCase parent.label}}Event{{asUpperCamelCase name}}ID = {{asMEI manufacturerCode code}},
{{#last}}

{{/last}}
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ using chip::SessionHandle;
{{#chip_server_cluster_attributes}}
{{#*inline "attribute"}}Attribute{{asUpperCamelCase name}}{{/inline}}
- (NSDictionary<NSString *, id> *)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params {
return [self.device readAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRCluster{{asUpperCamelCase parent.name}}ID) attributeID:@(MTRCluster{{asUpperCamelCase parent.name}}Attribute{{asUpperCamelCase name}}ID) params:params];
return [self.device readAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRClusterIDType{{asUpperCamelCase parent.name}}ID) attributeID:@(MTRAttributeIDTypeCluster{{asUpperCamelCase parent.name}}Attribute{{asUpperCamelCase name}}ID) params:params];
}

{{#if isWritableAttribute}}
Expand All @@ -128,7 +128,7 @@ using chip::SessionHandle;
}
{{/if}}

[self.device writeAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRCluster{{asUpperCamelCase parent.name}}ID) attributeID:@(MTRCluster{{asUpperCamelCase parent.name}}Attribute{{asUpperCamelCase name}}ID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout];
[self.device writeAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRClusterIDType{{asUpperCamelCase parent.name}}ID) attributeID:@(MTRAttributeIDTypeCluster{{asUpperCamelCase parent.name}}Attribute{{asUpperCamelCase name}}ID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout];
}

{{/if}}
Expand Down
Loading