IPWorks IoT 2020 macOS Edition

Questions / Feedback?

CoAPOption Type

A CoAP option.

Remarks

This type represents a CoAP option.

Fields

critical
Bool

Whether the option is critical.

This property reflects whether the option is critical or elective. Receivers that do not recognize a critical option must return a 4.02 "Bad Option" response code back to the sender. Unrecognized elective options can be safely ignored.

noCacheKey
Bool

Whether the option is to be excluded from the cache-key.

This property reflects whether the option should be excluded from any cache-key calculations. This information is generally only needed for caching and proxying.

number
Int32

The option's number.

The property reflects the option's number, which must be a value in the range 0 to 65535 (inclusive). Setting this property to a recognized option number (see table below) will automatically set the ValueType property to the correct value (it should be set manually otherwise).

The following table provides a (non-exhaustive) list of some of the more common option numbers; refer to the IANA's CoAP Option Numbers registry for a full list.

Number Option
1 If-Match
3 Uri-Host
4 ETag
5 If-None-Match
6 Observe
7 Uri-Port
8 Location-Path
11 Uri-Path
12 Content-Format
14 Max-Age
15 Uri-Query
17 Accept
20 Location-Query
23 Block2
27 Block1
35 Proxy-Uri
39 Proxy-Scheme
60 Size1

unsafe
Bool

Whether the option is unsafe to forward.

This property reflects whether the option is unsafe to forward. This information is generally only needed for proxying.

value
String

The option's value.

This property specifies the option's value. The ValueType property specifies the data type of the value.

valueType
CoAPOptionValueTypes

The option's value data type.

This property specifies the data type of the option's Value. If Number is set to a recognized value (refer to the table in its documentation), this property will automatically be set to the correct value. The table below shows the possible value types, their descriptions, and how to format the data assigned to Value.

Type Description Value Format
ovtString (0) (default) String String
ovtUInt (1) Unsigned integer 0 to 4294967295
ovtBinary (2) Binary data Hex-encoded byte string

Constructors

public init()
public init(number: Int32, value: String)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 macOS Edition - Version 20.0 [Build 8265]