Skip to content

Commit

Permalink
move the invoke request to invoke element
Browse files Browse the repository at this point in the history
rename the invoke request to invoke element since this class would be used in request and
response.
  • Loading branch information
yunhanw-google committed Mar 4, 2023
1 parent 1023101 commit c5d0427
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/controller/java/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ android_library("java") {
"src/chip/devicecontroller/model/ClusterState.java",
"src/chip/devicecontroller/model/EndpointState.java",
"src/chip/devicecontroller/model/EventState.java",
"src/chip/devicecontroller/model/InvokeRequest.java",
"src/chip/devicecontroller/model/InvokeElement.java",
"src/chip/devicecontroller/model/NodeState.java",
"zap-generated/chip/devicecontroller/ChipClusters.java",
"zap-generated/chip/devicecontroller/ChipEventStructs.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import java.util.Locale;
import java.util.Objects;

/** An invoke request that should be used for interaction model invoke command. */
public final class InvokeRequest {
/** An invoke element that should be used for interaction model invoke request and response. */
public final class InvokeElement {
private final ChipPathId endpointId, clusterId, commandId;
private final byte[] tlv;

private InvokeRequest(
private InvokeElement(
ChipPathId endpointId, ChipPathId clusterId, ChipPathId commandId, byte[] tlv) {
this.endpointId = endpointId;
this.clusterId = clusterId;
Expand All @@ -49,11 +49,11 @@ public byte[] getTlvByteArray() {
return tlv.clone();
}

// check whether the current InvokeRequest has same path as others.
// check whether the current InvokeElement has same path as others.
@Override
public boolean equals(Object object) {
if (object instanceof InvokeRequest) {
InvokeRequest that = (InvokeRequest) object;
if (object instanceof InvokeElement) {
InvokeElement that = (InvokeElement) object;
return Objects.equals(this.endpointId, that.endpointId)
&& Objects.equals(this.clusterId, that.clusterId)
&& Objects.equals(this.commandId, that.commandId);
Expand All @@ -72,15 +72,15 @@ public String toString() {
Locale.ENGLISH, "Endpoint %s, cluster %s, command %s", endpointId, clusterId, commandId);
}

public static InvokeRequest newInstance(
public static InvokeElement newInstance(
ChipPathId endpointId, ChipPathId clusterId, ChipPathId commandId, byte[] tlv) {
return new InvokeRequest(endpointId, clusterId, commandId, tlv);
return new InvokeElement(endpointId, clusterId, commandId, tlv);
}

/** Create a new {@link InvokeRequest} with only concrete ids. */
public static InvokeRequest newInstance(
/** Create a new {@link InvokeElement} with only concrete ids. */
public static InvokeElement newInstance(
long endpointId, long clusterId, long commandId, byte[] tlv) {
return new InvokeRequest(
return new InvokeElement(
ChipPathId.forId(endpointId),
ChipPathId.forId(clusterId),
ChipPathId.forId(commandId),
Expand Down

0 comments on commit c5d0427

Please sign in to comment.