Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLiuZhuoCheng committed Nov 17, 2021
1 parent 61db15b commit 823ef7b
Show file tree
Hide file tree
Showing 6 changed files with 706 additions and 730 deletions.
17 changes: 8 additions & 9 deletions src/controller/java/templates/ClusterInfo-java.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import chip.devicecontroller.ChipClusters.DefaultClusterCallback;
import chip.devicecontroller.ClusterReadMapping;
import chip.devicecontroller.ClusterWriteMapping;


public class ClusterInfoMapping {

public class DelegatedCharStringAttributeCallback implements ChipClusters.CharStringAttributeCallback, DelegatedClusterCallback {
static public class DelegatedCharStringAttributeCallback implements ChipClusters.CharStringAttributeCallback, DelegatedClusterCallback {
/** Indicates a successful read for a CHAR_STRING attribute. */
private ClusterCommandCallback callback;

Expand All @@ -44,7 +43,7 @@ public class ClusterInfoMapping {
}
}

public class DelegatedOctetStringAttributeCallback implements ChipClusters.OctetStringAttributeCallback, DelegatedClusterCallback {
static public class DelegatedOctetStringAttributeCallback implements ChipClusters.OctetStringAttributeCallback, DelegatedClusterCallback {
/** Indicates a successful read for an OCTET_STRING attribute. */
private ClusterCommandCallback callback;

Expand All @@ -67,7 +66,7 @@ public class ClusterInfoMapping {
}
}

public class DelegatedIntegerAttributeCallback implements ChipClusters.IntegerAttributeCallback, DelegatedClusterCallback {
static public class DelegatedIntegerAttributeCallback implements ChipClusters.IntegerAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;

@Override
Expand All @@ -89,7 +88,7 @@ public class ClusterInfoMapping {
}
}

public class DelegatedLongAttributeCallback implements ChipClusters.LongAttributeCallback, DelegatedClusterCallback {
static public class DelegatedLongAttributeCallback implements ChipClusters.LongAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;

@Override
Expand All @@ -111,7 +110,7 @@ public class ClusterInfoMapping {
}
}

public class DelegatedBooleanAttributeCallback implements ChipClusters.BooleanAttributeCallback, DelegatedClusterCallback {
static public class DelegatedBooleanAttributeCallback implements ChipClusters.BooleanAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;

@Override
Expand All @@ -133,7 +132,7 @@ public class ClusterInfoMapping {
}
}

class DelegatedDefaultClusterCallback implements DefaultClusterCallback, DelegatedClusterCallback {
static class DelegatedDefaultClusterCallback implements DefaultClusterCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;

@Override
Expand All @@ -155,7 +154,7 @@ public class ClusterInfoMapping {
}
{{#chip_client_clusters}}
{{#chip_cluster_responses}}
public class Delegated{{asUpperCamelCase name}}Callback implements ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}Callback, DelegatedClusterCallback {
static public class Delegated{{asUpperCamelCase name}}Callback implements ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}Callback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
Expand Down Expand Up @@ -203,7 +202,7 @@ public class ClusterInfoMapping {

{{/if}}

public class Delegated{{asUpperCamelCase name}}AttributeCallback implements ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}AttributeCallback, DelegatedClusterCallback {
static public class Delegated{{asUpperCamelCase name}}AttributeCallback implements ChipClusters.{{asUpperCamelCase ../name}}Cluster.{{asUpperCamelCase name}}AttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
Expand Down
24 changes: 6 additions & 18 deletions src/controller/java/templates/ClusterInfo-read-interaction.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,15 @@

package chip.devicecontroller;

import java.util.ArrayList;
import chip.clusterinfo.CommandParameterInfo;
import chip.clusterinfo.InteractionInfo;
import java.util.HashMap;
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<>();
Expand All @@ -39,9 +28,9 @@ public class ClusterReadMapping {
);
},
{{#if isList}}
() -> clusterInfoMapping.new Delegated{{asUpperCamelCase name}}AttributeCallback(),
() -> new ClusterInfoMapping.Delegated{{asUpperCamelCase name}}AttributeCallback(),
{{else}}
() -> clusterInfoMapping.new Delegated{{convertAttributeCallbackTypeToJavaName chipCallback.type}}AttributeCallback(),
() -> new ClusterInfoMapping.Delegated{{convertAttributeCallbackTypeToJavaName chipCallback.type}}AttributeCallback(),
{{/if}}
read{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams
);
Expand All @@ -53,5 +42,4 @@ public class ClusterReadMapping {
}
}

{{/if}}

{{/if}}
18 changes: 5 additions & 13 deletions src/controller/java/templates/ClusterInfo-write-interaction.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@

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.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() {
ClusterInfoMapping clusterInfoMapping = new ClusterInfoMapping();
Map<String, Map<String, InteractionInfo>> writeAttributeMap = new HashMap<>();
{{#chip_client_clusters}}
Map<String, InteractionInfo> write{{asUpperCamelCase name}}InteractionInfo = new LinkedHashMap<>();
Expand All @@ -36,7 +28,7 @@ public class ClusterWriteMapping {
commandArguments.get("value")
);
},
() -> clusterInfoMapping.new DelegatedDefaultClusterCallback(),
() -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(),
write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}CommandParams
);
write{{asUpperCamelCase ../name}}InteractionInfo.put("write{{asUpperCamelCase name}}Attribute", write{{asUpperCamelCase ../name}}{{asUpperCamelCase name}}AttributeInteractionInfo);
Expand Down
Loading

0 comments on commit 823ef7b

Please sign in to comment.