CoapResponse class

Represents a CoAP response to a CoAP request. A response is either a piggy-backed response with type ACK or a separate response with type CON or NON.

Constructors

CoapResponse(CoapCode code, CoapMessageType? type)
Initializes a response message.
CoapResponse.createResponse(CoapRequest request, CoapCode statusCode, CoapMessageType type)
Creates a response to the specified request with the specified response code. The destination endpoint of the response is the source endpoint of the request. The response has the same token as the request. Type and ID are usually set automatically by the ReliabilityLayer>.
factory

Properties

accept CoapMediaType?
Accept
getter/setter pairinherited
acknowledgedHook ↔ HookFunction?
Acknowledged hook for attaching a callback if needed
getter/setter pairinherited
ackTimeout int
The amount of time in milliseconds after which this message will time out. A value of 0 indicates that the time should be decided automatically from the configuration. The default value is 0.
getter/setter pairinherited
bindAddress InternetAddress?
Bind address if not using the default
getter/setter pairinherited
block1 CoapBlockOption?
Block 1
getter/setter pairinherited
block2 CoapBlockOption?
Block 2
getter/setter pairinherited
bytes ↔ Uint8Buffer?
The serialized message as byte array, or null if not serialized yet.
getter/setter pairinherited
code CoapCode
The code of this CoAP message.
finalinherited
codeString String
The codestring
no setterinherited
contentFormat CoapMediaType?
The content-format of this CoAP message, Same as ContentType, only another name.
getter/setter pairinherited
contentType CoapMediaType?
Content type
getter/setter pairinherited
destination InternetAddress?
The destination endpoint.
getter/setter pairinherited
duplicate bool
Indicates whether this message is a duplicate.
getter/setter pairinherited
etags List<CoapOption>
Etags
no setterinherited
eventBus ↔ CoapEventBus?
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
hasUnknownCriticalOption bool
getter/setter pairinherited
id int?
The ID of this CoAP message.
getter/setter pairinherited
ifMatches List<CoapOption>
If-Matches.
no setterinherited
ifNoneMatches List<CoapOption>
If-None Matches.
no setterinherited
isAcknowledged bool
Indicates whether this message has been acknowledged.
getter/setter pairinherited
isCancelled bool
Indicates whether this message has been cancelled.
getter/setter pairinherited
isEmpty bool
Gets a value that indicates whether this CoAP message is an empty message.
no setterinherited
isRejected bool
Indicates whether this message has been rejected.
getter/setter pairinherited
isRequest bool
Gets a value that indicates whether this CoAP message is a request message.
no setterinherited
isResponse bool
Gets a value that indicates whether this CoAP message is a response message.
no setterinherited
isSuccess bool
no setter
isTimedOut bool
Indicates whether this message has been timed out.
getter/setter pairinherited
last bool
A value indicating whether this response is the last response of an exchange.
getter/setter pair
location String
Location
no setterinherited
locationPath String
Location path as a string
getter/setter pairinherited
locationPaths List<CoapOption>
Location paths
no setterinherited
locationQueries List<CoapOption>
Location queries
no setterinherited
locationQuery String
Location query
getter/setter pairinherited
maxAge int
The max-age of this CoAP message.
getter/setter pairinherited
maxRetransmit int
The max times this message should be retransmitted if no ACK received. A value of 0 means that the CoapConstants.maxRetransmit time shoud be taken into account, while a negative means NO retransmission. The default value is 0.
getter/setter pairinherited
multicastToken ↔ Uint8Buffer?
The initial multicast token, used for matching responses
getter/setter pair
namespace String?
no setterinherited
observe int?
Observe
getter/setter pairinherited
optionMap Map<OptionType, List<CoapOption>>
Option map
no setterinherited
payload ↔ Uint8Buffer?
The payload of this CoAP message.
getter/setter pairinherited
payloadSize int
The size of the payload of this CoAP message.
no setterinherited
payloadString String
The payload of this CoAP message in string representation.
getter/setter pairinherited
proxyScheme String?
Proxy scheme
getter/setter pairinherited
proxyUri Uri?
Proxy uri
getter/setter pairinherited
resolveHost String
Host name to resolve
getter/setter pairinherited
retransmits int
The current number of retransmits
no setterinherited
retransmittingHook ↔ HookFunction?
Retransmit hook function
getter/setter pairinherited
rtt Duration?
The Round-Trip Time of this response.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size1 int
Size 1
getter/setter pairinherited
size2 int?
Size 2
getter/setter pairinherited
source InternetAddress?
The source endpoint.
getter/setter pairinherited
statusCodeString String
Status code as a string
no setter
timedOutHook ↔ HookFunction?
Timed out hook function for attaching a callback if needed
getter/setter pairinherited
timestamp DateTime?
The timestamp when this message has been received or sent, or null if neither has happened yet.
getter/setter pairinherited
token ↔ Uint8Buffer?
The 0-8 byte token.
getter/setter pairinherited
tokenString String
As a string
no setterinherited
type CoapMessageType?
The type of this CoAP message.
getter/setter pairinherited
uriHost String?
Uri's
getter/setter pairinherited
uriPath String
URI path
getter/setter pairinherited
uriPaths List<CoapOption>
URI paths
no setterinherited
uriPort int
Uri port
getter/setter pairinherited
uriQueries List<CoapOption>
URI queries
no setterinherited
uriQuery String
URI query
getter/setter pairinherited

Methods

addEtag(CoapOption option) → void
Adds an ETag option
inherited
addETagOpaque(Uint8Buffer opaque) → void
Add an opaque ETag
inherited
addIfMatch(String etag) → void
Add an if match option, if a null string is passed the if match is not set
inherited
addIfMatchOpaque(Uint8Buffer opaque) → void
Add an opaque if match
inherited
addIfNoneMatch(CoapOption option) → void
Add an if none match option
inherited
addIfNoneMatchOpaque(Uint8Buffer opaque) → void
Add an opaque if none match
inherited
addLocationPath(String path) → void
Add a location path
inherited
addLocationQuery(String query) → void
Add a location query
inherited
addOption(CoapOption option) → void
Adds an option to the list of options of this CoAP message.
inherited
addOptions(Iterable<CoapOption> options) → void
Adds options to the list of options of this CoAP message.
inherited
addUriPath(String path) → void
Add a URI path
inherited
addUriQuery(String query) → void
Add a URI query
inherited
clearETags() → void
Clear the E tags
inherited
clearIfMatches() → void
Clear the if matches
inherited
clearIfNoneMatches() → void
Clear the if none matches
inherited
clearLocationPath() → void
Clear location path
inherited
clearLocationQuery() → void
Clear location queries
inherited
clearOptions() → void
Clear all options
inherited
clearUriPath() → void
Clear URI paths
inherited
clearUriQuery() → void
Clear URI queries
inherited
containsETagOpaque(Uint8Buffer opaque) bool
Contains an opaque E-tag
inherited
copyEventHandler(CoapMessage msg) → void
Copy an event handler
inherited
fireRetransmitting() → void
Fire retransmitting event
inherited
getAllOptions() List<CoapOption>
Gets a list of all options.
inherited
getFirstOption(OptionType optionType) CoapOption?
Returns the first option of the specified type, or null
inherited
getOptions(OptionType optionType) List<CoapOption>?
Gets all options of the given type.
inherited
hasOption(OptionType type) bool
Checks if this CoAP message has options of the specified option type. Returns true if options of the specified type exists.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeEtag(CoapOption option) bool
Remove an ETag, true indicates success
inherited
removeETagOpaque(Uint8Buffer opaque) → void
Remove an opaque ETag
inherited
removeIfMatch(CoapOption option) → void
Remove an if match option
inherited
removeIfMatchOpaque(Uint8Buffer opaque) → void
Remove an opaque if match
inherited
removeIfNoneMatch(CoapOption option) → void
Remove an if none match option
inherited
removeIfNoneMatchOpaque(Uint8Buffer opaque) → void
Remove an opaque if none match
inherited
removelocationPath(String path) → void
Remove a location path
inherited
removeLocationQuery(String query) → void
Remove a location query
inherited
removeOption(CoapOption option) bool
Remove a specific option, returns true if the option has been removed.
inherited
removeOptions(OptionType optionType) → void
Removes all options of the given type from this CoAP message.
inherited
removeUriPath(String path) → void
Remove a URI path
inherited
removeUriQuery(String query) → void
Remove a URI query
inherited
setBlock1(int szx, int num, {required bool m}) → void
Block 1
inherited
setBlock2(int szx, int num, {required bool m}) → void
Block 2
inherited
setOption(CoapOption opt) → void
Sets an option, removing all others of the option type
inherited
setOptions(Iterable<CoapOption> options) → void
Sets all options with the specified option type, removing all others of the same type.
inherited
setPayload(String payload) → void
Sets the payload.
inherited
setPayloadMedia(String payload, [CoapMediaType? mediaType]) → void
Sets the payload and media type of this CoAP message.
inherited
setPayloadMediaRaw(Uint8Buffer payload, [CoapMediaType? mediaType]) → void
Sets the payload of this CoAP message.
inherited
toString() String
A string representation of this object.

Operators

operator ==(Object other) bool
The equality operator.
inherited