- class QCoapOption¶
The
QCoapOption
class holds data about CoAP options. More…Synopsis¶
Methods¶
def
__init__()
def
isValid()
def
length()
def
name()
def
opaqueValue()
def
__ne__()
def
__eq__()
def
stringValue()
def
swap()
def
uintValue()
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:
other –
QCoapOption
Constructs a new CoAP option as a copy of
other
, making the two options identical.See also
- __init__([name=QCoapOption.OptionName.Invalid[, opaqueValue=QByteArray()]])
- Parameters:
name –
OptionName
opaqueValue –
QByteArray
Constructs a new CoAP option with the given
name
and QByteArrayopaqueValue
. If no parameters are passed, constructs an Invalid object.See also
- __init__(name, stringValue)
- Parameters:
name –
OptionName
stringValue – str
Constructs a new CoAP option with the given
name
and the QStringstringValue
.See also
- __init__(name, intValue)
- Parameters:
name –
OptionName
intValue – int
Constructs a new CoAP option with the given
name
and the unsigned integerintValue
.See also
- 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:
Returns the name of the option.
- opaqueValue()¶
- Return type:
Returns the value of the option.
- __ne__(other)¶
- Parameters:
other –
QCoapOption
- Return type:
bool
Returns
true
if thisQCoapOption
andother
are different.- __eq__(other)¶
- Parameters:
other –
QCoapOption
- Return type:
bool
Returns
true
if thisQCoapOption
andother
are equals.- stringValue()¶
- Return type:
str
Returns the QString value of the option.
- swap(other)¶
- Parameters:
other –
QCoapOption
Swaps this option with
other
. This operation is very fast and never fails.- uintValue()¶
- Return type:
int
Returns the integer value of the option.