Class XBeePacketsQueue
This class represents a queue of XBee packets used for sequential packet reading.
Inheritance
Inherited Members
Namespace: XBeeLibrary.Core.Models
Assembly: XBeeLibrary.Core.dll
Syntax
public class XBeePacketsQueue
Remarks
The class provides some methods to get specific packet types from different source nodes.
Constructors
XBeePacketsQueue()
Initializes a new instance of class XBeePacketsQueue.
Declaration
public XBeePacketsQueue()
XBeePacketsQueue(Int32)
Initializes a new instance of class XBeePacketsQueue with the specified
maxLength
.
Declaration
public XBeePacketsQueue(int maxLength)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxLength | Maximum Length of the queue. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | If |
Fields
DEFAULT_MAX_LENGTH
Default maximum number of packets to store in the queue.
Declaration
public const int DEFAULT_MAX_LENGTH = 50
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
CurrentSize
Gets the current size of the XBee packets queue.
Declaration
public int CurrentSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The current size of the XBee packets queue. |
MaxSize
Gets the maximum size of the XBee packets queue.
Declaration
public int MaxSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
AddPacket(XBeePacket)
Adds the provided packet to the list of packets. If the queue is full the first packet will be discarded to add the given one.
Declaration
public void AddPacket(XBeePacket xbeePacket)
Parameters
Type | Name | Description |
---|---|---|
XBeePacket | xbeePacket | The XBee packet to be added to the list. |
See Also
ClearQueue()
Clears the list of packets.
Declaration
public void ClearQueue()
GetFirstDataPacket(Int32)
Returns the first data packet from the queue waiting 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 data packet inside.
Declaration
public XBeePacket GetFirstDataPacket(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout | The time in milliseconds to wait for an XBee data packet to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first data packet from the queue, |
See Also
GetFirstDataPacketFrom(RemoteXBeeDevice, Int32)
Returns the first data packet from the queue whose 64-bit source address matches the address of the provided remote XBee device.
Declaration
public XBeePacket GetFirstDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
Parameters
Type | Name | Description |
---|---|---|
RemoteXBeeDevice | remoteXBeeDevice | The XBee device containing the 64-bit address to look for in the list of packets. |
System.Int32 | 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. |
Returns
Type | Description |
---|---|
XBeePacket | The first XBee data packet whose its 64-bit address matches the address of the
provided remote XBee device. |
Remarks
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.
See Also
GetFirstExplicitDataPacket(Int32)
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. null
if the queue is
empty or there is not any explicit data packet inside.
Declaration
public XBeePacket GetFirstExplicitDataPacket(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout | The time in milliseconds to wait for an XBee explicit data packet to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first explicit data packet from the queue, |
See Also
GetFirstExplicitDataPacketFrom(RemoteXBeeDevice, Int32)
Returns the first explicit data packet from the queue whose 64-bit source address matches the address of the provided remote XBee device.
Declaration
public XBeePacket GetFirstExplicitDataPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
Parameters
Type | Name | Description |
---|---|---|
RemoteXBeeDevice | remoteXBeeDevice | The XBee device containing the 64-bit address to look for in the list of packets. |
System.Int32 | 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. |
Returns
Type | Description |
---|---|
XBeePacket | The first XBee explicit data packet whose its 64-bit address matches the address of the
provided remote XBee device. |
Remarks
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.
See Also
GetFirstIPDataPacket(Int32)
Returns the first IP data packet from the queue waiting up to the specified timeout if necessary
for an IP data packet to become available. null
if the queue is empty or there is not any
IP data packet inside.
Declaration
public XBeePacket GetFirstIPDataPacket(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout | The time in milliseconds to wait for an IP data packet to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first IP data packet from the queue, |
See Also
GetFirstIPDataPacketFrom(IPAddress, Int32)
Returns the first IP data packet from the queue whose IP address matches the provided address.
Declaration
public XBeePacket GetFirstIPDataPacketFrom(IPAddress ipAddress, int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPAddress | ipAddress | The IP address to look for in the list of packets. |
System.Int32 | timeout | The time in milliseconds to wait for an IP data packet to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first IP packet whose IP address matches the provided IP address. |
See Also
GetFirstPacket(Int32)
Returns the first packet from the queue waiting up to the specified timeout if necessary
for an XBee packet to become available. Or null
if the queue is empty.
Declaration
public XBeePacket GetFirstPacket(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout | The time in milliseconds to wait for an XBee packet to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first packet from the queue, |
See Also
GetFirstPacketFrom(RemoteXBeeDevice, Int32)
Returns the first packet from the queue whose 64-bit source address matches the address of the provided remote XBee device.
Declaration
public XBeePacket GetFirstPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
Parameters
Type | Name | Description |
---|---|---|
RemoteXBeeDevice | remoteXBeeDevice | The remote XBee device containing the 4-bit address to look for in the list of packets. |
System.Int32 | timeout | The time in milliseconds to wait for an XBee packet from the specified remote XBee device to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first XBee packet whose 64-bit address matches the address of the provided remote
XBee device. |
Remarks
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.
See Also
GetFirstUserDataRelayPacket(Int32)
Returns the first User Data Relay packet from the queue waiting up to the specified timeout if
necessary for the packet to become available. null
if the queue is empty or there is not
any User Data Relay packet inside.
Declaration
public XBeePacket GetFirstUserDataRelayPacket(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | timeout | The time in milliseconds to wait for a User Data Relay packet to become available. 0 to return immediately. |
Returns
Type | Description |
---|---|
XBeePacket | The first User Data Relay packet from the queue, |