blob: 1c804d6a1d7c94216520bbd65c39b0457e6ab6ef (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package org.reprap.comms.messages;
import org.reprap.comms.OutgoingMessage;
/**
*
*/
public class OutgoingIntMessage extends OutgoingMessage {
/**
*
*/
private byte messageType;
/**
*
*/
private int value;
/**
* @param messageType
* @param value
*/
public OutgoingIntMessage(byte messageType, int value) {
this.messageType = messageType;
this.value = value;
}
/* (non-Javadoc)
* @see org.reprap.comms.OutgoingMessage#getBinary()
*/
public byte[] getBinary() {
byte [] payload = new byte[3];
payload[0] = messageType;
payload[1] = (byte)(value & 255);
payload[2] = (byte)((value >> 8) & 255);
return payload;
}
}
|