-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Add utility for translating cluster/attribute ids to names (#…
…15749) * Add utility for translating cluster/attribute ids to names * Restyled by whitespace Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
Showing
6 changed files
with
2,762 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{{> header}} | ||
{{#if (chip_has_client_clusters)}} | ||
|
||
package chip.devicecontroller; | ||
|
||
public final class ChipIdLookup { | ||
/** | ||
* Translates cluster ID to a cluster name in upper camel case. If no matching | ||
* ID is found, returns an empty string. | ||
*/ | ||
public static String clusterIdToName(long clusterId) { | ||
{{#chip_client_clusters}} | ||
if (clusterId == {{code}}L) { | ||
return "{{asUpperCamelCase name}}"; | ||
} | ||
{{/chip_client_clusters}} | ||
return ""; | ||
} | ||
|
||
/** | ||
* Translates cluster ID and attribute ID to an attribute name in upper camel case. | ||
* If no matching IDs are found, returns an empty string. | ||
*/ | ||
public static String attributeIdToName(long clusterId, long attributeId) { | ||
{{#chip_client_clusters}} | ||
if (clusterId == {{code}}L) { | ||
{{#chip_server_cluster_attributes}} | ||
if (attributeId == {{code}}L) { | ||
return "{{asUpperCamelCase name}}"; | ||
} | ||
{{/chip_server_cluster_attributes}} | ||
return ""; | ||
} | ||
{{/chip_client_clusters}} | ||
return ""; | ||
} | ||
} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.