mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
examples/nanocoap_server: define CoAP resources as XFA
This commit is contained in:
parent
e45508dab4
commit
13aa272616
@ -18,6 +18,7 @@ USEMODULE += sock_udp
|
||||
USEMODULE += gnrc_icmpv6_echo
|
||||
|
||||
USEMODULE += nanocoap_sock
|
||||
USEMODULE += nanocoap_server
|
||||
|
||||
USEMODULE += xtimer
|
||||
|
||||
|
@ -166,14 +166,18 @@ ssize_t _sha256_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_request_
|
||||
return pkt_pos - (uint8_t*)pkt->hdr;
|
||||
}
|
||||
|
||||
/* must be sorted by path (ASCII order) */
|
||||
const coap_resource_t coap_resources[] = {
|
||||
COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER,
|
||||
{ "/echo/", COAP_GET | COAP_MATCH_SUBTREE, _echo_handler, NULL },
|
||||
{ "/riot/board", COAP_GET, _riot_board_handler, NULL },
|
||||
{ "/riot/value", COAP_GET | COAP_PUT | COAP_POST, _riot_value_handler, NULL },
|
||||
{ "/riot/ver", COAP_GET, _riot_block2_handler, NULL },
|
||||
{ "/sha256", COAP_POST, _sha256_handler, NULL },
|
||||
NANOCOAP_RESOURCE(echo) {
|
||||
.path = "/echo/", .methods = COAP_GET | COAP_MATCH_SUBTREE, .handler = _echo_handler
|
||||
};
|
||||
NANOCOAP_RESOURCE(board) {
|
||||
.path = "/riot/board", .methods = COAP_GET, .handler = _riot_board_handler
|
||||
};
|
||||
NANOCOAP_RESOURCE(value) {
|
||||
.path = "/riot/value", .methods = COAP_GET | COAP_PUT | COAP_POST, .handler = _riot_value_handler
|
||||
};
|
||||
NANOCOAP_RESOURCE(ver) {
|
||||
.path = "/riot/ver", .methods = COAP_GET, .handler = _riot_block2_handler
|
||||
};
|
||||
NANOCOAP_RESOURCE(sha256) {
|
||||
.path = "/sha256", .methods = COAP_POST, .handler = _sha256_handler
|
||||
};
|
||||
|
||||
const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources);
|
||||
|
Loading…
Reference in New Issue
Block a user