public class ReceivePacket extends XBeeAPIPacket
When the module receives an RF packet, it is sent out the UART using this message type.
This packet is received when external devices send transmit request packets to this module.
Among received data, some options can also be received indicating transmission parameters.
TransmitPacket
,
XBeeReceiveOptions
,
XBeeAPIPacket
NO_FRAME_ID
Constructor and Description |
---|
ReceivePacket(XBee64BitAddress sourceAddress64,
XBee16BitAddress sourceAddress16,
int receiveOptions,
byte[] rfData)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
static ReceivePacket |
createPacket(byte[] payload)
Creates a new
ReceivePacket object from the given payload. |
XBee16BitAddress |
get16bitSourceAddress()
Returns the 16-bit sender/source address.
|
XBee64BitAddress |
get64bitSourceAddress()
Returns the 64-bit sender/source address.
|
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
int |
getReceiveOptions()
Returns the receive options bitfield.
|
byte[] |
getRFData()
Returns the received RF data.
|
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 received RF data.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameID
generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, parsePacket, parsePacket, toPrettyString, toString
public ReceivePacket(XBee64BitAddress sourceAddress64, XBee16BitAddress sourceAddress16, int receiveOptions, byte[] rfData)
ReceivePacket
object
with the given parameters.sourceAddress64
- 64-bit address of the sender.sourceAddress16
- 16-bit address of the sender.receiveOptions
- Bitfield indicating the receive options.rfData
- Received RF data.IllegalArgumentException
- if receiveOptions < 0
or
if receiveOptions > 255
.NullPointerException
- if sourceAddress64 == null
or
if sourceAddress16 == null
.XBeeReceiveOptions
,
XBee16BitAddress
,
XBee64BitAddress
public static ReceivePacket createPacket(byte[] payload)
ReceivePacket
object from the given payload.payload
- The API frame payload. It must start with the frame type
corresponding to a Receive packet (0x90
).
The byte array must be in OperatingMode.API
mode.IllegalArgumentException
- if payload[0] != APIFrameType.RECEIVE_PACKET.getValue()
or
if payload.length < {@value #MIN_API_PAYLOAD_LENGTH}
or
if receiveOptions < 0
or
if receiveOptions > 255
.NullPointerException
- if payload == null
.public XBee16BitAddress get16bitSourceAddress()
XBee16BitAddress
public XBee64BitAddress get64bitSourceAddress()
XBee64BitAddress
public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacket
public int getReceiveOptions()
XBeeReceiveOptions
public byte[] getRFData()
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
- Received RF data.© Copyright 2014–2014 Digi International Inc. All rights reserved.