summaryrefslogtreecommitdiff
path: root/branches/sm-unittesting/src/org/reprap/comms/messages/OutgoingAddressMessage.java
blob: 4ab49bc2bd30f71582398dd1eae5d7a6a8b7eac7 (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
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;
	
	public OutgoingAddressMessage(byte messageType, Address address) {
		this.messageType = messageType;
		this.value = address.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;
	}

	
}