[riot-notifications] [RIOT-OS/RIOT] net/gcoap: add helper functions (#16635)

Cenk Gündoğan notifications at github.com
Fri Jul 23 12:15:21 CEST 2021

@cgundogan requested changes on this pull request.

Looks good so far .. there is a minor comment regarding setting the block size explicitly for the first request.

> +            coap_opt_add_block2_control(pdu, &block);
+            int len = coap_opt_finish(pdu, COAP_OPT_FINISH_NONE);
+            gcoap_req_send((uint8_t *)pdu->hdr, len, remote,
+                           _resp_handler, memo->context);
+        }
+        else {
+            DEBUG("--- blockwise complete ---\n");
+        }
+    }
+    mutex_unlock(&ctx->lock);
+static void coap_request(const sock_udp_ep_t *remote, struct coap_request_ctx *ctx)

Can you also add support for setting the block size?  The default 16 bytes is for some use cases a little bit too small.

You could use `coap_block_object_init()`.

coap_block1_t block;
coap_block_object_init(&ctx->block, 0, ctx->blksz, 0);
coap_opt_add_block2_control(&pdu, &block);
int len = coap_opt_finish(&pdu, COAP_OPT_FINISH_XXX);

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210723/dbaa7d57/attachment.htm>

More information about the notifications mailing list