[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");
+        }
+    }
+
+out:
+    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()`.
http://doc.riot-os.org/group__net__nanocoap.html#gadabe7197cbe80bf17fea0ecf5ee9bf56

E.g.:
```c
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:
https://github.com/RIOT-OS/RIOT/pull/16635#pullrequestreview-713586769
-------------- 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