public class ATCommandResponsePacket extends XBeeAPIPacket
In response to an AT Command message, the module will send an AT Command Response message. Some commands will send back multiple frames (for example, the ND (Node Discover) command).
This packet is received in response of an ATCommandPacket
.
Response also includes an ATCommandStatus
object with the status
of the AT command.
ATCommandPacket
,
ATCommandStatus
,
XBeeAPIPacket
NO_FRAME_ID
Constructor and Description |
---|
ATCommandResponsePacket(int frameID,
ATCommandStatus status,
String command,
byte[] commandValue)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
static ATCommandResponsePacket |
createPacket(byte[] payload)
Creates a new
ATCommandResponsePacket object from the given
payload. |
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
String |
getCommand()
Returns the AT command.
|
byte[] |
getCommandValue()
Returns the AT command response value.
|
String |
getCommandValueAsString()
Returns the AT command response value as String.
|
ATCommandStatus |
getStatus()
Returns the AT command response status.
|
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 |
setCommandValue(byte[] commandValue)
Sets the AT command response value.
|
void |
setCommandValue(String commandValue)
Sets the AT command response value as String.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameID
generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, parsePacket, parsePacket, toPrettyString, toString
public ATCommandResponsePacket(int frameID, ATCommandStatus status, String command, byte[] commandValue)
ATCommandResponsePacket
object with the given parameters.frameID
- The XBee API frame ID.status
- The AT command response status.command
- The AT command.commandValue
- The AT command response value.IllegalArgumentException
- if frameID < 0
or
if frameID > 255
.NullPointerException
- if status == null
or
if command == null
.ATCommandStatus
public static ATCommandResponsePacket createPacket(byte[] payload)
ATCommandResponsePacket
object from the given
payload.payload
- The API frame payload. It must start with the frame type
corresponding to a AT Command Response packet (0x88
).
The byte array must be in OperatingMode.API
mode.IllegalArgumentException
- if payload[0] != APIFrameType.AT_COMMAND.getValue()
or
if payload.length <
or
if frameID < 0
or
if frameID > 255
.NullPointerException
- if payload == null
.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacket
public String getCommand()
public byte[] getCommandValue()
public String getCommandValueAsString()
null
if no
value is set.public ATCommandStatus getStatus()
ATCommandStatus
public boolean isBroadcast()
XBeeAPIPacket
isBroadcast
in class XBeeAPIPacket
true
if the packet is a broadcast packet, false
otherwise.public boolean needsAPIFrameID()
XBeeAPIPacket
needsAPIFrameID
in class XBeeAPIPacket
true
if the packet needs API Frame ID, false
otherwise.public void setCommandValue(byte[] commandValue)
commandValue
- The AT command response value.public void setCommandValue(String commandValue)
commandValue
- The AT command response value as String.© Copyright 2014–2014 Digi International Inc. All rights reserved.