blob: 460ad6990774ed6fb0c350544d12a40b83d0cbdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package org.reprap.comms.messages;
import java.io.IOException;
import org.reprap.comms.IncomingContext;
import org.reprap.comms.IncomingMessage;
public class VersionResponseMessage extends IncomingMessage {
public VersionResponseMessage(IncomingContext incomingContext) throws IOException {
super(incomingContext);
}
public int getVersion() throws InvalidPayloadException {
byte [] reply = getPayload();
if (reply == null || reply.length != 3)
throw new InvalidPayloadException();
return reply[1] + reply[2] << 8;
}
protected boolean isExpectedPacketType(byte packetType) {
return packetType == VersionRequestMessage.MSG_GetVersion;
}
}
|