|
| 1 | +{{> header excludeZapComment=true}} |
| 2 | + |
| 3 | + |
| 4 | +#import <Matter/MTRClusterNames.h> |
| 5 | + |
| 6 | +// @implementation MTRClusterAttributeIDType |
| 7 | + |
| 8 | +#pragma mark - Clusters IDs |
| 9 | + |
| 10 | +NSString * MTRClusterNameForID(MTRClusterIDType clusterID) |
| 11 | +{ |
| 12 | + NSString * result = nil; |
| 13 | + |
| 14 | + switch (clusterID) { |
| 15 | + |
| 16 | +{{#zcl_clusters}} |
| 17 | +{{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} |
| 18 | +{{~#*inline "cluster"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} |
| 19 | + case MTRClusterIDType{{>cluster}}ID: |
| 20 | + result = @"{{>cluster}}"; |
| 21 | + break; |
| 22 | +{{/if}} |
| 23 | +{{/zcl_clusters}} |
| 24 | + |
| 25 | + default: |
| 26 | + result = [NSString stringWithFormat:@"<Unknown clusterID %d>", clusterID]; |
| 27 | + break; |
| 28 | + } |
| 29 | + |
| 30 | + return result; |
| 31 | +} |
| 32 | + |
| 33 | + |
| 34 | +#pragma mark - Attributes IDs |
| 35 | + |
| 36 | +NSString * MTRAttributeNameForID(MTRClusterIDType clusterID, MTRAttributeIDType attributeID) |
| 37 | +{ |
| 38 | + NSString * result = nil; |
| 39 | + |
| 40 | + switch (clusterID) { |
| 41 | + |
| 42 | +{{#zcl_clusters}} |
| 43 | +{{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} |
| 44 | +{{~#*inline "cluster"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} |
| 45 | + case MTRClusterIDType{{>cluster}}ID: |
| 46 | + |
| 47 | + switch (attributeID) { |
| 48 | + |
| 49 | +{{/if}} |
| 50 | + |
| 51 | +{{#*inline "attributeIDs"}} |
| 52 | +{{#zcl_attributes_server}} |
| 53 | +{{~#*inline "cluster"}}{{asUpperCamelCase ../clusterName preserveAcronyms=true}}{{/inline~}} |
| 54 | +{{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} |
| 55 | +{{#first}} |
| 56 | +{{#if (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) isForIds=true)}} |
| 57 | +// Cluster {{> cluster}} attributes |
| 58 | +{{/if}} |
| 59 | +{{/first}} |
| 60 | +{{#if (and (isSupported (asUpperCamelCase ../clusterName preserveAcronyms=true) attribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true) |
| 61 | + (or clusterRef |
| 62 | + (isSupported "" globalAttribute=(asUpperCamelCase label preserveAcronyms=true) isForIds=true)))}} |
| 63 | + case MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID: |
| 64 | + result = @"{{>attribute}}"; |
| 65 | + break; |
| 66 | + |
| 67 | +{{/if}} |
| 68 | +{{/zcl_attributes_server}} |
| 69 | +{{/inline}} |
| 70 | + |
| 71 | +{{> attributeIDs clusterName=label}} |
| 72 | + |
| 73 | +{{#if (isSupported (asUpperCamelCase label preserveAcronyms=true) isForIds=true)}} |
| 74 | + default: |
| 75 | + result = [NSString stringWithFormat:@"<Unknown attributeID %d>", attributeID]; |
| 76 | + break; |
| 77 | + } |
| 78 | +{{/if}} |
| 79 | + |
| 80 | +{{/zcl_clusters}} |
| 81 | + default: |
| 82 | + result = [NSString stringWithFormat:@"<Unknown clusterID %d>", clusterID]; |
| 83 | + break; |
| 84 | + } |
| 85 | + |
| 86 | + return result; |
| 87 | +} |
| 88 | + |
| 89 | +// @end |
0 commit comments