QCoapResource Class

The QCoapResource class holds information about a discovered resource. 更多...

头: #include <QCoapResource>
qmake: QT += coap

注意: 此类的所有函数 可重入 .

公共函数

  QCoapResource (const QCoapResource & other )
  QCoapResource ()
QCoapResource & operator= (const QCoapResource & other )
  ~QCoapResource ()
uint contentFormat () const
QHostAddress host () const
QString interface () const
int maximumSize () const
bool observable () const
QString path () const
QString resourceType () const
void setContentFormat (uint contentFormat )
void setHost (const QHostAddress & host )
void setInterface (const QString & interface )
void setMaximumSize (int maximumSize )
void setObservable (bool observable )
void setPath (const QString & path )
void setResourceType (const QString & resourceType )
void setTitle (const QString & title )
void swap (QCoapResource & other )
QString title () const

详细描述

QCoapRequest contains data as the path and title of the resource and other ancillary information.

另请参阅 QCoapResourceDiscoveryReply .

成员函数文档编制

QCoapResource:: QCoapResource (const QCoapResource & other )

Constructs a new CoAP resource as a copy of other , making the two resources identical.

QCoapResource:: QCoapResource ()

Constructs a new QCoapResource.

QCoapResource &QCoapResource:: operator= (const QCoapResource & other )

拷贝 other into this resource, making the two resources identical. Returns a reference to this QCoapResource .

QCoapResource:: ~QCoapResource ()

Destroy the QCoapResource .

uint QCoapResource:: contentFormat () const

Returns the Content-Format code of the resource.

The Content-Format code corresponds to the 'ct' attribute and provides a hint about the Content-Formats this resource returns. It is specified in RFC 7252 .

另请参阅 setContentFormat ().

QHostAddress QCoapResource:: host () const

Returns the host of the resource.

另请参阅 setHost ().

QString QCoapResource:: interface () const

Returns the interface description of the resource.

The Interface Description 'if' attribute is an opaque string used to provide a name or URI indicating a specific interface definition used to interact with the target resource. It is specified in RFC 6690 .

另请参阅 setInterface ().

int QCoapResource:: maximumSize () const

Returns the maximum size of the resource.

The maximum size estimate attribute 'sz' gives an indication of the maximum size of the resource representation returned by performing a GET on the target URI. It is specified in RFC 6690 .

另请参阅 setMaximumSize ().

bool QCoapResource:: observable () const

返回 true if the resource is observable

另请参阅 setObservable ().

QString QCoapResource:: path () const

Returns the path of the resource.

另请参阅 setPath ().

QString QCoapResource:: resourceType () const

Returns the type of the resource.

另请参阅 setResourceType ().

void QCoapResource:: setContentFormat ( uint contentFormat )

Sets the content format of the resource to contentFormat . The content format can be one of the content formats defined in CoAP Content-Formats Registry .

注意: CoAP supports common content formats such as XML, JSON, and so on, but these are text based and consequently heavy both in payload and in processing. One of the recommended content formats to use with CoAP is CBOR, which is designed to be used in such contexts.

另请参阅 contentFormat (), QCborStreamWriter ,和 QCborStreamReader .

void QCoapResource:: setHost (const QHostAddress & host )

Sets the host of the resource to host .

另请参阅 host ().

void QCoapResource:: setInterface (const QString & interface )

Sets the interface of the resource to interface .

另请参阅 interface ().

void QCoapResource:: setMaximumSize ( int maximumSize )

Sets the maximum size of the resource to maximumSize .

另请参阅 maximumSize ().

void QCoapResource:: setObservable ( bool observable )

Makes the resource observable if the observable parameter is true .

另请参阅 observable ().

void QCoapResource:: setPath (const QString & path )

Sets the path of the resource to path .

另请参阅 path ().

void QCoapResource:: setResourceType (const QString & resourceType )

Sets the resource type to resourceType .

另请参阅 resourceType ().

void QCoapResource:: setTitle (const QString & title )

Sets the title of the resource to title .

另请参阅 title ().

void QCoapResource:: swap ( QCoapResource & other )

Swaps this resource with other 。此操作非常快且从不失败。

QString QCoapResource:: title () const

Returns the title of the resource.

另请参阅 setTitle ().