summaryrefslogtreecommitdiff
path: root/branches/sm-unittesting/src/org/reprap/comms/messages/OutgoingIntMessage.java
blob: fe7ce5d6d6b731576185f62daa6849223362a95c (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.OutgoingMessage;

public class OutgoingIntMessage extends OutgoingMessage {

	private byte messageType;
	private int value;
	
	public OutgoingIntMessage(byte messageType, int value) {
		this.messageType = messageType;
		this.value = value;
	}
	
	public byte[] getBinary() {
		byte [] payload = new byte[3];
		payload[0] = messageType;
		payload[1] = (byte)(value & 255);
		payload[2] = (byte)((value >> 8) & 255);
		return payload;
	}

	
}