com.digi.xbee.api.packet.common

## Class RemoteATCommandPacket

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

-     public class RemoteATCommandPacket
      extends XBeeAPIPacket

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

  Used to query or set module parameters on a remote device. For parameter changes on the remote device to take effect, changes must be applied, either by setting the apply changes options bit, or by sending an `AC` command to the remote node.

  Remote Command options are set as a bitfield.

  If configured, command response is received as a `RemoteATCommandResponse packet`.

  See Also:
    `RemoteATCommandResponsePacket`, `XBeeAPIPacket`

- - ### Field Summary

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

      `NO_FRAME_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RemoteATCommandPacket(int frameID, XBee64BitAddress destAddress64, XBee16BitAddress destAddress16, int transmitOptions, String command, byte[] parameter)` Class constructor.
    `RemoteATCommandPacket(int frameID, XBee64BitAddress destAddress64, XBee16BitAddress destAddress16, int transmitOptions, String command, String parameter)` Class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RemoteATCommandPacket` | `createPacket(byte[] payload)` Creates a new `RemoteATCommandPacket` 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.
    `String` | `getCommand()` Returns the AT Command.
    `byte[]` | `getParameter()` Returns the AT command parameter.
    `String` | `getParameterAsString()` Returns the AT command parameter as String.
    `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` | `setParameter(byte[] parameter)` Sets the AT command parameter.
    `void` | `setParameter(String parameter)` Sets the AT command parameter as String.

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

    - #### RemoteATCommandPacket

          public RemoteATCommandPacket(int frameID,
                               XBee64BitAddress destAddress64,
                               XBee16BitAddress destAddress16,
                               int transmitOptions,
                               String command,
                               byte[] parameter)

      Class constructor. Instantiates a new `RemoteATCommandRequest` object with the given parameters.
      Parameters:
        `frameID` - Frame ID.
        `destAddress64` - 64-bit address of the destination device.
        `destAddress16` - 16-bit address of the destination device.
        `transmitOptions` - Bitfield of supported transmission options.
        `command` - AT command.
        `parameter` - AT command parameter.
      Throws:
        `IllegalArgumentException` - if `frameID < 0` or if `frameID > 255` or if `transmitOptions < 0` or if `transmitOptions > 255`.
        `NullPointerException` - if `destAddress64 == null` or if `destAddress16 == null` or if `command == null`.
      See Also:
        `XBeeTransmitOptions`, `XBee16BitAddress`, `XBee64BitAddress`

    - #### RemoteATCommandPacket

          public RemoteATCommandPacket(int frameID,
                               XBee64BitAddress destAddress64,
                               XBee16BitAddress destAddress16,
                               int transmitOptions,
                               String command,
                               String parameter)

      Class constructor. Instantiates a new `RemoteATCommandRequest` object with the given parameters.
      Parameters:
        `frameID` - The Frame ID.
        `destAddress64` - 64-bit address of the destination device.
        `destAddress16` - 16-bit address of the destination device.
        `transmitOptions` - Bitfield of supported transmission options.
        `command` - AT command.
        `parameter` - AT command parameter as String.
      Throws:
        `IllegalArgumentException` - if `frameID < 0` or if `frameID > 255` or if `transmitOptions < 0` or if `transmitOptions > 255`.
        `NullPointerException` - if `destAddress64 == null` or if `destAddress16 == null` or if `command == null`.
      See Also:
        `XBeeTransmitOptions`, `XBee16BitAddress`, `XBee64BitAddress`

  - ### Method Detail

    - #### createPacket

          public static RemoteATCommandPacket createPacket(byte[] payload)

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

    - #### get16bitDestinationAddress

          public XBee16BitAddress get16bitDestinationAddress()

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

    - #### get64bitDestinationAddress

          public XBee64BitAddress get64bitDestinationAddress()

      Returns the 64 bit destination address.
      Returns:
        The 64 bit destination 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.

    - #### getParameter

          public byte[] getParameter()

      Returns the AT command parameter.
      Returns:
        The AT command parameter.

    - #### getParameterAsString

          public String getParameterAsString()

      Returns the AT command parameter as String.
      Returns:
        The AT command parameter as String, `null` if not parameter is set.

    - #### getTransmitOptions

          public int getTransmitOptions()

      Returns the transmit options bitfield.
      Returns:
        Transmit options bitfield.
      See Also:
        `XBeeTransmitOptions`

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

    - #### setParameter

          public void setParameter(byte[] parameter)

      Sets the AT command parameter.
      Parameters:
        `parameter` - The AT command parameter.

    - #### setParameter

          public void setParameter(String parameter)

      Sets the AT command parameter as String.
      Parameters:
        `parameter` - The AT command parameter as String.

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