com.digi.xbee.api.packet

## Class GenericXBeePacket

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

-     public class GenericXBeePacket
      extends XBeeAPIPacket

  This class represents a basic and Generic XBee packet where the payload is set as a byte array without a defined structure.
  See Also:
    `XBeeAPIPacket`

- - ### Field Summary

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

      `NO_FRAME_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericXBeePacket(byte[] rfData)` Class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static GenericXBeePacket` | `createPacket(byte[] payload)` Creates a new `GenericXBeePacket` from the given payload.
    `byte[]` | `getRFData()` Returns the XBee RF Data of the packet.
    `boolean` | `needsAPIFrameID()` Returns whether the API packet needs API Frame ID or not.
    `void` | `setRFData(byte[] rfData)` Sets the XBee RF Data.

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

      `checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, isBroadcast, 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

    - #### GenericXBeePacket

          public GenericXBeePacket(byte[] rfData)

      Class constructor. Instantiates an XBee packet with the given packet data.
      Parameters:
        `rfData` - The XBee RF Data.

  - ### Method Detail

    - #### createPacket

          public static GenericXBeePacket createPacket(byte[] payload)

      Creates a new `GenericXBeePacket` from the given payload.
      Parameters:
        `payload` - The API frame payload. It must start with the frame type corresponding to a Generic packet (`0xFF`). The byte array must be in `OperatingMode.API` mode.
      Returns:
        Parsed Generic packet.
      Throws:
        `IllegalArgumentException` - if `payload[0] != APIFrameType.GENERIC.getValue()` or if `payload.length <` .
        `NullPointerException` - if `payload == null`.

    - #### getRFData

          public byte[] getRFData()

      Returns the XBee RF Data of the packet.
      Returns:
        The RF Data.

    - #### 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 XBee RF Data.
      Parameters:
        `rfData` - The new XBee RF Data.

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