public class SendDataRequestPacket extends XBeeAPIPacket
This frame type is used to send a file of the given name and type to Device Cloud.
If the frame ID is non-zero, a SendDataResponsePacket
will be
received.
SendDataResponsePacket
,
XBeeAPIPacket
NO_FRAME_ID
Constructor and Description |
---|
SendDataRequestPacket(int frameID,
String path,
String contentType,
SendDataRequestOptions options,
byte[] fileData)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
static SendDataRequestPacket |
createPacket(byte[] payload)
Creates a new
SendDataRequestPacket object from the given payload. |
LinkedHashMap<String,String> |
getAPIPacketParameters()
Returns a map with the XBee packet parameters and their values.
|
String |
getContentType()
Retrieves the content type of the file to upload.
|
byte[] |
getFileData()
Retrieves the data of the file to upload.
|
SendDataRequestOptions |
getOptions()
Retrieves the file upload operation options.
|
String |
getPath()
Retrieves the path of the file to upload to Device Cloud.
|
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 |
setContentType(String contentType)
Sets the content type of the file to upload.
|
void |
setFileData(byte[] fileData)
Sets the data of the file to upload.
|
void |
setOptions(SendDataRequestOptions options)
Sets the file upload operation options.
|
void |
setPath(String path)
Sets the path of the file to upload to Device Cloud.
|
checkFrameID, getAPIData, getFrameID, getFrameType, getFrameTypeValue, getPacketData, setFrameID
equals, generateByteArray, generateByteArrayEscaped, getChecksum, getPacketLength, getParameters, hashCode, parsePacket, parsePacket, toPrettyString, toString
public SendDataRequestPacket(int frameID, String path, String contentType, SendDataRequestOptions options, byte[] fileData)
SendDataRequestPacket
object with the given parameters.frameID
- Frame ID.path
- Path of the file to upload to Device Cloud.contentType
- Content type of the file to upload.options
- Options.fileData
- Data of the file to upload.IllegalArgumentException
- if frameID < 0
or
if frameID > 255
.NullPointerException
- if options == null
.SendDataRequestOptions
public static SendDataRequestPacket createPacket(byte[] payload)
SendDataRequestPacket
object from the given payload.payload
- The API frame payload. It must start with the frame type
corresponding to a Send Data Request packet
(0x28
). The byte array must be in
OperatingMode.API
mode.IllegalArgumentException
- if payload[0] != APIFrameType.SEND_DATA_REQUEST.getValue()
or
if payload.length <
.NullPointerException
- if payload == null
.public LinkedHashMap<String,String> getAPIPacketParameters()
XBeeAPIPacket
public String getContentType()
setContentType(String)
public byte[] getFileData()
setFileData(byte[])
public SendDataRequestOptions getOptions()
setOptions(SendDataRequestOptions)
,
SendDataRequestOptions
public String getPath()
setPath(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 setContentType(String contentType)
contentType
- The content type of the file to upload.getContentType()
public void setFileData(byte[] fileData)
fileData
- Data of the file to upload.getFileData()
public void setOptions(SendDataRequestOptions options)
options
- File upload operation options.NullPointerException
- if options == null
.getOptions()
,
SendDataRequestOptions
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.