Send/Receiving big resources


I am looking at how to send and receive large resources without having to load the complete message into RAM.

For receiving messages my approach is to receive each block and store it in a temporary nvs space then resemble once it have received all the blocks. To achieve this we are setting the M2MResourceInstance external_blockwise to true and enabling a callback on set_incoming_block_message_callback to handle the incoming block.

Can you confirm if this a reliable mechanism, our testing so far has been reliable and however we have always received message blocks in order.

On the publishing side, I’m at a complete loss. The callbacks are not being called, I’m unsure whether setting the resource value is right approach because it always expects a pointer to a buffer value or value to be passed.

M2MObject* big_object = M2MInterfaceFactory::create_object("32771");
M2MObjectInstance* big_object_inst = big_object->create_object_instance();
M2MResource* big_res = big_object_inst->create_dynamic_resource("26244", "BigRes", M2MResourceInstance::STRING, true, false, true);

big_res->set_value((uint8_t*)"0", 1); // unsure what this for ?


(void (*)(const M2MBase&,
const M2MBase::MessageDeliveryStatus,
const M2MBase::MessageType,

big_res->set_incoming_block_message_callback(incoming_block_message_callback(this, &Cloud::block_message_received));
big_res->set_outgoing_block_message_callback(outgoing_block_message_callback(this, &Cloud::block_request));


Any ideas would be much appreciated. I have tried in vein examining the source for mbed-cloud-client to see how it works to try my best to get a better understanding.  I have also looked at the example mbed-os-example-client However this has been deprecated.

Thank you,

[original archived-thread] from user [ash d]