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 | 
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.XBeePacketpublic 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.XBeePacketpublic 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, 
XBeePacketpublic 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.XBeePacketpublic 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, 
XBeePacketpublic int getMaxSize()
© Copyright 2014–2014 Digi International Inc. All rights reserved.