zaber.motion.binary.DeviceIdentity 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.binary;
import zaber.motion.FirmwareVersion;
import zaber.motion.protobufs.Main;
/**
* Representation of data gathered during device identification.
*/
public final class DeviceIdentity {
private int deviceId;
/**
* Unique ID of the device hardware.
*/
public void setDeviceId(int deviceId) {
this.deviceId = deviceId;
}
/**
* @return Unique ID of the device hardware.
*/
public int getDeviceId() {
return this.deviceId;
}
private long serialNumber;
/**
* Serial number of the device.
*/
public void setSerialNumber(long serialNumber) {
this.serialNumber = serialNumber;
}
/**
* @return Serial number of the device.
*/
public long getSerialNumber() {
return this.serialNumber;
}
private String name;
/**
* Name of the product.
*/
public void setName(String name) {
this.name = name;
}
/**
* @return Name of the product.
*/
public String getName() {
return this.name;
}
private FirmwareVersion firmwareVersion;
/**
* Version of the firmware.
*/
public void setFirmwareVersion(FirmwareVersion firmwareVersion) {
this.firmwareVersion = firmwareVersion;
}
/**
* @return Version of the firmware.
*/
public FirmwareVersion getFirmwareVersion() {
return this.firmwareVersion;
}
private boolean isPeripheral;
/**
* Indicates whether the device is a peripheral or part of an integrated device.
*/
public void setIsPeripheral(boolean isPeripheral) {
this.isPeripheral = isPeripheral;
}
/**
* @return Indicates whether the device is a peripheral or part of an integrated device.
*/
public boolean getIsPeripheral() {
return this.isPeripheral;
}
private int peripheralId;
/**
* Unique ID of the peripheral hardware.
*/
public void setPeripheralId(int peripheralId) {
this.peripheralId = peripheralId;
}
/**
* @return Unique ID of the peripheral hardware.
*/
public int getPeripheralId() {
return this.peripheralId;
}
private String peripheralName;
/**
* Name of the peripheral hardware.
*/
public void setPeripheralName(String peripheralName) {
this.peripheralName = peripheralName;
}
/**
* @return Name of the peripheral hardware.
*/
public String getPeripheralName() {
return this.peripheralName;
}
private DeviceType deviceType;
/**
* Determines the type of an device and units it accepts.
*/
public void setDeviceType(DeviceType deviceType) {
this.deviceType = deviceType;
}
/**
* @return Determines the type of an device and units it accepts.
*/
public DeviceType getDeviceType() {
return this.deviceType;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("DeviceIdentity { ");
sb.append("deviceId: ");
sb.append(this.deviceId);
sb.append(", ");
sb.append("serialNumber: ");
sb.append(this.serialNumber);
sb.append(", ");
sb.append("name: ");
sb.append(this.name);
sb.append(", ");
sb.append("firmwareVersion: ");
sb.append(this.firmwareVersion);
sb.append(", ");
sb.append("isPeripheral: ");
sb.append(this.isPeripheral);
sb.append(", ");
sb.append("peripheralId: ");
sb.append(this.peripheralId);
sb.append(", ");
sb.append("peripheralName: ");
sb.append(this.peripheralName);
sb.append(", ");
sb.append("deviceType: ");
sb.append(this.deviceType);
sb.append(" }");
return sb.toString();
}
public static DeviceIdentity fromProtobuf(Main.BinaryDeviceIdentity pbData) {
DeviceIdentity obj = new DeviceIdentity();
obj.setDeviceId(pbData.getDeviceId());
obj.setSerialNumber(pbData.getSerialNumber());
obj.setName(pbData.getName());
obj.setFirmwareVersion(FirmwareVersion.fromProtobuf(pbData.getFirmwareVersion()));
obj.setIsPeripheral(pbData.getIsPeripheral());
obj.setPeripheralId(pbData.getPeripheralId());
obj.setPeripheralName(pbData.getPeripheralName());
obj.setDeviceType(DeviceType.valueOf(pbData.getDeviceType().getNumber()));
return obj;
}
}