blob: 99dc0788f514ea45c35f24e39e1e5805512d2fc4 (
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
42
|
package org.reprap.comms.messages;
import org.reprap.comms.Address;
import org.reprap.comms.OutgoingMessage;
/**
*
*/
public class OutgoingAddressMessage extends OutgoingMessage {
/**
*
*/
private byte messageType;
/**
*
*/
private byte [] value;
/**
* @param messageType
* @param address
*/
public OutgoingAddressMessage(byte messageType, Address address) {
this.messageType = messageType;
this.value = address.getBinary();
}
/* (non-Javadoc)
* @see org.reprap.comms.OutgoingMessage#getBinary()
*/
public byte[] getBinary() {
byte [] payload = new byte[1 + value.length];
payload[0] = messageType;
for(int i = 0; i < value.length; i++)
payload[i+1] = value[i];
return payload;
}
}
|