com.digi.xbee.api.packet.raw

## Class RX16Packet

- java.lang.Object
- - com.digi.xbee.api.packet.XBeePacket
  - - com.digi.xbee.api.packet.XBeeAPIPacket
    - - com.digi.xbee.api.packet.raw.RX16Packet

-     public class RX16Packet
      extends XBeeAPIPacket

  This class represents an RX (Receive) 16 Request packet. Packet is built using the parameters of the constructor or providing a valid API payload.

  When the module receives an RF packet, it is sent out the UART using this message type

  This packet is the response to TX (transmit) 16 Request packets.

  See Also:
    `TX16Packet`, `XBeeAPIPacket`

- - ### Field Summary

    - ### Fields inherited from class com.digi.xbee.api.packet.XBeeAPIPacket

      `NO_FRAME_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RX16Packet(XBee16BitAddress sourceAddress16, int rssi, int receiveOptions, byte[] rfData)` Class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RX16Packet` | `createPacket(byte[] payload)` Creates a new `RX16Packet` object from the given payload.
    `XBee16BitAddress` | `get16bitSourceAddress()` Returns the 16-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.
    `int` | `getRSSI()` Returns the Received Signal Strength Indicator (RSSI).
    `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.

    - ### Methods inherited from class com.digi.xbee.api.packet.XBeeAPIPacket

      `checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameID`

    - ### Methods inherited from class com.digi.xbee.api.packet.XBeePacket

      `generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, parsePacket, parsePacket, toPrettyString, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RX16Packet

          public RX16Packet(XBee16BitAddress sourceAddress16,
                    int rssi,
                    int receiveOptions,
                    byte[] rfData)

      Class constructor. Instantiates a new `RX16Packet` object with the given parameters.
      Parameters:
        `sourceAddress16` - 16-bit address of the sender.
        `rssi` - Received signal strength indicator.
        `receiveOptions` - Bitfield indicating the receive options.
        `rfData` - Received RF data.
      Throws:
        `IllegalArgumentException` - if `rssi < 0` or if `rssi > 100` or if `receiveOptions < 0` or if `receiveOptions > 255`.
        `NullPointerException` - if `sourceAddress16 == null`.
      See Also:
        `XBeeReceiveOptions`, `XBee16BitAddress`

  - ### Method Detail

    - #### createPacket

          public static RX16Packet createPacket(byte[] payload)

      Creates a new `RX16Packet` object from the given payload.
      Parameters:
        `payload` - The API frame payload. It must start with the frame type corresponding to a RX16 packet (`0x81`). The byte array must be in `OperatingMode.API` mode.
      Returns:
        Parsed RX 16 packet.
      Throws:
        `IllegalArgumentException` - if `payload[0] != APIFrameType.RX_16.getValue()` or if `payload.length <` or if `rssi < 0` or if `rssi > 100` or if `receiveOptions < 0` or if `receiveOptions > 255`.
        `NullPointerException` - if `payload == null`.

    - #### get16bitSourceAddress

          public XBee16BitAddress get16bitSourceAddress()

      Returns the 16-bit sender/source address.
      Returns:
        The 16-bit sender/source address.
      See Also:
        `XBee16BitAddress`

    - #### getAPIPacketParameters

          public LinkedHashMap<String,String> getAPIPacketParameters()

      Description copied from class: `XBeeAPIPacket`
      Returns a map with the XBee packet parameters and their values.
      Returns:
        A sorted map containing the XBee packet parameters with their values.

    - #### getReceiveOptions

          public int getReceiveOptions()

      Returns the receive options bitfield.
      Returns:
        Receive options bitfield.
      See Also:
        `XBeeReceiveOptions`

    - #### getRFData

          public byte[] getRFData()

      Returns the received RF data.
      Returns:
        Received RF data.

    - #### getRSSI

          public int getRSSI()

      Returns the Received Signal Strength Indicator (RSSI).
      Returns:
        The Received Signal Strength Indicator (RSSI).

    - #### isBroadcast

          public boolean isBroadcast()

      Description copied from class: `XBeeAPIPacket`
      Returns whether or not the packet is a broadcast packet.
      Overrides:
        `isBroadcast` in class `XBeeAPIPacket`
      Returns:
        `true` if the packet is a broadcast packet, `false` otherwise.

    - #### needsAPIFrameID

          public boolean needsAPIFrameID()

      Description copied from class: `XBeeAPIPacket`
      Returns whether the API packet needs API Frame ID or not.
      Specified by:
        `needsAPIFrameID` in class `XBeeAPIPacket`
      Returns:
        `true` if the packet needs API Frame ID, `false` otherwise.

    - #### setRFData

          public void setRFData(byte[] rfData)

      Sets the received RF data.
      Parameters:
        `rfData` - Received RF data.

© Copyright 2014–2014 Digi International Inc. All rights reserved.