com.digi.xbee.api.packet.common

## Class ModemStatusPacket

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

-     public class ModemStatusPacket
      extends XBeeAPIPacket

  This class represents a Modem Status packet. Packet is built using the parameters of the constructor or providing a valid API payload.

  RF module status messages are sent from the module in response to specific conditions and indicates the state of the modem in that moment.

  See Also:
    `XBeeAPIPacket`

- - ### Field Summary

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

      `NO_FRAME_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModemStatusPacket(ModemStatusEvent modemStatusEvent)` Class constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ModemStatusPacket` | `createPacket(byte[] payload)` Creates a new `ModemStatusPacket` object from the given payload.
    `LinkedHashMap<String,String>` | `getAPIPacketParameters()` Returns a map with the XBee packet parameters and their values.
    `byte[]` | `getAPIPacketSpecificData()` Returns the XBee API packet specific data.
    `ModemStatusEvent` | `getStatus()` Returns modem status event enum.
    `boolean` | `needsAPIFrameID()` Returns whether the API packet needs API Frame ID or not.

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

    - #### ModemStatusPacket

          public ModemStatusPacket(ModemStatusEvent modemStatusEvent)

      Class constructor. Instantiates a new `ModemStatusPacket` object with the given modem status.
      Parameters:
        `modemStatusEvent` - Modem status event enum. entry.
      Throws:
        `NullPointerException` - if `modemStatusEvent == null`.

  - ### Method Detail

    - #### createPacket

          public static ModemStatusPacket createPacket(byte[] payload)

      Creates a new `ModemStatusPacket` object from the given payload.
      Parameters:
        `payload` - The API frame payload. It must start with the frame type corresponding to a Modem Status packet (`0x8A`). The byte array must be in `OperatingMode.API` mode.
      Returns:
        Parsed Modem Status packet.
      Throws:
        `IllegalArgumentException` - if `payload[0] != APIFrameType.MODEM_STATUS.getValue()` or if `payload.length < {@value #MIN_API_PAYLOAD_LENGTH}`.
        `NullPointerException` - if `payload == null` or if `modemStatusEvent == null`.

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

    - #### getAPIPacketSpecificData

          public byte[] getAPIPacketSpecificData()

      Description copied from class: `XBeeAPIPacket`
      Returns the XBee API packet specific data.

      This does not include the frame ID if it is needed.

      Returns:
        The XBee API packet data.

    - #### getStatus

          public ModemStatusEvent getStatus()

      Returns modem status event enum. entry.
      Returns:
        Modem status event enum. entry.

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

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