class QCoapOption

The QCoapOption class holds data about CoAP options. More

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

CoAP defines a number of options that can be included in a message. Both requests and responses may include a list of one or more options. For example, the URI in a request is transported in several options, and metadata that would be carried in an HTTP header in HTTP is supplied as options as well.

An option contains a name, related to an option ID, and a value. The name is one of the values from the OptionName enumeration.

class OptionName

Indicates the name of an option. The value of each ID is as specified by the CoAP standard, with the exception of Invalid. You can refer to RFC 7252 and RFC 7959 for more details.

Constant

Description

QCoapOption.Invalid

An invalid option.

QCoapOption.IfMatch

If-Match option.

QCoapOption.UriHost

Uri-Host option.

QCoapOption.Etag

Etag option.

QCoapOption.IfNoneMatch

If-None-Match option.

QCoapOption.Observe

Observe option.

QCoapOption.UriPort

Uri-Port option.

QCoapOption.LocationPath

Location-path option.

QCoapOption.UriPath

Uri-Path option.

QCoapOption.ContentFormat

Content-Format option.

QCoapOption.MaxAge

Max-Age option.

QCoapOption.UriQuery

Uri-Query option.

QCoapOption.Accept

Accept option.

QCoapOption.LocationQuery

Location-Query option.

QCoapOption.Block2

Block2 option.

QCoapOption.Block1

Block1 option.

QCoapOption.Size2

Size2 option.

QCoapOption.ProxyUri

Proxy-Uri option.

QCoapOption.ProxyScheme

Proxy-Scheme option.

QCoapOption.Size1

Size1 option.

__init__(other)
Parameters:

otherQCoapOption

Constructs a new CoAP option as a copy of other, making the two options identical.

See also

isValid()

__init__([name=QCoapOption.OptionName.Invalid[, opaqueValue=QByteArray()]])
Parameters:

Constructs a new CoAP option with the given name and QByteArray opaqueValue. If no parameters are passed, constructs an Invalid object.

See also

isValid()

__init__(name, stringValue)
Parameters:

Constructs a new CoAP option with the given name and the QString stringValue.

See also

isValid()

__init__(name, intValue)
Parameters:

Constructs a new CoAP option with the given name and the unsigned integer intValue.

See also

isValid()

isValid()
Return type:

bool

Returns true if the option is valid.

length()
Return type:

int

Returns the length of the value of the option.

name()
Return type:

OptionName

Returns the name of the option.

opaqueValue()
Return type:

QByteArray

Returns the value of the option.

__ne__(other)
Parameters:

otherQCoapOption

Return type:

bool

Returns true if this QCoapOption and other are different.

__eq__(other)
Parameters:

otherQCoapOption

Return type:

bool

Returns true if this QCoapOption and other are equals.

stringValue()
Return type:

str

Returns the QString value of the option.

swap(other)
Parameters:

otherQCoapOption

Swaps this option with other. This operation is very fast and never fails.

uintValue()
Return type:

int

Returns the integer value of the option.