|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.NetMessage
public abstract class NetMessage
Represents a single general command or response.
Content is represented with ints to avoid the problems with sign-extension that bytes have, and because a Java char is actually a variable number of bytes in Unicode.
Both a set of indexed contents, an opcode, and a length field are available. Different implementations will map the opcode and length into the contents in different ways. They may not appear at all...
| Constructor Summary | |
|---|---|
NetMessage(int len)
Create a new object, representing a specific-length message. |
|
| Method Summary | |
|---|---|
abstract boolean |
checkParity()
check whether the message has a valid parity |
int |
getElement(int n)
|
int |
getNumDataElements()
Get length, including op code and error-detection byte |
int |
getOpCode()
|
String |
getOpCodeHex()
Get a String representation of the op code in hex |
protected static int |
highByte(int val)
|
protected static int |
lowByte(int val)
|
void |
setElement(int n,
int v)
|
void |
setOpCode(int i)
|
abstract void |
setParity()
Set parity to be correct for this implementation. |
String |
toString()
Get a String representation of the entire message in hex. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NetMessage(int len)
len - Total bytes in message, including opcode and error-detection byte.| Method Detail |
|---|
public void setOpCode(int i)
public int getOpCode()
public String getOpCodeHex()
public int getNumDataElements()
public int getElement(int n)
public void setElement(int n,
int v)
public String toString()
toString in class Objectpublic abstract boolean checkParity()
public abstract void setParity()
protected static int lowByte(int val)
protected static int highByte(int val)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||