<?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>NUS and dynamically allocated data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81522/nus-and-dynamically-allocated-data</link><description>I&amp;#39;m trying to dynamically allocate some data, send it over NUS, and then free it, but I&amp;#39;m not sure when the SoftDevice is done with it and it&amp;#39;s safe to free. Would the following code work safely (assuming I get NRF_SUCCESS)? Do I need to wait for some</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Nov 2021 08:55:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81522/nus-and-dynamically-allocated-data" /><item><title>RE: NUS and dynamically allocated data</title><link>https://devzone.nordicsemi.com/thread/338314?ContentTypeID=1</link><pubDate>Wed, 10 Nov 2021 08:55:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b4c3436-f445-4b82-aa47-35e063162d40</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Yes, it is copied to the TX buffers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS and dynamically allocated data</title><link>https://devzone.nordicsemi.com/thread/338167?ContentTypeID=1</link><pubDate>Tue, 09 Nov 2021 12:46:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71b54695-5b83-41ca-95e0-bb9d879e2180</guid><dc:creator>acarpenter</dc:creator><description>&lt;p&gt;Thanks for the info.&amp;nbsp; I&amp;#39;m not worried about losing the data if the link drops as much as I am about guaranteeing the data is still good in the best case scenario.&amp;nbsp; When the data is placed in the tx buffer, is it copied in there so that I can free the old pointer to it?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS and dynamically allocated data</title><link>https://devzone.nordicsemi.com/thread/338150?ContentTypeID=1</link><pubDate>Tue, 09 Nov 2021 12:04:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e26fa02-bb3c-4697-89dc-b7db1fbc1cac</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;After a call to ble_nus_data_send, the data will be placed in the tx buffers. In case the link is dropped at this time, you will lose the data. So you need to wait for the TX_complete event. This it the message to the application that the packet has been sent and acked by (on the link layer) by the peer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>