<?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>Change the transmission data structure of mesh chat messages</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114523/change-the-transmission-data-structure-of-mesh-chat-messages</link><description>Hi 
 This is a project that reads sensor data and transmits it to the phone. Currently, the sensor data is read and transmitted to the app. 
 However, if there is 0x00 in the middle of the data, the data after that cannot be transmitted and the message</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Sep 2024 13:52:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114523/change-the-transmission-data-structure-of-mesh-chat-messages" /><item><title>RE: Change the transmission data structure of mesh chat messages</title><link>https://devzone.nordicsemi.com/thread/502506?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2024 13:52:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a04a87e1-1252-4884-8b80-ef19bedec208</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I think that is correct. The Bluetooth part of this doesn&amp;#39;t usually care about the content of it&amp;#39;s data buffers, so these 0-terminated strings are usually just a way to determine that a text string has reached it&amp;#39;s end. All the bluetooth buffers are specified by length, so if you are able to send it correctly now, and you can see it from the other side, it should be fine.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the transmission data structure of mesh chat messages</title><link>https://devzone.nordicsemi.com/thread/502430?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2024 06:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfa50b78-4e72-4065-94f3-01ce1c9b3127</guid><dc:creator>greenK</dc:creator><description>&lt;p&gt;Hi Edvin&lt;/p&gt;
&lt;p&gt;I looked into chat_cli.c as you advised.&lt;br /&gt;Currently, we are using &amp;quot;int bt_mesh_chat_cli_private_message_send()&amp;quot; to send sensor data.&lt;/p&gt;
&lt;p&gt;So, in &amp;quot;bt_mesh_chat_cli_private_message_send() / net_buf_simple_add_mem()&amp;quot;, I applied a fixed buffer length (20byte) instead of strnlen, and confirmed that it is transmitted even if there is 0x00 data in the middle.&lt;/p&gt;
&lt;p&gt;Thank you for your advice, and please advise if it affects other parts if used as above.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;greenK&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the transmission data structure of mesh chat messages</title><link>https://devzone.nordicsemi.com/thread/501566?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 13:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:803305eb-bfe6-4a11-87bb-e9830c556039</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The reason why it stops at 0x00 is that the chat sample is designed to send strings that always end with 0x00 or &amp;#39;/0&amp;#39; as you can see here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const uint8_t *extract_msg(struct net_buf_simple *buf)
{
	buf-&amp;gt;data[buf-&amp;gt;len - 1] = &amp;#39;\0&amp;#39;;
	return net_buf_simple_pull_mem(buf, buf-&amp;gt;len);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;look in the chat_cli.c and look at how it is handled. I must admit I don&amp;#39;t know it&amp;#39;s quirks, but you need to decide something that decides when to send the message. Since this is a chat program, it doesn&amp;#39;t know the length up front. But you need to write something that decides when to call&amp;nbsp;send_message_reply(), not dependent on 0x00.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>