Skip to content

Message

Jim Schaad edited this page Jun 26, 2017 · 2 revisions

Generic message class

Properties

Accept - Return the first Accept option if one exists. Set adds the value as an option unless the value is MediaType.Unknown which removes all Accept options

AckTimeout - Time in milliseconds after which the message times out. A value of 0 indicates that the configuration value will be used. A negative value never times out.

Block1 - Set/Get the Block1 option

Block2 - Set/Get the Block2 option

Bytes - A serialized version of the message if it has been serialized out. Otherwise returns null.

Code - The message code for the message.

CodeString - Return the message code in a friendly text format.

ContentFormat - Synonym for ContentType

ContentType - Get/Set the Content-Type option

Destination - endpoint for the message destination

Duplicate - Is this message a duplicate?

ETags - Return an enumeration of all ETags on the message.

ID - The ID of the CoAP message.

IfMatches - returns all ETags for IfMatch options in message.

IfNoneMatch - Get - Does the message have an IfNoneMatch option. Set - Set or clear IfNoneMatch option to value.

IsAcknowledged - Has the message been acknowledged yet?

IsCancelled - Has the message been canceled?

IsRejected - Has the message been rejected?

IsRequest - Is this a Request message?

IsResponse - Is this a Response message?

IsTimedOut - Has the message timed out yet?

Location - Combine the Location and Location query options as a string.

LocationPath - Return set location options in a message

LocationPaths - Return enumerator of all LocationPath options.

LocationQuery - Return all Location-Query options as a string

LocationQueries - Return enumerator of all Location-Query options.

MaxAge - Get/Set the Max-Age option of the message. If a Max-Age option does not exist, then the value from the default configuration is returned.

MaxRetransmit - The number of times a message should be retransmitted if it is not acknowledged. A negative value means that no retransmissions are done. A value of zero uses the default value from the configuration.

Observe - Get/Set the Observe option value

Oscoap - Get/Set the OSCOAP option value.

Payload - The payload value for the message as a byte array

PayloadSize - return the size of the payload

PayoadString - The payload value as a UTF8 text string.

ProxyURL - Get/Set the ProxyURL option on the message.

ProxySchema - Get/Set the Proxy-Schema option on the message

Size1 - Gets/Sets the Size1 option value

Size2 - Gets/Sets the Size2 option value

Source - endpoint for the message source

Timestamp - The time when the message was sent or received. The value DateTime.MinValue is returned if the message has not been sent or received.

Token - Token for the CoAP message

TokenString - Return the message token value as a string.

Type - Message type - i.e is this a CON, NON, etc. If the type is not set, then it will be inferred from context and configuration.

UriHost - The UriHost option value

UriPath - Get/Set the UriPath option values. Value is a slash separated string

UriPaths - Get an enumeration of the UriPath option strings.

UriPort - Get/Set the UriPort option in the message.

UriQuery - Get/Set all UriQuery options in the message.

UriQuerys - Get an enumeration the UriQuery options.

Actions

Acknowledge - List of event handlers to fire when an ACK is returned on a message.

Cancelled - List of event handler to fire when a message has been canceled.

Rejected - List of event handlers to fire when a message is rejected.

Retransmitting - List of event handlers to fire before doing a retransmission.

TimeOut - List of event handlers to fire when a message times out without receiving a response.

Methods

AddETag - Add an ETag option to the message.

AddIfMatch - Add an If-Match option to the message.

AddLocationPath - Add a LocationPath option to the message

AddLocationQuery - Add a Location-Query option to the message

AddOption - Add an option to the message.

AddOptions - Given an enumeration of options, add all of them to the message.

AddUriPath - Add additional URI path option to the message.

AddUriQuery - Add one URI query option to the message

Cancel - Cancel the message

ContainsETag - Does the message contain an ETag as an option?

ClearETags - Remove all ETag options from the message

ClearIfMatches() - Remove all If-Match options from the message

ClearLocationPath - Clear all Location-Path options from the message

ClearLocationQuery - Remove all Location-Query options from the message

ClearUriPath - Remove all UriPath options from the message

ClearUriQuery - Remove all UriQuery options from the message

GetFirstOption - Return the first option that matches the given option type.

GetOptions - Return an enumeration of all options of the given type.

HasOption - Check to see if an option of the given type exists on the message.

IsIfMatch - Given an ETag, return true if it is in the list of ETag values associated with an IfMatch option in the message. If there are no IfMatch options then return true.

RemoveIfMatch - Remove an If-Match option from the message if it is present.

RemoveLocationPath - Remove a Location-Path option from the message if it is present.

RemoveLocationQuery - Remove a Location-Query option from the message if it is present.

RemoveOptions - Remove all options of a given type from the message

RemoveUriPath - Remove a specified UriPath element if present

RemoveUriQuery - Remove a specified Uri Query element if present

SetBlock1 - Create a Block1 option and add it to the message

SetBlock2 - Create a Block2 option and add it to the message

SetOption - Set the option on the message after removing all other options of that option type.

SetOptions - Given an enumeration of options - Remove every option that matches the an option type in the enumeration, then add all of the options to the message.

SetPayload - Set the payload of the message.

Clone this wiki locally