public class CoAPTxRequestPacket extends XBeeAPIPacket
A CoAP Tx Request packet is used to send a CoAP message to a remote device of the network identified by an IPv6 address.
If the frame ID specified in the packet is different than zero, a Transmit
Status frame (0x8B) is received with the status of the transmission. See
TransmitStatusPacket.
The method indicates the HTTP function used for the transmission. It is
specified by the HTTPMethodEnum enumerator.
The URI field is a string that must be for data transmission (PUT), for AT Command operations (PUT or GET) or for IO operation (POST).
The packet also includes an optional payload. For data transmission, it should contain the data to send; for AT Command operations, empty to query the setting (GET) or the new value (PUT).
CoAPRxResponsePacket,
XBeeAPIPacketNO_FRAME_ID| Constructor and Description |
|---|
CoAPTxRequestPacket(int frameID,
int transmitOptions,
HTTPMethodEnum method,
Inet6Address destAddress,
String uri,
byte[] payload)
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static CoAPTxRequestPacket |
createPacket(byte[] payload)
Creates a new
CoAPTxRequestPacket object from the given payload. |
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
Inet6Address |
getDestAddress()
Retrieves the destination IPv6 address.
|
HTTPMethodEnum |
getMethod()
Returns the HTTP method used for the transmission.
|
byte[] |
getPayload()
Retrieves the transmission data.
|
int |
getTransmitOptions()
Retrieves the transmit options bitfield.
|
String |
getURI()
Retrieves the URI.
|
boolean |
needsAPIFrameID()
Returns whether the API packet needs API Frame ID or not.
|
void |
setDestAddress(Inet6Address destAddress)
Sets the destination IPv6 address.
|
void |
setMethod(HTTPMethodEnum method)
Sets the HTTP method used for the transmission.
|
void |
setPayload(byte[] payload)
Sets the new transmission data.
|
void |
setTransmitOptions(int transmitOptions)
Sets the transmit options bifield.
|
void |
setURI(String uri)
Sets the URI.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, isBroadcast, setFrameIDequals, generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, hashCode, parsePacket, parsePacket, toPrettyString, toStringpublic CoAPTxRequestPacket(int frameID, int transmitOptions, HTTPMethodEnum method, Inet6Address destAddress, String uri, byte[] payload)
CoAPTxRequestPacket object with
the given parameters.frameID - Frame ID.transmitOptions - Bitfield of supported transmission options.method - HTTP method used for the transmission.destAddress - IPv6 address of the destination device.uri - Uniform Resource Identifier.payload - Payload.IllegalArgumentException - if frameID < 0 or
if frameID > 255 or
if uri contains and transmitOptions != or transmitOptions !=
if uri does not contain and transmitOptions != .NullPointerException - if method == null or
if destAddress == null or
if uri == null.HTTPMethodEnum,
RemoteATCommandOptions,
Inet6Addresspublic static CoAPTxRequestPacket createPacket(byte[] payload)
CoAPTxRequestPacket object from the given payload.payload - The API frame payload. It must start with the frame type
corresponding to a CoAP Tx Request packet (0x1C).
The byte array must be in OperatingMode.API mode.IllegalArgumentException - if payload[0] != APIFrameType.COAP_TX_REQUEST.getValue() or
if payload.length < .NullPointerException - if payload == null.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacketpublic Inet6Address getDestAddress()
setDestAddress(Inet6Address),
Inet6Addresspublic HTTPMethodEnum getMethod()
setMethod(HTTPMethodEnum),
HTTPMethodEnumpublic byte[] getPayload()
setPayload(byte[])public int getTransmitOptions()
setTransmitOptions(int),
RemoteATCommandOptionspublic String getURI()
setURI(String)public boolean needsAPIFrameID()
XBeeAPIPacketneedsAPIFrameID in class XBeeAPIPackettrue if the packet needs API Frame ID, false
otherwise.public void setDestAddress(Inet6Address destAddress)
destAddress - The new destination IPv6 address.NullPointerException - if destAddress == null.getDestAddress(),
Inet6Addresspublic void setMethod(HTTPMethodEnum method)
method - HTTP method.getMethod(),
HTTPMethodEnumpublic void setPayload(byte[] payload)
payload - The transmission data.getPayload()public void setTransmitOptions(int transmitOptions)
transmitOptions - The transmit options bitfield.IllegalArgumentException - if uri contains and transmitOptions != or transmitOptions !=
if uri does not contain and transmitOptions != .getTransmitOptions(),
RemoteATCommandOptionspublic void setURI(String uri)
uri - URI.NullPointerException - if uri == null.getURI()© Copyright 2014 - 2019 Digi International Inc. All rights reserved.