IPWorks IoT 2020 Android Edition

Questions / Feedback?

CoAPOption Type

A CoAP option.

Remarks

This type represents a CoAP option.

Fields

Critical
boolean

Whether the option is critical.

This field 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
boolean

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

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

Number
int

The option's number.

The field reflects the option's number, which must be a value in the range 0 to 65535 (inclusive). Setting this field to a recognized option number (see table below) will automatically set the ValueType field 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
boolean

Whether the option is unsafe to forward.

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

Value
String

The option's value.

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

ValueType
int

The option's value data type.

This field 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 field 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 CoAPOption();



public CoAPOption(int number, String value);



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