Merge pull request #9919 from kb2ma/nanocoap/example_resource_order

nanocoap/example: fix resource order
This commit is contained in:
Koen Zandberg 2018-09-13 16:05:07 +02:00 committed by GitHub
commit 334f828599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,12 +104,12 @@ ssize_t _sha256_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, void *context
return pkt_pos - (uint8_t*)pkt->hdr; return pkt_pos - (uint8_t*)pkt->hdr;
} }
/* must be sorted by path (alphabetically) */ /* must be sorted by path (ASCII order) */
const coap_resource_t coap_resources[] = { const coap_resource_t coap_resources[] = {
COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER, COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER,
{ "/sha256", COAP_POST, _sha256_handler, NULL },
{ "/riot/board", COAP_GET, _riot_board_handler, NULL }, { "/riot/board", COAP_GET, _riot_board_handler, NULL },
{ "/riot/value", COAP_GET | COAP_PUT | COAP_POST, _riot_value_handler, NULL }, { "/riot/value", COAP_GET | COAP_PUT | COAP_POST, _riot_value_handler, NULL },
{ "/sha256", COAP_POST, _sha256_handler, NULL },
}; };
const unsigned coap_resources_numof = sizeof(coap_resources) / sizeof(coap_resources[0]); const unsigned coap_resources_numof = sizeof(coap_resources) / sizeof(coap_resources[0]);