|
SatCat5
|
CoAP resource handler definition and resource server creation.
The coap::Resource base class is derived to create different types of handlers for CoAP GET, POST, PUT, and DELETE requests registered to respond to a given URI specified by one or more Uri-Path CoAP request options. Each Resource is registered to a URI that MUST be unique and should not contain any leading or trailing slashes. Two examples are included: coap::ResourceEcho responds to any GET request with a copy of its payload and coap::ResourceLog will create a Log entry from the payload of any incoming POST request.
One or more Resources can be added to a coap::ResourceServer class, which acts as a CoAP server to route requests to the correct coap::Resource according to the Uri-Path option. While not recommended, a Resource can be registered to the server root and therefore accessible without any Uri-Path options by declaring the path string to be "".
There are a few important notes to keep in mind when declaring URIs:
SATCAT5_COAP_MAX_URI_PATH_LEN) that MUST NOT be violated in the given Uri-Path, else the Resource can never be matched. Definition in file coap_resource.h.
Go to the source code of this file.
Classes | |
| class | satcat5::coap::Resource |
| Define a single CoAP resource. More... | |
| class | satcat5::coap::ResourceEcho |
| Resource that echos back any incoming payload. More... | |
| class | satcat5::coap::ResourceError |
| Resource that returns a fixed status code for all requests. More... | |
| class | satcat5::coap::ResourceLog |
| Resource that creates a log::Log entry. More... | |
| class | satcat5::coap::ResourceNull |
| The NullResource does not implement GET, POST, PUT, or DELETE. More... | |
| class | satcat5::coap::ResourceServer |
| Manager for several Resource objects available on an Endpoint. More... | |