RIOT: Code tidy following review

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2026-07-21 12:30:28 +01:00
1 parent 09e91a2e5c
commit 0befa05f48
12 files changed
+55 -46

No files matched your search

@@ -6,17 +6,23 @@ This example shows how to configure a server to use libcoap
Preparing the logical interfaces:
sudo ./../../dist/tools/tapsetup/tapsetup --create 2
```shell
sudo ./../../dist/tools/tapsetup/tapsetup --create 2
```
## Server invocation
For the server:
PORT=tap0 make term
coaps {stop|start}
```shell
PORT=tap0 make term
coaps {stop|start}
```
The server supports requests for
coap://[ip]/time?ticks
coap://[ip]/.well-known/core
```shell
coap://[ip]/time?ticks
coap://[ip]/.well-known/core
```
## Handling the static memory allocation
@@ -3,6 +3,7 @@ CONFIG_LIBCOAP_SERVER_SUPPORT=y
CONFIG_LIBCOAP_USE_PSK="secretPSK"
# Logging levels are defined in pkg/libcoap using Kconfig
CONFIG_LIBCOAP_LOG_INFO=y
CONFIG_DTLS_PEER_MAX=2
CONFIG_DTLS_HANDSHAKE_MAX=2
@@ -98,26 +98,13 @@ static void init_coap_resources(coap_context_t *ctx)
coap_resource_set_get_observable(r, 1);
time_resource = r;
coap_register_handler(r, COAP_REQUEST_GET, hnd_get_time);
#if 0
coap_register_handler(r, COAP_REQUEST_PUT, hnd_put_time);
coap_register_handler(r, COAP_REQUEST_DELETE, hnd_delete_time);
#endif
coap_add_attr(r, coap_make_str_const("ct"), coap_make_str_const("0"), 0);
/* coap_add_attr(r, coap_make_str_const("title"),
coap_make_str_const("\"Internal Clock\""), 0); */
coap_add_attr(r, coap_make_str_const("title"),
coap_make_str_const("\"Internal Clock\""), 0);
coap_add_attr(r, coap_make_str_const("rt"), coap_make_str_const("\"ticks\""), 0);
coap_add_attr(r, coap_make_str_const("if"), coap_make_str_const("\"clock\""), 0);
coap_add_resource(ctx, r);
#if 0
if (coap_async_is_supported()) {
r = coap_resource_init(coap_make_str_const("async"), 0);
coap_register_handler(r, COAP_REQUEST_GET, hnd_get_async);
coap_add_attr(r, coap_make_str_const("ct"), coap_make_str_const("0"), 0);
coap_add_resource(ctx, r);
}
#endif
return;
error: