fwndz
(Fawwaz Nadzmy)
April 22, 2017, 8:19am
1
Hi,
I am really new in mbed client. I am planning to read/write file from mbed client. I saw some example in GitHub - ARMmbed/mbed-os-example-client: DEPRECATED: This is the mbed Client example application for mbed OS. which used bigpayload. My question is how can I test it (for sending or receiving bigpayload data /file) I had tried it with mbed connector console by sending a long string, unfortunately it failed,
How can I test it with curl or httpie? I had read https://docs.mbed.com/docs/mbed-device-connector-web-interfaces . When I send short string is fine but I cant send very long string? What is the proper way to test this features?
cheers
The node.js or Python SDKs would probably work.
fwndz
(Fawwaz Nadzmy)
May 3, 2017, 4:24am
3
thanks @janjongboom , I tried already with the node,js and mbed client example linux However, the callback from the client received, but the the total message size is 0. I added “coap_max_incoming_block_message_size”: 100000 in config.json file as suggested here
cheers
fwndz
(Fawwaz Nadzmy)
May 4, 2017, 8:39am
4
Below is the callback function.I am confuse why the last block is execute straight away as I understand the the block message is start from 0:
void block_message_received(M2MBlockMessage *argument) {
if (argument) {
if (M2MBlockMessage::ErrorNone == argument->error_code()) {
if (argument->is_last_block()) {
printf("Last block received\r\n");
}
printf("Block number: %d\r\n", argument->block_number());
printf("Total message size: %d\r\n", argument->total_message_size());
// First block arrived
if (argument->block_number() == 0) {
free(_block_message);
_block_message = NULL;
_block_message_len = argument->total_message_size();
_block_message = (uint8_t*)malloc(_block_message_len);
if (_block_message) {
memcpy(_block_message, argument->block_data(), argument->block_data_len());
}
} else {
if (_block_message) {
// Combine blocks
memcpy(_block_message + (argument->block_data_len() * argument->block_number()),
argument->block_data(),
argument->block_data_len());
}
}
} else {
printf("Error when receiving block message! %d\r\n", argument->error_code());
}
}
}