public class CoAPRxResponsePacket extends XBeeAPIPacket
When the module receives a CoAP packet, it is sent out the UART using this message type.
This packet is received when external devices send CoAP Tx Request
packets to the module. See
CoAPTxRequestPacket
.
CoAPTxRequestPacket
,
XBeeAPIPacket
NO_FRAME_ID
Constructor and Description |
---|
CoAPRxResponsePacket(int frameID,
Inet6Address destAddress,
Inet6Address sourceAddress,
int destPort,
int sourcePort,
IPProtocol protocol,
RestFulStatusEnum restFulStatus,
byte[] rfData)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
static CoAPRxResponsePacket |
createPacket(byte[] payload)
Creates a new
CoAPRxResponsePacket object from the given payload. |
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
byte[] |
getData()
Retrieves the transmission data.
|
Inet6Address |
getDestAddress()
Retrieves the destination IPv6 address.
|
int |
getDestPort()
Retrieves the destination port.
|
IPProtocol |
getProtocol()
Retrieves the IP protocol.
|
Inet6Address |
getSourceAddress()
Retrieves the source IPv6 address.
|
int |
getSourcePort()
Retrieves the source port.
|
RestFulStatusEnum |
getStatus()
Returns the RESTFul status used for the transmission.
|
boolean |
needsAPIFrameID()
Returns whether the API packet needs API Frame ID or not.
|
void |
setData(byte[] rfData)
Sets the new transmission data.
|
void |
setDestAddress(Inet6Address destAddress)
Sets the destination IPv6 address.
|
void |
setDestPort(int destPort)
Sets the destination port.
|
void |
setProtocol(IPProtocol protocol)
Sets the IP protocol.
|
void |
setSourceAddress(Inet6Address sourceAddress)
Sets the source IPv6 address.
|
void |
setSourcePort(int sourcePort)
Sets the source port.
|
void |
setStatus(RestFulStatusEnum restFulStatus)
Sets the RESTFul status used for the transmission.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, isBroadcast, setFrameID
equals, generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, hashCode, parsePacket, parsePacket, toPrettyString, toString
public CoAPRxResponsePacket(int frameID, Inet6Address destAddress, Inet6Address sourceAddress, int destPort, int sourcePort, IPProtocol protocol, RestFulStatusEnum restFulStatus, byte[] rfData)
CoAPRxResponsePacket
object with
the given parameters.frameID
- Frame ID.destAddress
- IPv6 address of the destination device.sourceAddress
- IPv6 address of the source device.destPort
- Destination port number.sourcePort
- Source port number.protocol
- Protocol used for transmitted data.restFulStatus
- RESTful status.rfData
- RF transmit data bytes.IllegalArgumentException
- if frameID < 0
or
if frameID > 255
or
if destPort < 0
or
if destPort > 65535
or
if sourcePort < 0
or
if sourcePort > 65535
.NullPointerException
- if destAddress == null
or
if sourceAddress == null
or
if protocol == null
or
if restFulStatus == null
.Inet6Address
,
IPProtocol
,
RestFulStatusEnum
public static CoAPRxResponsePacket createPacket(byte[] payload)
CoAPRxResponsePacket
object from the given payload.payload
- The API frame payload. It must start with the frame type
corresponding to a CoAP Rx Response packet (0x9C
).
The byte array must be in OperatingMode.API
mode.IllegalArgumentException
- if payload[0] != APIFrameType.COAP_RX_RESPONSE.getValue()
or
if payload.length <
.NullPointerException
- if payload == null
.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacket
public byte[] getData()
setData(byte[])
public Inet6Address getDestAddress()
setDestAddress(Inet6Address)
,
Inet6Address
public int getDestPort()
setDestPort(int)
public IPProtocol getProtocol()
setProtocol(IPProtocol)
,
IPProtocol
public Inet6Address getSourceAddress()
setSourceAddress(Inet6Address)
,
Inet6Address
public int getSourcePort()
setSourcePort(int)
public RestFulStatusEnum getStatus()
setStatus(RestFulStatusEnum)
,
RestFulStatusEnum
public boolean needsAPIFrameID()
XBeeAPIPacket
needsAPIFrameID
in class XBeeAPIPacket
true
if the packet needs API Frame ID, false
otherwise.public void setData(byte[] rfData)
rfData
- The transmission data.getData()
public void setDestAddress(Inet6Address destAddress)
destAddress
- The new destination IPv6 address.NullPointerException
- if destAddress == null
.getDestAddress()
,
Inet6Address
public void setDestPort(int destPort)
destPort
- The new destination port.IllegalArgumentException
- if destPort < 0
or
if destPort > 65535
.getDestPort()
public void setProtocol(IPProtocol protocol)
protocol
- The new IP protocol.NullPointerException
- if protocol == null
.getProtocol()
,
IPProtocol
public void setSourceAddress(Inet6Address sourceAddress)
sourceAddress
- The new source IPv6 address.NullPointerException
- if sourceAddress == null
.getSourceAddress()
,
Inet6Address
public void setSourcePort(int sourcePort)
sourcePort
- The new source port.IllegalArgumentException
- if sourcePort < 0
or
if sourcePort > 65535
.getSourcePort()
public void setStatus(RestFulStatusEnum restFulStatus)
restFulStatus
- RESTFul status.getStatus()
,
RestFulStatusEnum
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.