examples/gcoap: adapt to resp_handler API change

This commit is contained in:
Hauke Petersen 2018-09-26 14:25:34 +02:00
parent 383f395af3
commit 75397a2be1

View File

@ -14,6 +14,7 @@
* @brief gcoap CLI support
*
* @author Ken Bannister <kb2ma@runbox.com>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*
* @}
*/
@ -31,8 +32,8 @@
static ssize_t _encode_link(const coap_resource_t *resource, char *buf,
size_t maxlen, coap_link_encoder_ctx_t *context);
static void _resp_handler(unsigned req_state, coap_pkt_t* pdu,
sock_udp_ep_t *remote);
static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t* pdu,
const sock_udp_ep_t *remote);
static ssize_t _stats_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, void *ctx);
static ssize_t _riot_board_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, void *ctx);
@ -84,16 +85,16 @@ static ssize_t _encode_link(const coap_resource_t *resource, char *buf,
/*
* Response callback.
*/
static void _resp_handler(unsigned req_state, coap_pkt_t* pdu,
sock_udp_ep_t *remote)
static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t* pdu,
const sock_udp_ep_t *remote)
{
(void)remote; /* not interested in the source currently */
if (req_state == GCOAP_MEMO_TIMEOUT) {
if (memo->state == GCOAP_MEMO_TIMEOUT) {
printf("gcoap: timeout for msg ID %02u\n", coap_get_id(pdu));
return;
}
else if (req_state == GCOAP_MEMO_ERR) {
else if (memo->state == GCOAP_MEMO_ERR) {
printf("gcoap: error in response\n");
return;
}