zaber.motion.ascii.Response Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of motion-library Show documentation
Show all versions of motion-library Show documentation
A library that aims to provide easy-to-use API for communication with Zaber devices using Zaber ASCII Protocol.
// ===== THIS FILE IS GENERATED FROM A TEMPLATE ===== //
// ============== DO NOT EDIT DIRECTLY ============== //
package zaber.motion.ascii;
import zaber.motion.protobufs.Main;
/**
* Response message from the device.
*/
public final class Response {
private int deviceAddress;
/**
* Number of the device that sent the message.
*/
public void setDeviceAddress(int deviceAddress) {
this.deviceAddress = deviceAddress;
}
/**
* @return Number of the device that sent the message.
*/
public int getDeviceAddress() {
return this.deviceAddress;
}
private int axisNumber;
/**
* Number of the axis which the response applies to. Zero denotes device scope.
*/
public void setAxisNumber(int axisNumber) {
this.axisNumber = axisNumber;
}
/**
* @return Number of the axis which the response applies to. Zero denotes device scope.
*/
public int getAxisNumber() {
return this.axisNumber;
}
private String replyFlag;
/**
* The reply flag indicates if the request was accepted (OK) or rejected (RJ).
*/
public void setReplyFlag(String replyFlag) {
this.replyFlag = replyFlag;
}
/**
* @return The reply flag indicates if the request was accepted (OK) or rejected (RJ).
*/
public String getReplyFlag() {
return this.replyFlag;
}
private String status;
/**
* The device status contains BUSY when the axis is moving and IDLE otherwise.
*/
public void setStatus(String status) {
this.status = status;
}
/**
* @return The device status contains BUSY when the axis is moving and IDLE otherwise.
*/
public String getStatus() {
return this.status;
}
private String warningFlag;
/**
* The warning flag contains the highest priority warning currently active for the device or axis.
*/
public void setWarningFlag(String warningFlag) {
this.warningFlag = warningFlag;
}
/**
* @return The warning flag contains the highest priority warning currently active for the device or axis.
*/
public String getWarningFlag() {
return this.warningFlag;
}
private String data;
/**
* Response data which varies depending on the request.
*/
public void setData(String data) {
this.data = data;
}
/**
* @return Response data which varies depending on the request.
*/
public String getData() {
return this.data;
}
private MessageType messageType;
/**
* Type of the reply received.
*/
public void setMessageType(MessageType messageType) {
this.messageType = messageType;
}
/**
* @return Type of the reply received.
*/
public MessageType getMessageType() {
return this.messageType;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Response { ");
sb.append("deviceAddress: ");
sb.append(this.deviceAddress);
sb.append(", ");
sb.append("axisNumber: ");
sb.append(this.axisNumber);
sb.append(", ");
sb.append("replyFlag: ");
sb.append(this.replyFlag);
sb.append(", ");
sb.append("status: ");
sb.append(this.status);
sb.append(", ");
sb.append("warningFlag: ");
sb.append(this.warningFlag);
sb.append(", ");
sb.append("data: ");
sb.append(this.data);
sb.append(", ");
sb.append("messageType: ");
sb.append(this.messageType);
sb.append(" }");
return sb.toString();
}
public static Response fromProtobuf(Main.GenericCommandResponse pbData) {
Response obj = new Response();
obj.setDeviceAddress(pbData.getDeviceAddress());
obj.setAxisNumber(pbData.getAxisNumber());
obj.setReplyFlag(pbData.getReplyFlag());
obj.setStatus(pbData.getStatus());
obj.setWarningFlag(pbData.getWarningFlag());
obj.setData(pbData.getData());
obj.setMessageType(MessageType.valueOf(pbData.getMessageType().getNumber()));
return obj;
}
}