-
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.
- Loading branch information
1 parent
dedc1cd
commit 61db15b
Showing
8 changed files
with
8,215 additions
and
8,201 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
57 changes: 57 additions & 0 deletions
57
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,57 @@ | ||
{{> header}} | ||
{{#if (chip_has_client_clusters)}} | ||
|
||
package chip.devicecontroller; | ||
|
||
import java.util.ArrayList; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import java.util.List; | ||
import java.util.HashMap; | ||
import chip.clusterinfo.ClusterInfo; | ||
import chip.clusterinfo.InteractionInfo; | ||
import chip.clusterinfo.CommandParameterInfo; | ||
import chip.clusterinfo.DelegatedClusterCallback; | ||
import chip.clusterinfo.ClusterCommandCallback; | ||
import chip.clusterinfo.CommandResponseInfo; | ||
import chip.devicecontroller.ChipClusters.DefaultClusterCallback; | ||
import chip.devicecontroller.ClusterInfoMapping.DelegatedIntegerAttributeCallback; | ||
|
||
|
||
|
||
public class ClusterReadMapping { | ||
|
||
public Map<String, Map<String, InteractionInfo>> getReadAttributeMap() { | ||
ClusterInfoMapping clusterInfoMapping = new ClusterInfoMapping(); | ||
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}} | ||
() -> clusterInfoMapping.new Delegated{{asUpperCamelCase name}}AttributeCallback(), | ||
{{else}} | ||
() -> clusterInfoMapping.new 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}} | ||
|
51 changes: 51 additions & 0 deletions
51
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,51 @@ | ||
{{> header}} | ||
{{#if (chip_has_client_clusters)}} | ||
|
||
package chip.devicecontroller; | ||
|
||
import java.util.ArrayList; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import java.util.List; | ||
import java.util.HashMap; | ||
import chip.clusterinfo.ClusterInfo; | ||
import chip.clusterinfo.InteractionInfo; | ||
import chip.clusterinfo.CommandParameterInfo; | ||
import chip.clusterinfo.DelegatedClusterCallback; | ||
import chip.clusterinfo.ClusterCommandCallback; | ||
import chip.clusterinfo.CommandResponseInfo; | ||
import chip.devicecontroller.ChipClusters.DefaultClusterCallback; | ||
|
||
|
||
public class ClusterWriteMapping { | ||
public Map<String, Map<String, InteractionInfo>> getWriteAttributeMap() { | ||
ClusterInfoMapping clusterInfoMapping = new ClusterInfoMapping(); | ||
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") | ||
); | ||
}, | ||
() -> clusterInfoMapping.new 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.