public class TransmitPacket extends XBeeAPIPacket
A Transmit Request API frame causes the module to send data as an RF packet to the specified destination.
The 64-bit destination address should be set to 0x000000000000FFFF
for a broadcast transmission (to all devices).
The coordinator can be addressed by either setting the 64-bit address to
all 0x00
and the 16-bit address to 0xFFFE
, OR by setting the
64-bit address to the coordinator's 64-bit address and the 16-bit address to
0x0000
.
For all other transmissions, setting the 16-bit address to the correct 16-bit address can help improve performance when transmitting to multiple destinations.
If a 16-bit address is not known, this field should be set to
0xFFFE
(unknown).
The Transmit Status frame
(APIFrameType.TRANSMIT_REQUEST
) will
indicate the discovered 16-bit address, if successful (see
TransmitStatusPacket
).
The broadcast radius can be set from 0
up to NH
. If set
to 0
, the value of NH
specifies the broadcast radius
(recommended). This parameter is only used for broadcast transmissions.
The maximum number of payload bytes can be read with the NP
command.
Several transmit options can be set using the transmit options bitfield.
NO_FRAME_ID
Constructor and Description |
---|
TransmitPacket(int frameID,
XBee64BitAddress destAddress64,
XBee16BitAddress destAddress16,
int broadcastRadius,
int transmitOptions,
byte[] rfData)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
static TransmitPacket |
createPacket(byte[] payload)
Creates a new
TransmitPacket object from the given payload. |
XBee16BitAddress |
get16bitDestinationAddress()
Returns the 16-bit destination address.
|
XBee64BitAddress |
get64bitDestinationAddress()
Returns the 64-bit destination address.
|
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
int |
getBroadcastRadius()
Returns the broadcast radius.
|
byte[] |
getRFData()
Returns the RF Data to send.
|
int |
getTransmitOptions()
Returns the transmit options bitfield.
|
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 |
setRFData(byte[] rfData)
Sets the RF Data to send.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameID
generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, parsePacket, parsePacket, toPrettyString, toString
public TransmitPacket(int frameID, XBee64BitAddress destAddress64, XBee16BitAddress destAddress16, int broadcastRadius, int transmitOptions, byte[] rfData)
TransmitPacket
object
with the given parameters.frameID
- Frame ID.destAddress64
- 64-bit address of the destination device.destAddress16
- 16-bit address of the destination device.broadcastRadius
- maximum number of hops a broadcast transmission
can occur.transmitOptions
- Bitfield of supported transmission options.rfData
- RF Data that is sent to the destination device.IllegalArgumentException
- if frameID < 0
or
if frameID > 255
or
if broadcastRadius < 0
or
if broadcastRadius > 255
or
if transmitOptions < 0
or
if transmitOptions > 255
.NullPointerException
- if destAddress64 == null
or
if destAddress16 == null
.XBeeTransmitOptions
,
XBee16BitAddress
,
XBee64BitAddress
public static TransmitPacket createPacket(byte[] payload)
TransmitPacket
object from the given payload.payload
- The API frame payload. It must start with the frame type
corresponding to a Transmit packet (0x10
).
The byte array must be in OperatingMode.API
mode.IllegalArgumentException
- if payload[0] != APIFrameType.TRANSMIT_REQUEST.getValue()
or
if payload.length <
or
if frameID < 0
or
if frameID > 255
or
if broadcastRadius < 0
or
if broadcastRadius > 255
or
if transmitOptions < 0
or
if transmitOptions > 255
.NullPointerException
- if payload == null
.public XBee16BitAddress get16bitDestinationAddress()
XBee16BitAddress
public XBee64BitAddress get64bitDestinationAddress()
XBee64BitAddress
public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacket
public int getBroadcastRadius()
public byte[] getRFData()
public int getTransmitOptions()
XBeeTransmitOptions
public boolean isBroadcast()
XBeeAPIPacket
isBroadcast
in class XBeeAPIPacket
true
if the packet is a broadcast packet, false
otherwise.public boolean needsAPIFrameID()
XBeeAPIPacket
needsAPIFrameID
in class XBeeAPIPacket
true
if the packet needs API Frame ID, false
otherwise.public void setRFData(byte[] rfData)
rfData
- RF Data to send.© Copyright 2014–2014 Digi International Inc. All rights reserved.