aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-04-17 14:57:58 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-04-25 14:54:21 +0000
commit17e8aeede0a04668b1c0cae654480950d96cd79f (patch)
tree4d47cd79be3c0ab01a8c3890770dd12af85b9747
parente2faedb48d9bbfde275bec22aebb5c1ded430e2c (diff)
Mention CBOR when documenting CoAP's content formats
Change-Id: Ifb15180619c1d7e056a5578c30d22e2e9e16edd5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/coap/doc/src/external-resources.qdoc5
-rw-r--r--src/coap/qcoapmessage.cpp10
-rw-r--r--src/coap/qcoapresource.cpp10
3 files changed, 21 insertions, 4 deletions
diff --git a/src/coap/doc/src/external-resources.qdoc b/src/coap/doc/src/external-resources.qdoc
index 8cbbf9f..f018c94 100644
--- a/src/coap/doc/src/external-resources.qdoc
+++ b/src/coap/doc/src/external-resources.qdoc
@@ -59,3 +59,8 @@
\externalpage https://tools.ietf.org/html/rfc7252#section-4.2
\title RFC 7252 - Section 4.2
*/
+
+/*!
+ \externalpage https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats
+ \title CoAP Content-Formats Registry
+*/
diff --git a/src/coap/qcoapmessage.cpp b/src/coap/qcoapmessage.cpp
index 49e8030..d07611c 100644
--- a/src/coap/qcoapmessage.cpp
+++ b/src/coap/qcoapmessage.cpp
@@ -371,9 +371,15 @@ void QCoapMessage::setMessageId(quint16 id)
}
/*!
- Sets the message payload to \a payload.
+ Sets the message payload to \a payload. The payload can be represented in
+ one of the content formats defined in \l {CoAP Content-Formats Registry}.
- \sa payload()
+ \note 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.
+
+ \sa payload(), QCborStreamWriter, QCborStreamReader
*/
void QCoapMessage::setPayload(const QByteArray &payload)
{
diff --git a/src/coap/qcoapresource.cpp b/src/coap/qcoapresource.cpp
index c24950e..7e20209 100644
--- a/src/coap/qcoapresource.cpp
+++ b/src/coap/qcoapresource.cpp
@@ -255,9 +255,15 @@ void QCoapResource::setMaximumSize(int maximumSize)
}
/*!
- Sets the content format of the resource to \a contentFormat.
+ Sets the content format of the resource to \a contentFormat. The content
+ format can be one of the content formats defined in \l {CoAP Content-Formats Registry}.
- \sa contentFormat()
+ \note 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.
+
+ \sa contentFormat(), QCborStreamWriter, QCborStreamReader
*/
void QCoapResource::setContentFormat(uint contentFormat)
{