CoapRequest class

This class describes the functionality of a CoAP Request as a subclass of a CoAP Message. It provides:

  1. operations to answer a request by a response using respond()
  2. different ways to handle incoming responses: receiveResponse() or Response event.

Constructors

CoapRequest(CoapCode code, {bool confirmable = true})
Initializes a request message. Defaults to confirmable
CoapRequest.fromParsed({required CoapCode coapCode, required CoapMessageType type, required int id, required Uint8Buffer token, required List<Option<Object?>> options, required Uint8Buffer? payload, required bool hasUnknownCriticalOption, required bool hasFormatError})
CoapRequest.newDelete({bool confirmable = true})
Construct a DELETE request.
factory
CoapRequest.newFetch({bool confirmable = true})
Construct a FETCH request.
factory
CoapRequest.newGet({bool confirmable = true})
Construct a GET request.
factory
CoapRequest.newIPatch({bool confirmable = true})
Construct a iPATCH request.
factory
CoapRequest.newPatch({bool confirmable = true})
Construct a PATCH request.
factory
CoapRequest.newPost({bool confirmable = true})
Construct a POST request.
factory
CoapRequest.newPut({bool confirmable = true})
Construct a PUT request.
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
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
endpoint ↔ Endpoint?
The endpoint for this request
getter/setter pair
etags List<ETagOption>
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 this CoapMessage 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
isMulticast bool
Indicates whether this request is a multicast request or not.
no setter
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
isTimedOut bool
Indicates whether this message has been timed out.
getter/setter pairinherited
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
method CoapCode
The request method(code)
no setter
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
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
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-setter
uri Uri
The URI of this CoAP message.
getter/setter pair
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<Object?>> 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
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<Object?>> 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.
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