com.digi.xbee.api.packet.common

## Class RemoteATCommandResponsePacket

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

-     public class RemoteATCommandResponsePacket
      extends XBeeAPIPacket

  This class represents a Remote AT Command Response packet. Packet is built using the parameters of the constructor or providing a valid API payload.

  If a module receives a remote command response RF data frame in response to a Remote AT Command Request, the module will send a Remote AT Command Response message out the UART. Some commands may send back multiple frames-- for example, Node Discover (`ND`) command.

  This packet is received in response of a `RemoteATCommandPacket`.

  Response also includes an `ATCommandStatus` object with the status of the AT command.

  See Also:
    `RemoteATCommandPacket`, `ATCommandStatus`, `XBeeAPIPacket`

- - ### Field Summary

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

      `NO_FRAME_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RemoteATCommandResponsePacket(int frameID, XBee64BitAddress sourceAddress64, XBee16BitAddress sourceAddress16, String command, ATCommandStatus status, byte[] commandValue)` Class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RemoteATCommandResponsePacket` | `createPacket(byte[] payload)` Creates an new `RemoteATCommandResponsePacket` object from the given payload.
    `XBee16BitAddress` | `get16bitSourceAddress()` Returns the 16-bit source address.
    `XBee64BitAddress` | `get64bitSourceAddress()` Returns the 64-bit source address.
    `LinkedHashMap<String,String>` | `getAPIPacketParameters()` Returns a map with the XBee packet parameters and their values.
    `String` | `getCommand()` Returns the AT command.
    `byte[]` | `getCommandValue()` Retrieves the AT command response value.
    `String` | `getCommandValueAsString()` Returns the AT command response value as String.
    `ATCommandStatus` | `getStatus()` Returns the AT command response status.
    `boolean` | `needsAPIFrameID()` Returns whether the API packet needs API Frame ID or not.
    `void` | `setCommandValue(byte[] commandValue)` Sets the AT response response value.
    `void` | `setCommandValue(String commandValue)` Sets the AT command response value as String.

    - ### 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

    - #### RemoteATCommandResponsePacket

          public RemoteATCommandResponsePacket(int frameID,
                                       XBee64BitAddress sourceAddress64,
                                       XBee16BitAddress sourceAddress16,
                                       String command,
                                       ATCommandStatus status,
                                       byte[] commandValue)

      Class constructor. Instantiates a new `RemoteATCommandResponsePacket` object with the given parameters.
      Parameters:
        `frameID` - frame ID.
        `sourceAddress64` - 64-bit address of the remote radio returning response.
        `sourceAddress16` - 16-bit network address of the remote.
        `command` - The AT command.
        `status` - The command status.
        `commandValue` - The AT command response value.
      Throws:
        `IllegalArgumentException` - if `frameID < 0` or if `frameID > 255`.
        `NullPointerException` - if `sourceAddress64 == null` or if `sourceAddress16 == null` or if `command == null` or if `status == null`.
      See Also:
        `ATCommandStatus`, `XBee16BitAddress`, `XBee64BitAddress`

  - ### Method Detail

    - #### createPacket

          public static RemoteATCommandResponsePacket createPacket(byte[] payload)

      Creates an new `RemoteATCommandResponsePacket` object from the given payload.
      Parameters:
        `payload` - The API frame payload. It must start with the frame type corresponding to a Remote AT Command Response packet (`0x97`). The byte array must be in `OperatingMode.API` mode.
      Returns:
        Parsed Remote AT Command Response packet.
      Throws:
        `IllegalArgumentException` - if `payload[0] != APIFrameType.REMOTE_AT_COMMAND_RESPONSE.getValue()` or if `payload.length <` or if `frameID < 0` or if `frameID > 255`.
        `NullPointerException` - if `payload == null`.

    - #### get16bitSourceAddress

          public XBee16BitAddress get16bitSourceAddress()

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

    - #### get64bitSourceAddress

          public XBee64BitAddress get64bitSourceAddress()

      Returns the 64-bit source address.
      Returns:
        The 64-bit source address.
      See Also:
        `XBee64BitAddress`

    - #### 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.

    - #### getCommand

          public String getCommand()

      Returns the AT command.
      Returns:
        The AT command.

    - #### getCommandValue

          public byte[] getCommandValue()

      Retrieves the AT command response value.
      Returns:
        The AT command response value.

    - #### getCommandValueAsString

          public String getCommandValueAsString()

      Returns the AT command response value as String.
      Returns:
        The AT command response value as String, `null` if no value is set.

    - #### getStatus

          public ATCommandStatus getStatus()

      Returns the AT command response status.
      Returns:
        The AT command response status.
      See Also:
        `ATCommandStatus`

    - #### 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.

    - #### setCommandValue

          public void setCommandValue(byte[] commandValue)

      Sets the AT response response value.
      Parameters:
        `commandValue` - The AT command response value.

    - #### setCommandValue

          public void setCommandValue(String commandValue)

      Sets the AT command response value as String.
      Parameters:
        `commandValue` - The AT command response value as String.

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