XBee C# library API reference

Show / Hide Table of Contents

Class TXIPv4Packet

This class represents a TX (Transmit) IPv4 packet. Packet is built using the parameters of the constructor or providing a valid API payload.

Inheritance
System.Object
XBeePacket
XBeeAPIPacket
TXIPv4Packet
Inherited Members
XBeeAPIPacket.NO_FRAME_ID
XBeeAPIPacket.FrameID
XBeeAPIPacket.FrameType
XBeeAPIPacket.FrameTypeValue
XBeeAPIPacket.APIData
XBeeAPIPacket.PacketParameters
XBeeAPIPacket.CheckFrameID(Int32)
XBeeAPIPacket.GetPacketData()
XBeePacket.PacketLength
XBeePacket.Checksum
XBeePacket.Parameters
XBeePacket.GenerateByteArray()
XBeePacket.GenerateByteArrayEscaped()
XBeePacket.ToString()
XBeePacket.ToPrettyString()
XBeePacket.ParsePacket(String, OperatingMode)
XBeePacket.ParsePacket(Byte[], OperatingMode)
XBeePacket.Equals(Object)
XBeePacket.GetHashCode()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: XBeeLibrary.Core.Packet.IP
Assembly: XBeeLibrary.Core.dll
Syntax
public class TXIPv4Packet : XBeeAPIPacket

Constructors

TXIPv4Packet(Byte, IPAddress, Int32, Int32, IPProtocol, Int32, Byte[])

Class constructor. Instantiates a new TXIPv4Packet object with the given parameters.

Declaration
public TXIPv4Packet(byte frameID, IPAddress destAddress, int destPort, int sourcePort, IPProtocol protocol, int transmitOptions, byte[] data)
Parameters
Type Name Description
System.Byte frameID

Frame ID.

System.Net.IPAddress destAddress

32-bit IP address of the destination device.

System.Int32 destPort

Destination port number.

System.Int32 sourcePort

Source port number.

IPProtocol protocol

Protocol used for transmitted data.

System.Int32 transmitOptions

Transmit options bitfield.

System.Byte[] data

Transmit data bytes.

Exceptions
Type Condition
System.ArgumentException

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 is invalid or if protocol is unknown.

See Also
System.Net.IPAddress
IPProtocol

Fields

OPTIONS_CLOSE_SOCKET

Declaration
public const int OPTIONS_CLOSE_SOCKET = 2
Field Value
Type Description
System.Int32

OPTIONS_LEAVE_SOCKET_OPEN

Declaration
public const int OPTIONS_LEAVE_SOCKET_OPEN = 0
Field Value
Type Description
System.Int32

Properties

APIPacketParameters

Gets a map with the XBee packet parameters and their values.

Declaration
protected override LinkedDictionary<string, string> APIPacketParameters { get; }
Property Value
Type Description
LinkedDictionary<System.String, System.String>

A sorted map containing the XBee packet parameters with their values.

Overrides
XBeeAPIPacket.APIPacketParameters

APIPacketSpecificData

Gets the XBee API packet specific data.

Declaration
protected override byte[] APIPacketSpecificData { get; }
Property Value
Type Description
System.Byte[]
Overrides
XBeeAPIPacket.APIPacketSpecificData
Remarks

This does not include the frame ID if it is needed.

Data

The transmission data.

Declaration
public byte[] Data { get; set; }
Property Value
Type Description
System.Byte[]

DestAddress

The 32-bit destination IP address.

Declaration
public IPAddress DestAddress { get; set; }
Property Value
Type Description
System.Net.IPAddress
Exceptions
Type Condition
System.ArgumentNullException

If the value to set is null.

See Also
System.Net.IPAddress

DestPort

The destination port. The port must be a number between 0 and 65535.

Declaration
public int DestPort { get; set; }
Property Value
Type Description
System.Int32
Exceptions
Type Condition
System.ArgumentException

If the value to set is not between 0 and 65535.

IsBroadcast

Indicates whether the packet is a broadcast packet.

Declaration
public override bool IsBroadcast { get; }
Property Value
Type Description
System.Boolean
Overrides
XBeeAPIPacket.IsBroadcast

NeedsAPIFrameID

Indicates whether the API packet needs API Frame ID or not.

Declaration
public override bool NeedsAPIFrameID { get; }
Property Value
Type Description
System.Boolean
Overrides
XBeeAPIPacket.NeedsAPIFrameID

Protocol

The network protocol.

Declaration
public IPProtocol Protocol { get; set; }
Property Value
Type Description
IPProtocol
Exceptions
Type Condition
System.ArgumentException

If the value to set is unknown.

SourcePort

The source port. The port must be a number between 0 and 65535.

Declaration
public int SourcePort { get; set; }
Property Value
Type Description
System.Int32
Exceptions
Type Condition
System.ArgumentException

If the value to set is not between 0 and 65535.

TransmitOptions

The transmit options. Must be OPTIONS_CLOSE_SOCKET or OPTIONS_LEAVE_SOCKET_OPEN.

Declaration
public int TransmitOptions { get; set; }
Property Value
Type Description
System.Int32
Exceptions
Type Condition
System.ArgumentException

If the value to set is invalid.

Methods

CreatePacket(Byte[])

Creates a new TXIPv4Packet object from the given payload.

Declaration
public static TXIPv4Packet CreatePacket(byte[] payload)
Parameters
Type Name Description
System.Byte[] 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 API mode.

Returns
Type Description
TXIPv4Packet

Parsed TX IPv4 packet.

Exceptions
Type Condition
System.ArgumentException

If payload[0] != APIFrameType.TX_IPV4.GetValue() or if payload.length < XBeeLibrary.Core.Packet.IP.TXIPv4Packet.MIN_API_PAYLOAD_LENGTH.

System.ArgumentNullException

If payload == null.

See Also

RXIPv4Packet
XBeeAPIPacket
Product page More documentation Official site About Digi Contact us Support
©2019 Digi International Inc. All rights reserved.
Digi International Inc.