public class TXIPv4Packet extends XBeeAPIPacket
RXIPv4Packet,
XBeeAPIPacket| Modifier and Type | Field and Description |
|---|---|
static int |
OPTIONS_CLOSE_SOCKET
This option will close the socket after the transmission.
|
static int |
OPTIONS_LEAVE_SOCKET_OPEN
This option will leave socket open after the transmission.
|
NO_FRAME_ID| Constructor and Description |
|---|
TXIPv4Packet(int frameID,
Inet4Address destAddress,
int destPort,
int sourcePort,
IPProtocol protocol,
int transmitOptions,
byte[] data)
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static TXIPv4Packet |
createPacket(byte[] payload)
Creates a new
TXIPv4Packet 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.
|
Inet4Address |
getDestAddress()
Retrieves the destination IP address.
|
int |
getDestPort()
Retrieves the destination port.
|
IPProtocol |
getProtocol()
Retrieves the IP protocol.
|
int |
getSourcePort()
Retrieves the source port.
|
int |
getTransmitOptions()
Retrieves the transmit options.
|
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 transmission data.
|
void |
setDestAddress(Inet4Address destAddress)
Sets the destination IP address.
|
void |
setDestPort(int destPort)
Sets the destination port.
|
void |
setProtocol(IPProtocol protocol)
Sets the IP protocol.
|
void |
setSourcePort(int sourcePort)
Sets the source port.
|
void |
setTransmitOptions(int transmitOptions)
Sets the transmit options.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameIDequals, generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, hashCode, parsePacket, parsePacket, toPrettyString, toStringpublic static final int OPTIONS_CLOSE_SOCKET
public static final int OPTIONS_LEAVE_SOCKET_OPEN
public TXIPv4Packet(int frameID, Inet4Address destAddress, int destPort, int sourcePort, IPProtocol protocol, int transmitOptions, byte[] data)
TXIPv4Packet object with
the given parameters.frameID - Frame ID.destAddress - IP address of the destination device.destPort - Destination port number.sourcePort - Source port number.protocol - Protocol used for transmitted data.transmitOptions - Transmit options bitfield. Can be
OPTIONS_LEAVE_SOCKET_OPEN or
OPTIONS_CLOSE_SOCKET.data - 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 or
if transmitOptions are invalid.NullPointerException - if destAddress == null or
if protocol == null.IPProtocol,
Inet4Addresspublic static TXIPv4Packet createPacket(byte[] payload)
TXIPv4Packet object from the given payload.payload - The API frame payload. It must start with the frame type
corresponding to a TX IPv4 packet (0x20).
The byte array must be in OperatingMode.API mode.IllegalArgumentException - if payload[0] != APIFrameType.TX_IPV4.getValue() or
if payload.length < .NullPointerException - if payload == null.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacketpublic byte[] getData()
setData(byte[])public Inet4Address getDestAddress()
setDestAddress(Inet4Address),
Inet4Addresspublic int getDestPort()
setDestPort(int)public IPProtocol getProtocol()
setProtocol(IPProtocol),
IPProtocolpublic int getSourcePort()
setSourcePort(int)public int getTransmitOptions()
OPTIONS_CLOSE_SOCKET,
OPTIONS_LEAVE_SOCKET_OPEN,
setTransmitOptions(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 transmission data.getData()public void setDestAddress(Inet4Address destAddress)
destAddress - The new destination IP address.NullPointerException - if destAddress == null.getDestAddress(),
Inet4Addresspublic 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 setSourcePort(int sourcePort)
sourcePort - The new source port.IllegalArgumentException - if sourcePort < 0 or
if sourcePort > 65535.getSourcePort()public void setTransmitOptions(int transmitOptions)
transmitOptions - Transmit options. Can be
OPTIONS_CLOSE_SOCKET or
OPTIONS_LEAVE_SOCKET_OPEN.IllegalArgumentException - if transmitOptions are invalid.OPTIONS_CLOSE_SOCKET,
OPTIONS_LEAVE_SOCKET_OPEN,
getTransmitOptions()© Copyright 2014 - 2019 Digi International Inc. All rights reserved.