mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
examples/gcoap: upgrade users of deprecated nanocoap APIs
This commit is contained in:
parent
32575402c7
commit
d82eecfce0
@ -133,16 +133,16 @@ static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t* pdu,
|
|||||||
uri_parser_result_t urip;
|
uri_parser_result_t urip;
|
||||||
uri_parser_process(&urip, _last_req_uri, strlen(_last_req_uri));
|
uri_parser_process(&urip, _last_req_uri, strlen(_last_req_uri));
|
||||||
if (*_proxy_uri) {
|
if (*_proxy_uri) {
|
||||||
gcoap_req_init(pdu, (uint8_t *)pdu->hdr, CONFIG_GCOAP_PDU_BUF_SIZE,
|
gcoap_req_init(pdu, pdu->buf, CONFIG_GCOAP_PDU_BUF_SIZE,
|
||||||
COAP_METHOD_GET, NULL);
|
COAP_METHOD_GET, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gcoap_req_init(pdu, (uint8_t *)pdu->hdr, CONFIG_GCOAP_PDU_BUF_SIZE,
|
gcoap_req_init(pdu, pdu->buf, CONFIG_GCOAP_PDU_BUF_SIZE,
|
||||||
COAP_METHOD_GET, urip.path);
|
COAP_METHOD_GET, urip.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg_type == COAP_TYPE_ACK) {
|
if (msg_type == COAP_TYPE_ACK) {
|
||||||
coap_hdr_set_type(pdu->hdr, COAP_TYPE_CON);
|
coap_pkt_set_type(pdu, COAP_TYPE_CON);
|
||||||
}
|
}
|
||||||
block.blknum++;
|
block.blknum++;
|
||||||
coap_opt_add_block2_control(pdu, &block);
|
coap_opt_add_block2_control(pdu, &block);
|
||||||
@ -153,7 +153,7 @@ static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t* pdu,
|
|||||||
|
|
||||||
int len = coap_opt_finish(pdu, COAP_OPT_FINISH_NONE);
|
int len = coap_opt_finish(pdu, COAP_OPT_FINISH_NONE);
|
||||||
gcoap_socket_type_t tl = _get_tl(*_proxy_uri ? _proxy_uri : _last_req_uri);
|
gcoap_socket_type_t tl = _get_tl(*_proxy_uri ? _proxy_uri : _last_req_uri);
|
||||||
_send((uint8_t *)pdu->hdr, len, remote, memo->context, tl);
|
_send(pdu->buf, len, remote, memo->context, tl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
puts("--- blockwise complete ---");
|
puts("--- blockwise complete ---");
|
||||||
@ -340,7 +340,7 @@ int gcoap_cli_cmd(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
coap_hdr_set_type(pdu.hdr, msg_type);
|
coap_pkt_set_type(&pdu, msg_type);
|
||||||
|
|
||||||
size_t paylen = 0;
|
size_t paylen = 0;
|
||||||
if (apos < argc) {
|
if (apos < argc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user