8000 [Darwin] Implement MTREventNameForID function by joonhaengHeo · Pull Request #34653 · project-chip/connectedhomeip · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Darwin] Implement MTREventNameForID function #34653

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 a 8000 gree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 31, 2024
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
9 changes: 9 additions & 0 deletions src/darwin/Framework/CHIP/MTRClusterNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@ MTR_EXTERN MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) NSSt
* will be returned.
*/
MTR_EXTERN MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType attributeID);

/**
* Resolve Matter event IDs into a descriptive string.
*
* For unknown IDs, a string '<Unknown clusterID %d>' (if the cluster ID is not known)
* or '<Unknown eventID %d>' (if the cluster ID is known but the event ID is not known)
* will be returned.
*/
MTR_EXTERN MTR_NEWLY_AVAILABLE NSString * MTREventNameForID(MTRClusterIDType clusterID, MTREventIDType eventID);
56 changes: 56 additions & 0 deletions src/darwin/Framework/CHIP/templates/MTRClusterNames-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,62 @@ NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType
result = [NSString stringWithFormat:@"<Unknown attributeID %d>", attributeID];
break;
}
break;
{{/if}}

{{/zcl_clusters}}
default:
result = [NSString stringWithFormat:@"<Unknown clusterID %d>", clusterID];
break;
}

return result;
}


#pragma mark - Event IDs

NSString * MTREventNameForID(MTRClusterIDType clusterID, MTREventIDType eventID)
{
NSString * result = nil;

switch (clusterID) {

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}}
{{~#*inline "cluster"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}}
case MTRClusterIDType{{>cluster}}ID:

switch (eventID) {

{{/if}}

{{#*inline "eventIDs"}}
{{#zcl_events}}
{{~#*inline "cluster"}}{{asUpperCamelCase ../clusterName preserveAcronyms=true}}{{/inline~}}
{{~#*inline "event"}}{{asUpperCamelCase name preserveAcronyms=true}}{{/inline~}}
{{#first}}
{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) isForIds=true)}}
81BC // Cluster {{> cluster}} events
{{/if}}
{{/first}}
{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)}}
case MTREventIDTypeCluster{{>cluster}}Event{{>event}}ID:
result = @"{{>event}}";
break;

{{/if}}
{{/zcl_events}}
{{/inline}}

{{> eventIDs clusterName=label}}

{{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}}
default:
result = [NSString stringWithFormat:@"<Unknown eventID %d>", eventID];
break;
}
break;
{{/if}}

{{/zcl_clusters}}
Expand Down
Loading
Loading
0