zaber.motion.exceptions.InvalidPacketException 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.exceptions;
import zaber.motion.protobufs.Main;
import com.google.protobuf.InvalidProtocolBufferException;
/**
* Thrown when a packet from a device cannot be parsed.
*/
public class InvalidPacketException extends MotionLibException {
private InvalidPacketExceptionData details;
/**
* @return Additional data for InvalidPacketException
*/
public InvalidPacketExceptionData getDetails() {
return this.details;
}
public InvalidPacketException(String message, byte[] customData) {
super(message);
try {
Main.InvalidPacketExceptionData protobufObj = Main.InvalidPacketExceptionData.parser().parseFrom(customData);
this.details = InvalidPacketExceptionData.fromProtobuf(protobufObj);
} catch (InvalidProtocolBufferException e) {
throw new LibraryIntegrationException("Could not parse custom data for InvalidPacketException", e);
}
}
public InvalidPacketException(String message, InvalidPacketExceptionData customData) {
super(message);
this.details = customData;
}
}