-
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.
finish generating write attributes (#11804)
* finish generating write attributes * refactor for comments * resolve comments * swap public and static keyword
- Loading branch information
1 parent
6bf7a59
commit 3274723
Showing
8 changed files
with
8,364 additions
and
6,629 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
45 changes: 45 additions & 0 deletions
45
src/controller/java/templates/ClusterInfo-read-interaction.zapt
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,45 @@ | ||
{{> header}} | ||
{{#if (chip_has_client_clusters)}} | ||
|
||
package chip.devicecontroller; | ||
|
||
import chip.clusterinfo.CommandParameterInfo; | ||
import chip.clusterinfo.InteractionInfo; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class ClusterReadMapping { | ||
|
||
public Map<String, Map<String, InteractionInfo>> getReadAttributeMap() { | ||
Map<String, Map<String, InteractionInfo>> readAttributeMap = new HashMap<>(); | ||
{{#chip_client_clusters}} | ||
Map<String, InteractionInfo> read{{asUpperCamelCase name}}InteractionInfo = new LinkedHashMap<>(); | ||
{{#chip_server_cluster_attributes}} | ||
Map<String, CommandParameterInfo> read{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); | ||
InteractionInfo read{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}AttributeInteractionInfo = new InteractionInfo( | ||
(cluster, callback, commandArguments) -> { | ||
((ChipClusters.{{asUpperCamelCase ../name}}Cluster) cluster).read{{asUpperCamelCase name}}Attribute( | ||
{{#if isList}} | ||
(ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}AttributeCallback) callback | ||
{{else}} | ||
(ChipClusters.{{convertAttributeCallbackTypeToJavaName chipCallback.type}}AttributeCallback) callback | ||
{{/if}} | ||
); | ||
}, | ||
{{#if isList}} | ||
() -> new ClusterInfoMapping.Delegated{{asUpperCamelCase name}}AttributeCallback(), | ||
{{else}} | ||
() -> new ClusterInfoMapping.Delegated{{convertAttributeCallbackTypeToJavaName chipCallback.type}}AttributeCallback(), | ||
{{/if}} | ||
read{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams | ||
); | ||
read{{asUpperCamelCase ../name}}InteractionInfo.put("read{{asUpperCamelCase name}}Attribute", read{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}AttributeInteractionInfo); | ||
{{/chip_server_cluster_attributes}} | ||
readAttributeMap.put("{{asLowerCamelCase name}}", read{{asUpperCamelCase name}}InteractionInfo); | ||
{{/chip_client_clusters}} | ||
return readAttributeMap; | ||
} | ||
} | ||
|
||
{{/if}} |
43 changes: 43 additions & 0 deletions
43
src/controller/java/templates/ClusterInfo-write-interaction.zapt
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,43 @@ | ||
{{> header}} | ||
{{#if (chip_has_client_clusters)}} | ||
|
||
package chip.devicecontroller; | ||
|
||
import chip.clusterinfo.CommandParameterInfo; | ||
import chip.clusterinfo.InteractionInfo; | ||
import chip.devicecontroller.ChipClusters.DefaultClusterCallback; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class ClusterWriteMapping { | ||
public Map<String, Map<String, InteractionInfo>> getWriteAttributeMap() { | ||
Map<String, Map<String, InteractionInfo>> writeAttributeMap = new HashMap<>(); | ||
{{#chip_client_clusters}} | ||
Map<String, InteractionInfo> write{{asUpperCamelCase name}}InteractionInfo = new LinkedHashMap<>(); | ||
{{#chip_server_cluster_attributes}} | ||
{{#if isWritableAttribute}} | ||
Map<String, CommandParameterInfo> write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); | ||
CommandParameterInfo {{asLowerCamelCase ../name}}{{asLowerCamelCase name}}CommandParameterInfo = new CommandParameterInfo("value", {{asJavaBasicType type}}.class); | ||
write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams.put("value",{{asLowerCamelCase ../name}}{{asLowerCamelCase name}}CommandParameterInfo); | ||
InteractionInfo write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}AttributeInteractionInfo = new InteractionInfo( | ||
(cluster, callback, commandArguments) -> { | ||
((ChipClusters.{{asUpperCamelCase ../name}}Cluster) cluster).write{{asUpperCamelCase name}}Attribute( | ||
(DefaultClusterCallback) callback, | ||
({{asJavaBoxedType type}}) | ||
commandArguments.get("value") | ||
); | ||
}, | ||
() -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), | ||
write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams | ||
); | ||
write{{asUpperCamelCase ../name}}InteractionInfo.put("write{{asUpperCamelCase name}}Attribute", write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}AttributeInteractionInfo); | ||
{{/if}} | ||
{{/chip_server_cluster_attributes}} | ||
writeAttributeMap.put("{{asLowerCamelCase name}}", write{{asUpperCamelCase name}}InteractionInfo); | ||
{{/chip_client_clusters}} | ||
return writeAttributeMap; | ||
} | ||
} | ||
|
||
{{/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.