<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87031/reference-to-implement-ble-mesh-large-object-blob-transfer</link><description>Hi, 
 I need to transfer BLOB object upto 350kb through BLE-Mesh. 
 I saw the breakup of nCS that zephyr implements Mesh protocol layers, and nordic stack implements mesh application layer. 
 But i couldn&amp;#39;t find how I could implement large object transfer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 May 2022 09:22:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87031/reference-to-implement-ble-mesh-large-object-blob-transfer" /><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/367780?ContentTypeID=1</link><pubDate>Fri, 13 May 2022 09:22:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d1e6b30-b936-4124-b201-5f43d4d33025</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Ubaid,&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t had the time to test this, but it looks good.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For transmitting, if you are using the chat example as a starting point, you could:&lt;/p&gt;
&lt;p&gt;- Edit the shell commands in SHELL_STATIC_SUBCMD_SET_CREATE to create one for starting your transfer.&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;Make a shell command function similar to&amp;nbsp;cmd_message, that also split your file into chunks of a 100 Bytes.&lt;/p&gt;
&lt;p&gt;- Make a version of&amp;nbsp;bt_mesh_chat_cli_message_send that uses your own opcodes to send the message.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/367519?ContentTypeID=1</link><pubDate>Thu, 12 May 2022 06:42:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68500de8-a308-4321-be03-70bfe1956cc1</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/elfving"&gt;Elfving&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/87031/reference-to-implement-ble-mesh-large-object-blob-transfer/366751#366751"]I will have to get back to you on this next week.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kindly suggest on handlers for Client TX of 100 bytes &amp;amp; server RX of 100 bytes.&lt;br /&gt;&lt;br /&gt;Please suggest as per the pseudo-code below:&lt;br /&gt;Server RX:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#In prj.conf
CONFIG_BT_MESH_RX_SEG_MAX=20

//OPcode defn
#define BT_MESH_RX_100_OP_MESSAGE BT_MESH_MODEL_OP_3( 0x0A , BT_MESH_VENDOR_COMPANY_ID )

#define BT_MESH_PAYLOAD_GET_LEN 100
static char centLoad[100]= {0};
const struct bt_mesh_model_op _bt_mesh_vendor_srv_op[] = {
	{BT_MESH_RX_100_OP_MESSAGE,
	 BT_MESH_LEN_EXACT( BT_MESH_PAYLOAD_GET_LEN ),
	 handle_rx100B},
	 	BT_MESH_MODEL_OP_END,
};


//100bytes rx handler
static int handle_rx100B( struct bt_mesh_model* model, struct bt_mesh_msg_ctx* ctx, struct net_buf_simple* buf )
{
    struct bt_mesh_vendor_srv* srv = model-&amp;gt;user_data;
    centLoad = net_buf_simple_pull_mem( buf, buf-&amp;gt;len ); //buf-&amp;gt;len is initialized to 100 from the opcode len definition right..? //
    return ( 0 );
}



&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Kindly suggest on this server pseudo code&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;And please help me with client handler TX 100 bytes code for this server.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Ubaid&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/366751?ContentTypeID=1</link><pubDate>Fri, 06 May 2022 13:45:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c6c0d1a-98d0-47a5-9a50-6df19a05de51</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;First of all, again I just wanted to stress that Mesh isn&amp;#39;t recommended for sending large files. I have seen previous estimates for sending a 300kB file one hop (between two nodes next two each other) taking 5 hours. If you wanted it to be sent to a node on the opposite side of a larger network it would take even longer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="Ubaid_M"]&lt;p&gt;What I found that payload that is to be transferred is controlled through the configurations:&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/div&gt;[/quote]
&lt;p&gt;Right, the &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/kconfig/CONFIG_BT_MESH_RX_SEG_MAX.html#cmdoption-arg-CONFIG_BT_MESH_RX_SEG_MAX"&gt;CONFIG_BT_MESH_RX_SEG_MAX configuration&lt;/a&gt; will control the maximum amount of allowed segments in a message. Which you can modify yourself in the range [1,32]. Note that if you try to do a pristine build with&amp;nbsp;CONFIG_BT_MESH_RX_SEG_MAX=100, like you demonstrated, it will give you an error. Anything above 32 would go against the Spec. For more info on this, see section 2.3.3 in &lt;a href="https://www.bluetooth.com/specifications/specs/mesh-profile-1-0-1/"&gt;the Mesh Profile Spec.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What you can do, is increase the amount of segments to 32. For every segment you can get 12 octets, which turns out to be a total maximum of 377 octets (for a 3-octet opcode). So you can get more than a 100 bytes per message, though it would need to be multiple segments.&lt;/p&gt;
[quote user="Ubaid_M"]And is any other configurations are needed other than&amp;nbsp;CONFIG_BT_MESH_RX_SEG_MAX &amp;amp;&amp;nbsp;CONFIG_BT_MESH_TX_SEG_MAX..[/quote]
&lt;p&gt;Yeah put&amp;nbsp;CONFIG_BT_MESH_ADV_BUF_COUNT to at least 35. Besides that I believe Mesh configuration part of the&amp;nbsp;chat example already provides you with some of the more critical ones.&amp;nbsp;&lt;/p&gt;
[quote user="Ubaid_M"]&lt;p&gt;So, please help me in understanding, how will my callbacks look (Which APIs I can use and how..?):&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;I will have to get back to you on this next week.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/366095?ContentTypeID=1</link><pubDate>Wed, 04 May 2022 05:27:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c24ef60-f263-4ff8-979a-b9b4d26b0dfd</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/elfving"&gt;Elfving&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/87031/reference-to-implement-ble-mesh-large-object-blob-transfer/365984#365984"]ut the maximum possible segmented payload size is 380 bytes[/quote]
&lt;p&gt;Yes agreed to this,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What I found that payload that is to be transferred is controlled through the configurations:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_MESH_RX_SEG_MAX=100
CONFIG_BT_MESH_TX_SEG_MAX=100&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, please help me in understanding, how will my callbacks look (Which APIs I can use and how..?):&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. when transmitting 100 bytes..?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. When receiving 100 bytes..?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. And is any other configurations are needed other than&amp;nbsp;CONFIG_BT_MESH_RX_SEG_MAX &amp;amp;&amp;nbsp;CONFIG_BT_MESH_TX_SEG_MAX..?&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/365984?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 12:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd55602a-950a-46aa-a074-36ccd2c06f47</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry about the delay.&amp;nbsp;Have you gotten any further on this, or is what you described below still the current challenge?&lt;/p&gt;
&lt;p&gt;Your understanding of how the chat example works looks correct.&amp;nbsp;&lt;/p&gt;
[quote user="Ubaid_M"]How can I do that..? in the handler&lt;br /&gt;[/quote]
&lt;p&gt;You could simply save the msg to that struct of yours. And you might want to modify the handle_chat_message handler in model_handler.c to send the corresponding struct.&lt;/p&gt;
&lt;p&gt;But I think the main challenges lies in how you are going to handle all that data on the application layer. You can&amp;#39;t simply make the struct be 350kB and send that. Any packet with size larger than 11 bytes (including header) will be split into segmented messages automatically. But the maximum possible segmented payload size is 380 bytes. This means that you would have to control of what parts of the file are or are not received&amp;nbsp;using the application layer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/364073?ContentTypeID=1</link><pubDate>Thu, 21 Apr 2022 05:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:534d2a1a-1798-4aac-a459-af3293aa571f</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/elfving"&gt;Elfving&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="103347" url="~/f/nordic-q-a/87031/reference-to-implement-ble-mesh-large-object-blob-transfer/363522#363522"]You could start off by taking a look at the chat example in NCS[/quote]
&lt;p&gt;Thanks for the suggest.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you please help me understand how data reception is happening in Chat sample.&lt;/p&gt;
&lt;p&gt;1. I am to understand that first opcode is registered against handler:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* .. include_startingpoint_chat_cli_rst_2 */
const struct bt_mesh_model_op _bt_mesh_chat_cli_op[] = {
	{
		BT_MESH_CHAT_CLI_OP_MESSAGE,
		BT_MESH_LEN_MIN(BT_MESH_CHAT_CLI_MSG_MINLEN_MESSAGE),
		handle_message
	},&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2. Next in &amp;quot;handle_message&amp;quot; procedure data extraction is present:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static int handle_message(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
			  struct net_buf_simple *buf)
{
	struct bt_mesh_chat_cli *chat = model-&amp;gt;user_data;
	const uint8_t *msg;

	msg = extract_msg(buf);

	if (chat-&amp;gt;handlers-&amp;gt;message) {
		chat-&amp;gt;handlers-&amp;gt;message(chat, ctx, msg);
	}

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here it is byte wise data extraction, suppose my received data is custom &amp;amp; I want to extract custom data structure say:&lt;/p&gt;
&lt;p&gt;struct Custom&lt;br /&gt;{&lt;br /&gt;int i_data;&lt;br /&gt;float f_data;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;How can I do that..? in the handler&lt;br /&gt;&lt;br /&gt;Kindly suggest.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reference to implement BLE-Mesh Large object (BLOB) transfer</title><link>https://devzone.nordicsemi.com/thread/363522?ContentTypeID=1</link><pubDate>Tue, 19 Apr 2022 10:39:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c83e38c4-0127-4f87-9254-a465ed942d31</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Ubaid,&lt;/p&gt;
&lt;p&gt;A payload this large is not something Mesh would be recommended for. You would have to handle this at the application layer, by sending multiple segmented messages. Getting 350kb through a network would be a bit similar to a DFU, and it would take a while.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/mesh/chat/chat_cli.html#bt-mesh-chat-client-model"&gt;You could start off by taking a look at the chat example in NCS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>