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
-
CoapResponse.fromParsed({required CoapCode coapCode, required CoapMessageType type, required int id, required Uint8Buffer token, required List<
Option< options, required Uint8Buffer? payload, required bool hasUnknownCriticalOption, required bool hasFormatError})Object?> >
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
- 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
no setterinherited
- eventBus ↔ CoapEventBus?
-
getter/setter pairinherited
- hasFormatError ↔ bool
-
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<
IfMatchOption> -
If-Matches.
no setterinherited
-
ifNoneMatches
→ List<
IfNoneMatchOption> -
If-None Matches.
no setterinherited
- isAcknowledged ↔ bool
-
Indicates whether this message has been acknowledged.
getter/setter pairinherited
- isActive → bool
-
Returns
true
if thisCoapMessage
has neither timed out nor has been canceled.no setterinherited - 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<
LocationPathOption> -
Location paths
no setterinherited
-
locationQueries
→ List<
LocationQueryOption> -
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
- needsRejection → bool
-
no setterinherited
- observe ↔ int?
-
Observe
getter/setter pairinherited
- optionsLength → int
-
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
- 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<
UriPathOption> -
URI paths
no setterinherited
- uriPort ↔ int
-
Uri port
getter/setter pairinherited
-
uriQueries
→ List<
UriQueryOption> -
URI queries
no setterinherited
- uriQuery ↔ String
-
URI query
getter/setter pairinherited
Methods
-
addEtag(
ETagOption 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
inherited
-
addIfMatchOpaque(
Uint8Buffer opaque) → void -
Add an opaque if match
inherited
-
addLocationPath(
String path) → void -
Add a location path
inherited
-
addLocationQuery(
String query) → void -
Add a location query
inherited
-
addOption(
Option< Object?> option) → void -
Adds an option to the list of options of this
CoapMessage
.inherited -
addOptions(
Iterable< Option< options) → voidObject?> > -
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
-
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< Option< Object?> > -
Gets a list of all options.
inherited
-
getFirstOption<
T extends Option< (Object?> >) → T? -
Returns the first option of the specified type, or null
inherited
-
getOptions<
T extends Option< (Object?> >) → List< T> -
Gets all options of the given type.
inherited
-
hasOption<
T extends Option< (Object?> >) → 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(
ETagOption option) → bool -
Remove an ETag, true indicates success
inherited
-
removeETagOpaque(
Uint8Buffer opaque) → void -
Remove an opaque ETag
inherited
-
removeIfMatch(
IfMatchOption option) → void -
Remove an if match option
inherited
-
removeIfMatchOpaque(
Uint8Buffer opaque) → void -
Remove an opaque if match
inherited
-
removeIfNoneMatch(
IfNoneMatchOption option) → void -
Remove an if none match option
inherited
-
removelocationPath(
String path) → void -
Remove a location path
inherited
-
removeLocationQuery(
String query) → void -
Remove a location query
inherited
-
removeOption(
Option< Object?> option) → bool -
Remove a specific option, returns true if the option has been removed.
inherited
-
removeOptions<
T extends Option< (Object?> >) → 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(
BlockSize szx, int num, {required bool m}) → void -
Block 1
inherited
-
setBlock2(
BlockSize szx, int num, {required bool m}) → void -
Block 2
inherited
-
setOption<
T extends Option< (Object?> >T option) → void -
Sets an option, removing all others of the option type
inherited
-
setOptions(
Iterable< Option< options) → voidObject?> > -
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.
-
toTcpPayload(
) → Uint8Buffer -
Serializes this CoAP message into the TCP message format.
inherited
-
toUdpPayload(
) → Uint8Buffer -
Serializes this CoAP message into the UDP message format.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited