CoapRequest class
This class describes the functionality of a CoAP Request as a subclass of a CoAP Message. It provides:
- operations to answer a request by a response using respond()
- 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.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
- 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
- endpoint ↔ CoapIEndPoint?
-
The endpoint for this request
getter/setter pair
-
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
- 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<
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
- method → CoapCode
-
The request method(code)
no setter
- 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
- 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<
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