简体   繁体   English

如何从LWM2M乐山服务器向LWM2M Wakaama客户端发送固件包?

[英]How to send firmware package from LWM2M Leshan server to LWM2M Wakaama client?

I have a LwM2M Wakaama client working with a Leshan server.我有一个 LwM2M Wakaama 客户端与乐山服务器一起工作。 When I try to send a huge hexbinary string via the write option on Package resource for Firmware update object 5, I get the following error message on the client side:当我尝试通过固件更新对象 5 的包资源上的写入选项发送一个巨大的十六进制字符串时,我在客户端收到以下错误消息:

"Block1 NOT IMPLEMENTED". “Block1 未实施”。

I understand that block1 was not implemented on the wakaama client and only block2 was implemented, does anyone know why?我知道在 wakaama 客户端上没有实现 block1,只实现了 block2,有人知道为什么吗?

Also, How can I make firmware update with package resource work with the Leshan Server and Wakaama Client?另外,如何使用乐山服务器和 Wakaama 客户端使用软件包资源进行固件更新?

I believe I can either change the Leshan Server to send a request of type BLOCK2 (which I dont know how to do from the limited UI?) or add support for BLOCK1 on Wakaama LWM2M client.我相信我可以更改乐山服务器以发送 BLOCK2 类型的请求(我不知道如何从有限的 UI 中执行此操作?)或在 Wakaama LWM2M 客户端上添加对 BLOCK1 的支持。

Has anyone tried this?有没有人试过这个?

Does the version of wakaama you use is up-to-date?您使用的 wakaama 版本是否是最新的? the last master is supposed to support block transfer最后一个主节点应该支持块传输

Added Block1 support by doing the following changes in the function lwm2m_handle_packet in Paket.c ~ line 234-263:通过在 Paket.c ~ line 234-263 中的函数 lwm2m_handle_packet 中进行以下更改,添加了 Block1 支持:

       /* get offset for blockwise transfers */
        if (coap_get_header_block2(message, &block_num, NULL, &block_size, &block_offset))
        {
            LOG("Blockwise2: block request %u (%u/%u) @ %u bytes\n", block_num, block_size, REST_MAX_CHUNK_SIZE, block_offset);
            block_size = MIN(block_size, REST_MAX_CHUNK_SIZE);
            new_offset = block_offset;
        }
        ++else if (coap_get_header_block1(message, &block_num, NULL, &block_size, &block_offset))
        ++{
            ++LOG("Blockwise1: block request %u (%u/%u) @ %u bytes\n", block_num, block_size, REST_MAX_CHUNK_SIZE, block_offset);
            ++block_size = MIN(block_size, REST_MAX_CHUNK_SIZE);
            ++new_offset = block_offset;
        ++}
        coap_error_code = handle_request(contextP, fromSessionH, message, response);
        if (coap_error_code==NO_ERROR)
        {
            /* Apply blockwise transfers. */
            if ( IS_OPTION(message, COAP_OPTION_BLOCK1) && response->code<BAD_REQUEST_4_00 && !IS_OPTION(response, COAP_OPTION_BLOCK1) )
            {
                ++//LOG("Block1 NOT IMPLEMENTED\n");

                ++//coap_error_code = NOT_IMPLEMENTED_5_01;
                ++//coap_error_message = "NoBlock1Support";
                ++LOG("Block1 IMPLEMENTED\n");
                ++coap_set_header_block1(response, block_num, 0, block_size);

            }
            else if ( IS_OPTION(message, COAP_OPTION_BLOCK2) )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM