public class XBeePacketsQueue extends Object
The class provides some methods to get specific packet types from different source nodes.
XBeePacket
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_LENGTH
Default maximum number of packets to store in the queue
(value: 50).
|
Constructor and Description |
---|
XBeePacketsQueue()
Class constructor.
|
XBeePacketsQueue(int maxLength)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPacket(XBeePacket xbeePacket)
Adds the provided packet to the list of packets.
|
void |
clearQueue()
Clears the list of packets.
|
int |
getCurrentSize()
Returns the current size of the XBee packets queue.
|
XBeePacket |
getFirstDataPacket(int timeout)
Returns the first data packet from the queue waiting up to the
specified timeout if necessary for an XBee data packet to become
available.
|
XBeePacket |
getFirstDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice,
int timeout)
Returns the first data packet from the queue whose 64-bit source
address matches the address of the provided remote XBee device.
|
XBeePacket |
getFirstExplicitDataPacket(int timeout)
Returns the first explicit data packet from the queue waiting up to the
specified timeout if necessary for an XBee explicit data packet to
become available.
|
XBeePacket |
getFirstExplicitDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice,
int timeout)
Returns the first explicit data packet from the queue whose 64-bit
source address matches the address of the provided remote XBee device.
|
XBeePacket |
getFirstIPDataPacket(int timeout)
Returns the first IP data packet from the queue waiting up to the
specified timeout if necessary for a IP data packet to
become available.
|
XBeePacket |
getFirstIPDataPacketFrom(Inet4Address ipAddress,
int timeout)
Returns the first IP data packet from the queue whose IP address
matches the provided address.
|
XBeePacket |
getFirstIPv6DataPacket(int timeout)
Returns the first IPv6 data packet from the queue waiting up to the
specified timeout if necessary for a IPv6 data packet to
become available.
|
XBeePacket |
getFirstIPv6DataPacketFrom(Inet6Address ipv6Address,
int timeout)
Returns the first IPv6 data packet from the queue whose IPv6 address
matches the provided address.
|
XBeePacket |
getFirstPacket(int timeout)
Returns the first packet from the queue waiting up to the specified
timeout if necessary for an XBee packet to become available.
|
XBeePacket |
getFirstPacketFrom(RemoteXBeeDevice remoteXBeeDevice,
int timeout)
Returns the first packet from the queue whose 64-bit source address
matches the address of the provided remote XBee device.
|
int |
getMaxSize()
Returns the maximum size of the XBee packets queue.
|
public static final int DEFAULT_MAX_LENGTH
public XBeePacketsQueue()
XBeePacketsQueue
.public XBeePacketsQueue(int maxLength)
XBeePacketsQueue
with the given maximum length.maxLength
- Maximum length of the queue.IllegalArgumentException
- if maxLength < 1
.public void addPacket(XBeePacket xbeePacket)
xbeePacket
- The XBee packet to be added to the list.XBeePacket
public void clearQueue()
public int getCurrentSize()
public XBeePacket getFirstDataPacket(int timeout)
null
if the queue is empty or there is not any data
packet inside.timeout
- The time in milliseconds to wait for an XBee data packet
to become available. 0 to return immediately.null
if it is
empty or no data packets are contained in the queue.XBeePacket
public XBeePacket getFirstDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
The methods waits up to the specified timeout if necessary for an
XBee data packet to become available. null
if the queue is
empty or there is not any XBee data packet sent by the provided remote
XBee device.
remoteXBeeDevice
- The XBee device containing the 64-bit address
to look for in the list of packets.timeout
- The time in milliseconds to wait for an XBee data packet
from the specified remote XBee device to become
available. 0 to return immediately.null
if no
data packets from the specified XBee device are found in the
queue.RemoteXBeeDevice
,
XBeePacket
public XBeePacket getFirstExplicitDataPacket(int timeout)
null
if the queue is empty or there is not
any explicit data packet inside.timeout
- The time in milliseconds to wait for an XBee explicit
data packet to become available. 0 to return immediately.null
if
it is empty or no data packets are contained in the queue.XBeePacket
,
ExplicitRxIndicatorPacket
public XBeePacket getFirstExplicitDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
The methods waits up to the specified timeout if necessary for an
XBee explicit data packet to become available. null
if the
queue is empty or there is not any XBee explicit data packet sent by
the provided remote XBee device.
remoteXBeeDevice
- The XBee device containing the 64-bit address
to look for in the list of packets.timeout
- The time in milliseconds to wait for an XBee explicit
data packet from the specified remote XBee device to
become available. 0 to return immediately.null
if no explicit data packets from the specified
XBee device are found in the queue.RemoteXBeeDevice
,
XBeePacket
,
ExplicitRxIndicatorPacket
public XBeePacket getFirstIPDataPacket(int timeout)
null
if the queue is empty or there is not
any IP data packet inside.timeout
- The time in milliseconds to wait for a IP data
packet to become available. 0 to return immediately.null
if
it is empty or no IP packets are contained in the queue.XBeePacket
,
RXIPv4Packet
public XBeePacket getFirstIPDataPacketFrom(Inet4Address ipAddress, int timeout)
The methods waits up to the specified timeout if necessary for a
IP data packet to become available. null
if the
queue is empty or there is not any IP data packet sent by
the provided IP address.
ipAddress
- The IP address to look for in the list of packets.timeout
- The time in milliseconds to wait for a IP data
packet from the specified IP address to become available.
0 to return immediately.null
if no IP data packets from the
specified IP address are found in the queue.XBeePacket
,
RXIPv4Packet
,
Inet4Address
public XBeePacket getFirstIPv6DataPacket(int timeout)
null
if the queue is empty or there is not
any IPv6 data packet inside.timeout
- The time in milliseconds to wait for a IPv6 data
packet to become available. 0 to return immediately.null
if
it is empty or no IPv6 packets are contained in the queue.XBeePacket
,
RXIPv6Packet
public XBeePacket getFirstIPv6DataPacketFrom(Inet6Address ipv6Address, int timeout)
The methods waits up to the specified timeout if necessary for a
IPv6 data packet to become available. null
if the
queue is empty or there is not any IPv6 data packet sent by
the provided IPv6 address.
ipv6Address
- The IPv6 address to look for in the list of packets.timeout
- The time in milliseconds to wait for a IPv6 data
packet from the specified IPv6 address to become available.
0 to return immediately.null
if no IPv6 data packets from the
specified IPv6 address are found in the queue.XBeePacket
,
RXIPv6Packet
,
Inet6Address
public XBeePacket getFirstPacket(int timeout)
null
if the queue is empty.timeout
- The time in milliseconds to wait for an XBee packet to
become available. 0 to return immediately.null
if it is empty.XBeePacket
public XBeePacket getFirstPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
The methods waits up to the specified timeout if necessary for an XBee packet to become available. Null if the queue is empty or there is not any XBee packet sent by the provided remote XBee device.
remoteXBeeDevice
- The remote XBee device containing the 64-bit
address to look for in the list of packets.timeout
- The time in milliseconds to wait for an XBee packet from
the specified remote XBee device to become available.
0 to return immediately.null
if no packets
from the specified XBee device are found in the queue.RemoteXBeeDevice
,
XBeePacket
public int getMaxSize()
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.