public class RXIPv4Packet extends XBeeAPIPacket
TXIPv4Packet,
XBeeAPIPacketNO_FRAME_ID| Constructor and Description |
|---|
RXIPv4Packet(Inet4Address sourceAddress,
int destPort,
int sourcePort,
IPProtocol protocol,
byte[] data)
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static RXIPv4Packet |
createPacket(byte[] payload)
Creates a new
RXIPv4Packet object from the given payload. |
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
byte[] |
getData()
Retrieves the received data.
|
int |
getDestPort()
Retrieves the destination port.
|
IPProtocol |
getProtocol()
Retrieves the IP protocol.
|
Inet4Address |
getSourceAddress()
Retrieves the source IP address.
|
int |
getSourcePort()
Retrieves the source port.
|
boolean |
isBroadcast()
Returns whether or not the packet is a broadcast packet.
|
boolean |
needsAPIFrameID()
Returns whether the API packet needs API Frame ID or not.
|
void |
setData(byte[] data)
Sets the new received data.
|
void |
setDestPort(int destPort)
Sets the destination port.
|
void |
setProtocol(IPProtocol protocol)
Sets the IP protocol.
|
void |
setSourceAddress(Inet4Address sourceAddress)
Sets the source IP address.
|
void |
setSourcePort(int sourcePort)
Sets the source port.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameIDequals, generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, hashCode, parsePacket, parsePacket, toPrettyString, toStringpublic RXIPv4Packet(Inet4Address sourceAddress, int destPort, int sourcePort, IPProtocol protocol, byte[] data)
RXIPv4Packet object with
the given parameters.sourceAddress - IP address of the source device.destPort - Destination port number.sourcePort - Source port number.protocol - Protocol used for transmitted data.data - Receive data bytes.IllegalArgumentException - if destPort < 0 or
if destPort > 65535 or
if sourcePort < 0 or
if sourcePort > 65535 or
if transmitOptions are invalid.NullPointerException - if sourceAddress == null or
if protocol == null.IPProtocol,
Inet4Addresspublic static RXIPv4Packet createPacket(byte[] payload)
RXIPv4Packet object from the given payload.payload - The API frame payload. It must start with the frame type
corresponding to a RX IPv4 packet (0xB0).
The byte array must be in OperatingMode.API mode.IllegalArgumentException - if payload[0] != APIFrameType.RX_IPV4.getValue() or
if payload.length < .NullPointerException - if payload == null.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacketpublic byte[] getData()
setData(byte[])public int getDestPort()
setDestPort(int)public IPProtocol getProtocol()
setProtocol(IPProtocol),
IPProtocolpublic Inet4Address getSourceAddress()
setSourceAddress(Inet4Address),
Inet4Addresspublic int getSourcePort()
setSourcePort(int)public boolean isBroadcast()
XBeeAPIPacketisBroadcast in class XBeeAPIPackettrue if the packet is a broadcast packet, false
otherwise.public boolean needsAPIFrameID()
XBeeAPIPacketneedsAPIFrameID in class XBeeAPIPackettrue if the packet needs API Frame ID, false
otherwise.public void setData(byte[] data)
data - The received data.getData()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(),
IPProtocolpublic void setSourceAddress(Inet4Address sourceAddress)
sourceAddress - The new source IP address.NullPointerException - if sourceAddress == null.getSourceAddress(),
Inet4Addresspublic void setSourcePort(int sourcePort)
sourcePort - The new source port.IllegalArgumentException - if sourcePort < 0 or
if sourcePort > 65535.getSourcePort()© Copyright 2014 - 2019 Digi International Inc. All rights reserved.