<?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>Set characteristic length</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111968/set-characteristic-length</link><description>Hey, I need to set characteristic length for a PTS test to MTU-1 Otherwise the test case GATT/SR/GAC/BV-01-C will failed with the message - Failed: Cannot find characteristic value with size equal to MTU-1. For create a characteristic I currently use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Jun 2024 13:53:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111968/set-characteristic-length" /><item><title>RE: Set characteristic length</title><link>https://devzone.nordicsemi.com/thread/488519?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 13:53:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cf2e239-7973-4386-9961-e4080010c502</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Actually, it looks like the characteristic length is set by the BT_GATT_CHARACTERISTIC() macro when declaring the characteristic. If you look at the lbs.c file in NCS, you can see that the last parameter in BT_GATT_CHARACTERISTIC() is a pointer to the parameter holding the value of the characteristic:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	BT_GATT_CHARACTERISTIC(BT_UUID_LBS_BUTTON,
			       BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
			       BT_GATT_PERM_READ, read_button, NULL,
			       &amp;amp;button_state),&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So in this case, the button_state parameter is a boolean. If you would have input a parameter that was e.g. an uint8_t button_state[10], it would be a 10 byte characteristic.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Set characteristic length</title><link>https://devzone.nordicsemi.com/thread/488496?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 12:31:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b0b07ac-7caf-4a6d-beb1-6ba88bb6d5c1</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply, but I needed to clarify this with our SoftDevice Controller team.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the nRF Connect SDK the data in the characteristics are not owned by the application, and not the Bluetooth stack.&lt;/p&gt;
&lt;p&gt;So in your read callback, you can decide what data you want to send in the reply.&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>