public class DeviceRequestPacket extends XBeeAPIPacket
This frame type is sent out the serial port when the XBee module receives a valid device request from Device Cloud.
DeviceResponsePacket
,
XBeeAPIPacket
NO_FRAME_ID
Constructor and Description |
---|
DeviceRequestPacket(int requestID,
String target,
byte[] requestData)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
static DeviceRequestPacket |
createPacket(byte[] payload)
Creates a new
DeviceRequestPacket object from the given payload. |
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
int |
getFlags()
Retrieves the flags.
|
byte[] |
getRequestData()
Retrieves the data of the device request.
|
int |
getRequestID()
Retrieves the ID of the device request.
|
String |
getRequestTarget()
Retrieves the device request target.
|
int |
getTransport()
Retrieves the transport.
|
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 |
setRequestData(byte[] requestData)
Sets the data of the device request.
|
void |
setRequestID(int requestID)
Sets ID of the device request.
|
void |
setRequestTarget(String target)
Sets the device request target.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameID
equals, generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, hashCode, parsePacket, parsePacket, toPrettyString, toString
public DeviceRequestPacket(int requestID, String target, byte[] requestData)
DeviceRequestPacket
object
with the given parameters.requestID
- Identifies the device request. (0 has no special meaning.)target
- Device request target.requestData
- Data of the request.IllegalArgumentException
- if requestID < 0
or
if requestID > 255
or
if target.length() > 255
.public static DeviceRequestPacket createPacket(byte[] payload)
DeviceRequestPacket
object from the given payload.payload
- The API frame payload. It must start with the frame type
corresponding to a Device Request packet (0xB9
).
The byte array must be in OperatingMode.API
mode.IllegalArgumentException
- if payload[0] != APIFrameType.DEVICE_REQUEST.getValue()
or
if payload.length <
.NullPointerException
- if payload == null
.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacket
public int getFlags()
public byte[] getRequestData()
setRequestData(byte[])
public int getRequestID()
setRequestID(int)
public String getRequestTarget()
setRequestTarget(String)
public int getTransport()
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 setRequestData(byte[] requestData)
requestData
- Data of the device request.getRequestData()
public void setRequestID(int requestID)
requestID
- ID of the device request.IllegalArgumentException
- if requestID < 0
or
if requestID > 255
.getRequestID()
public void setRequestTarget(String target)
target
- The device request target.IllegalArgumentException
- if target.length() > 255
.getRequestTarget()
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.