forked from openlcb/OpenLCB_Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStreamDataProceedMessage.java
More file actions
61 lines (52 loc) · 1.77 KB
/
StreamDataProceedMessage.java
File metadata and controls
61 lines (52 loc) · 1.77 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package org.openlcb;
// For annotations
import net.jcip.annotations.*;
import edu.umd.cs.findbugs.annotations.*;
/**
* Stream Data Proceed message implementation
*
* @author Bob Jacobsen Copyright 2009
* @version $Revision$
*/
@Immutable
@ThreadSafe
public class StreamDataProceedMessage extends AddressedPayloadMessage {
public StreamDataProceedMessage(NodeID source, NodeID dest,
byte sourceStreamID, byte destStreamID, int flags) {
super(source, dest, new byte[] {sourceStreamID, destStreamID, (byte)((flags>>8)&0xFF), (byte)(flags&0xFF)});
this.sourceStreamID = sourceStreamID;
this.destStreamID = destStreamID;
this.flags = flags;
}
byte sourceStreamID;
byte destStreamID;
int flags;
public byte getSourceStreamID() { return sourceStreamID; }
public byte getDestinationStreamID() { return destStreamID; }
/**
* Implement message-type-specific
* processing when this message
* is received by a node.
*<p>
* Default is to do nothing.
*/
@Override
public void applyTo(MessageDecoder decoder, Connection sender) {
decoder.handleStreamDataProceed(this, sender);
}
public boolean equals(Object o) {
if (!super.equals(o)) return false;
StreamDataProceedMessage p = (StreamDataProceedMessage) o;
if (sourceStreamID != p.sourceStreamID) return false;
if (destStreamID != p.destStreamID) return false;
return super.equals(o);
}
public String toString() {
return super.toString()
+" srcId=" + sourceStreamID + " dstId=" + destStreamID;
}
@Override
public MessageTypeIdentifier getEMTI() {
return MessageTypeIdentifier.StreamDataProceed;
}
}