public class NXCPMessage extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ENCRYPTION_HEADER_SIZE |
static int |
HEADER_SIZE |
static int |
MF_BINARY |
static int |
MF_CONTROL |
static int |
MF_DONT_ENCRYPT |
static int |
MF_END_OF_FILE |
static int |
MF_END_OF_SEQUENCE |
static int |
MF_REVERSE_ORDER |
Constructor and Description |
---|
NXCPMessage(byte[] nxcpMessage,
EncryptionContext ectx)
Create NXCPMessage from binary NXCP message
|
NXCPMessage(int msgCode) |
NXCPMessage(int msgCode,
long msgId) |
Modifier and Type | Method and Description |
---|---|
byte[] |
createNXCPMessage()
Create binary NXCP message
|
NXCPVariable |
findVariable(long varId) |
byte[] |
getBinaryData()
Get data of raw message.
|
long |
getControlData() |
int |
getMessageCode() |
long |
getMessageId() |
long |
getTimestamp() |
byte[] |
getVariableAsBinary(long varId) |
boolean |
getVariableAsBoolean(long varId) |
Date |
getVariableAsDate(long varId) |
InetAddress |
getVariableAsInetAddress(long varId) |
long |
getVariableAsInt64(long varId) |
int |
getVariableAsInteger(long varId) |
Double |
getVariableAsReal(long varId) |
String |
getVariableAsString(long varId) |
long[] |
getVariableAsUInt32Array(long varId) |
Long[] |
getVariableAsUInt32ArrayEx(long varId) |
UUID |
getVariableAsUUID(long varId) |
boolean |
isBinaryMessage()
Return true if message is a raw message
|
boolean |
isControlMessage()
Return true if message is a control message
|
boolean |
isEncryptionDisabled()
Return true if message has "don't encrypt" flag set
|
boolean |
isEndOfFile()
Return true if message has "end of file" flag set
|
boolean |
isEndOfSequence()
Return true if message has "end of sequence" flag set
|
void |
setBinaryData(byte[] binaryData)
Set data for raw message.
|
void |
setBinaryMessage(boolean isRaw)
Set or clear raw (binary) message flag
|
void |
setControl(boolean isControl)
Set or clear control message flag
|
void |
setControlData(long controlData) |
void |
setEncryptionDisabled(boolean disabled)
Set "don't encrypt" message flag
|
void |
setEndOfFile(boolean isEOF)
Set end of file message flag
|
void |
setEndOfSequence(boolean isEOS)
Set end of sequence message flag
|
void |
setMessageCode(int msgCode) |
void |
setMessageId(long msgId) |
void |
setTimestamp(long timestamp) |
void |
setVariable(long varId,
byte[] value) |
void |
setVariable(long varId,
Double value) |
void |
setVariable(long varId,
InetAddress value) |
void |
setVariable(long varId,
long[] value) |
void |
setVariable(long varId,
Long[] value) |
void |
setVariable(long varId,
String value) |
void |
setVariable(long varId,
UUID value) |
void |
setVariable(NXCPVariable variable) |
void |
setVariableInt16(long varId,
int value) |
void |
setVariableInt32(long varId,
int value) |
void |
setVariableInt64(long varId,
long value) |
String |
toString() |
public static final int HEADER_SIZE
public static final int ENCRYPTION_HEADER_SIZE
public static final int MF_BINARY
public static final int MF_END_OF_FILE
public static final int MF_DONT_ENCRYPT
public static final int MF_END_OF_SEQUENCE
public static final int MF_REVERSE_ORDER
public static final int MF_CONTROL
public NXCPMessage(int msgCode)
msgCode
- public NXCPMessage(int msgCode, long msgId)
msgCode
- msgId
- public NXCPMessage(byte[] nxcpMessage, EncryptionContext ectx) throws IOException, NXCPException
nxcpMessage
- binary NXCP messageIOException
GeneralSecurityException
NXCPException
public int getMessageCode()
public void setMessageCode(int msgCode)
msgCode
- the msgCode to setpublic long getMessageId()
public void setMessageId(long msgId)
msgId
- the msgId to setpublic long getTimestamp()
public void setTimestamp(long timestamp)
timestamp
- the timestamp to setpublic NXCPVariable findVariable(long varId)
varId
- variable Id to findpublic void setVariable(NXCPVariable variable)
public void setVariable(long varId, byte[] value)
public void setVariable(long varId, long[] value)
public void setVariable(long varId, Long[] value)
public void setVariable(long varId, String value)
public void setVariable(long varId, Double value)
public void setVariable(long varId, InetAddress value)
public void setVariable(long varId, UUID value)
public void setVariableInt64(long varId, long value)
public void setVariableInt32(long varId, int value)
public void setVariableInt16(long varId, int value)
public byte[] getVariableAsBinary(long varId)
public String getVariableAsString(long varId)
public Double getVariableAsReal(long varId)
public int getVariableAsInteger(long varId)
public long getVariableAsInt64(long varId)
public InetAddress getVariableAsInetAddress(long varId)
public UUID getVariableAsUUID(long varId)
public long[] getVariableAsUInt32Array(long varId)
public Long[] getVariableAsUInt32ArrayEx(long varId)
public boolean getVariableAsBoolean(long varId)
public Date getVariableAsDate(long varId)
public byte[] createNXCPMessage() throws IOException
IOException
public byte[] getBinaryData()
public void setBinaryData(byte[] binaryData)
binaryData
- public boolean isBinaryMessage()
public void setBinaryMessage(boolean isRaw)
isControl
- true to set control message flagpublic boolean isControlMessage()
public void setControl(boolean isControl)
isControl
- true to set control message flagpublic boolean isEndOfFile()
public void setEndOfFile(boolean isEOF)
isEOF
- true to set end of file message flagpublic boolean isEndOfSequence()
public void setEndOfSequence(boolean isEOS)
isEOS
- true to set end of sequence message flagpublic boolean isEncryptionDisabled()
public void setEncryptionDisabled(boolean disabled)
disabled
- true to set "don't encrypt" message flagpublic long getControlData()
public void setControlData(long controlData)
controlData
- the controlData to setCopyright © 2014. All rights reserved.