lib: updatehub: Kconfig: Add coap block size option

Allow select max CoAP block size for exchange data using coap protocol.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
This commit is contained in:
Gerson Fernando Budke 2020-04-11 23:57:30 -03:00 committed by Carles Cufí
commit 092b962350
2 changed files with 19 additions and 1 deletions

View file

@ -95,6 +95,23 @@ config UPDATEHUB_COAP_MAX_RETRY
Set the maximum number of retries attempts to download a packet
before abort a current update.
config UPDATEHUB_COAP_BLOCK_SIZE_EXP
int "Max CoAP block size defined as 2^(4 + EXP)"
default 6
range 0 6
depends on UPDATEHUB
help
Configure the max size of a data payload were value:
0 - COAP_BLOCK_16
1 - COAP_BLOCK_32
2 - COAP_BLOCK_64
3 - COAP_BLOCK_128
4 - COAP_BLOCK_256
5 - COAP_BLOCK_512
6 - COAP_BLOCK_1024
This value is mapped directly to enum coap_block_size.
module = UPDATEHUB
module-str = Log level for UpdateHub
module-help = Enables logging for UpdateHub code.

View file

@ -458,7 +458,8 @@ static enum updatehub_response install_update(void)
goto error;
}
if (coap_block_transfer_init(&ctx.block, COAP_BLOCK_1024,
if (coap_block_transfer_init(&ctx.block,
CONFIG_UPDATEHUB_COAP_BLOCK_SIZE_EXP,
update_info.image_size) < 0) {
LOG_ERR("Unable init block transfer");
ctx.code_status = UPDATEHUB_NETWORKING_ERROR;