The emNet Constrained Application Protocol (CoAP) client/server is an optional extension which adds CoAP support to the stack. It combines a maximum of performance with a small memory footprint.
The CoAP server allows an embedded system to handle CoAP requests from a CoAP client. The CoAP client allows an embedded system to send request to a CoAP server.
The CoAP client/server implements the relevant parts of the following Request For Comments (RFC).
|[RFC 7252]||The Constrained Application Protocol (CoAP) |
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc7252.txt
|[RFC 6690]||Constrained RESTful Environments (CoRE) Link Format|
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc6690.txt
|[RFC 7641]||Observing Resources in the Constrained Application Protocol (CoAP) |
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc7641.txt
|[RFC 7959]||Block-Wise Transfers in the Constrained Application Protocol (CoAP)|
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc7959.txt
The following table shows the contents of the emNet CoAP root directory:
|Application||Contains the example application to run the CoAP client/server with emNet.|
|Config||Contains the CoAP configuration file. Refer to the documentation for detailed information.|
|Inc||Contains the required include files.|
|IP||Contains the CoAP sources and header files.|
|Windows\IP\CoAP_Server||Contains the source, the project files and an executable to run the emNet CoAP server example on a Microsoft Windows host.|
|Windows\IP\CoAP_Client||Contains the source, the project files and an executable to run the emNet CoAP client on a Microsoft Windows host.|
The emNet CoAP client/server requires a UDP/IP stack. It is optimized for emNet, but any RFC-compliant UDP/IP stack can be used. The shipment includes a Win32 simulation, which uses the standard Winsock API and an implementation which uses the socket API of emNet.
The client/server does not require any multi-tasking environment to run. But the various CoAP APIs are not thread safe and should be protected accordingly if used in different threads.
The Constrained Application Protocol (CoAP) is an Internet of Things (IoT) protocol which allows machine to machine (M2M) communication with small footprint applications. It uses Uniform Resource Identifier (URI) to identify resources on the server. With its small and simple 4 bytes header, it's ideal for devices with limited resources.
The CoAP protocol implements a RESTful client-server based on four methods:
- GET: The GET method retrieves a representation for the information that currently corresponds to the resource identified by the request URI.
- PUT: The PUT method requests that the resource identified by the request URI be updated with the enclosed representation.
- POST: The POST method requests that the representation enclosed in the request be processed to create a new resource or update an existing one.
- DELETE: The DELETE method requests that the resource identified by the request URI be deleted.
The CoAP protocol is based on UDP (or DTLS for the secured version) and thus has to deal with potential message loss and repetition. It is a simple message exchange between endpoints. It relies on confirmable (CON) or non-confirmable (NON) messages.
The emNet CoAP server implementation can not be used as a proxy. But the client can send requests to a CoAP proxy.
Block transfer option
The emNet CoAP client/server supports the block transfer option. This option allows to transfer big amounts of data cut into smaller chunks. This is especially useful when the network MTU is relatively small or when the system implementing the CoAP client/server has strong constrains on memory usage.
The emNet CoAP client/server supports the observe option. With this option, a client does not have to poll a server periodically to monitor the state of a resource. It can instead register to the resource and be automatically notified by the server when the resource changes.
The ROM usage depends on the compiler options, the compiler version and the used CPU. The memory requirements of the CoAP client/server presented in the tables below have been measured on a Cortex-M4 system with the default configuration.
|emNet CoAP client||Approximately 6.5 KByte|
|emNet CoAP server||Approximately 9.2 KByte|