Skip to content

Commit

Permalink
tests/riotboot_flashwrite: make use of nanocoap_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Feb 12, 2024
1 parent 67411db commit 2dd6a65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/riotboot_flashwrite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ USEMODULE += gnrc_icmpv6_echo

# Required for nanocoap server
USEMODULE += nanocoap_sock
USEMODULE += nanocoap_resources

# include this for printing IP addresses
USEMODULE += shell_cmds_default
Expand Down
11 changes: 5 additions & 6 deletions tests/riotboot_flashwrite/coap_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ ssize_t _flashwrite_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_requ
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,
{ "/flashwrite", COAP_POST, _flashwrite_handler, &_writer },
NANOCOAP_RESOURCE(flashwrite) {
.path = "/flashwrite",
.methods = COAP_POST,
.handler = _flashwrite_handler,
.context = &_writer
};

const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources);

0 comments on commit 2dd6a65

Please sign in to comment.