public abstract class XBeeAPIPacket extends XBeePacket
Derived classes should implement their own methods to generate the API data and frame ID in case they support it.
Basic operations such as frame type retrieval are performed in this class.
XBeePacket
Modifier and Type | Field and Description |
---|---|
static int |
NO_FRAME_ID |
Modifier and Type | Method and Description |
---|---|
boolean |
checkFrameID(int id)
Returns whether the given ID is the current frame ID.
|
byte[] |
getAPIData()
Returns the XBee API packet data.
|
int |
getFrameID()
Returns the Frame ID of the API packet.
|
APIFrameType |
getFrameType()
Returns the XBee packet frame type.
|
int |
getFrameTypeValue()
Returns the XBee packet frame type integer value.
|
byte[] |
getPacketData()
Returns the packet data.
|
abstract boolean |
isBroadcast()
Returns whether or not the packet is a broadcast packet.
|
abstract boolean |
needsAPIFrameID()
Returns whether the API packet needs API Frame ID or not.
|
void |
setFrameID(int frameID)
Sets the frame ID of the API packet.
|
generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, parsePacket, parsePacket, toPrettyString, toString
public static final int NO_FRAME_ID
public boolean checkFrameID(int id)
id
- The frame id to check.true
if frame ID is equal to the id
provided,
false
otherwise or if the frame does not need an ID.getFrameID()
,
needsAPIFrameID()
,
setFrameID(int)
public byte[] getAPIData()
This does not include the frame ID if it is needed.
public int getFrameID()
If the frame ID is not configured or if the API packet does not need
a Frame ID (if (!needsAPIFrameID())
) this method returns
NO_FRAME_ID
(9999).
NO_FRAME_ID
,
needsAPIFrameID()
,
setFrameID(int)
public APIFrameType getFrameType()
APIFrameType
public int getFrameTypeValue()
public byte[] getPacketData()
XBeePacket
getPacketData
in class XBeePacket
public abstract boolean isBroadcast()
true
if the packet is a broadcast packet, false
otherwise.public abstract boolean needsAPIFrameID()
true
if the packet needs API Frame ID, false
otherwise.public void setFrameID(int frameID)
If the API packet does not need a frame ID
(if (!needsAPIFrameID())
), this method does nothing.
frameID
- The frame ID to set.IllegalArgumentException
- if frameID < 0
or
if frameID > 255
.getFrameID()
© Copyright 2014–2014 Digi International Inc. All rights reserved.