Digi International Inc XB3C1 Manuel D’Utilisation

Page de 146
Getting started with the XBee Smart Modem Development Kit
Get started with CoAP
Digi XBee3 Cellular LTE Cat 1 Smart Modem User Guide
39
Get started with CoAP
Constrained Application Protocol (CoAP) is based on UDP connection and consumes low power to
deliver similar functionality to HTTP. This guide contains information about sending GET, POST, PUT
and DELETE operations by using the Coap Protocol with XCTU and Python code working with the XBee
Smart Modem and Coapthon library (Python 2.7 only).
The Internet Engineering Task Force describes CoAP as:
The protocol is designed for machine-to-machine (M2M) applications such as smart energy and
building automation. CoAP provides a request/response interaction model between application
endpoints, supports built-in discovery of services and resources, and includes key concepts of
the Web such as URIs and Internet media types. CoAP is designed to easily interface with HTTP
for integration with the Web while meeting specialized requirements such as multicast
support, very low overhead, and simplicity for constrained environments (
).
CoAP terms
When describing CoAP, we use the following terms:
Term
Meaning
Method
COAP's method action is similar to the HTTP method. This guide discusses the GET,
POST, PUT and DELETE methods. With these methods, the XBee Smart Modem can
transport data and requests.
URI
URI is a string of characters that identifies a resource served at the server.
Token
A token is an identifier of a message. The client uses the token to verify if the received
message is the correct response to its query.
Payload
The message payload is associated with the POST and PUT methods. It specifies the
data to be posted or put to the URI resource
Message ID The message ID is also an identifier of a message. The client matches the message ID
between the response and query.
CoAP quick start example
The following diagram shows the message format for the CoAP protocol; see
for
details:
This is an example GET request:
44 01 C4 09 74 65 73 74 B7 65 78 61 6D 70 6C 65