<?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>How to indicate of new characteristics to client without refreshing the nrf connect app in nrf ble?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102204/how-to-indicate-of-new-characteristics-to-client-without-refreshing-the-nrf-connect-app-in-nrf-ble</link><description>Hi, 
 I am able to add custom services and characteristics dynamically. But still every time I need to refresh the nrfconnect application to see the newly added characteristics. Can I automate it, can I send any notification that new characteristics has</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Aug 2023 11:54:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102204/how-to-indicate-of-new-characteristics-to-client-without-refreshing-the-nrf-connect-app-in-nrf-ble" /><item><title>RE: How to indicate of new characteristics to client without refreshing the nrf connect app in nrf ble?</title><link>https://devzone.nordicsemi.com/thread/439242?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2023 11:54:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97cb0b3d-2405-4a34-bbdf-90c9e7950397</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I think setting end_handle to 0xFFFF&amp;nbsp;is the issue. I doubt your attribute table has 65k entries. The API docs for &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html?cp=5_7_4_1_2_4_2_9#ga2c8c90d73fa27ba6691ad82b4a960adc"&gt;sd_ble_gatts_service_changed&lt;/a&gt;&amp;nbsp;states the context for&amp;nbsp;&lt;span&gt;BLE_ERROR_INVALID_ATTR_HANDLE:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;Invalid attribute handle(s) supplied, handles must be in the range populated by the application&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-Edit: Also, I think&amp;nbsp;start_handle might need to be larger than zero, because that handle index is reserved.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to indicate of new characteristics to client without refreshing the nrf connect app in nrf ble?</title><link>https://devzone.nordicsemi.com/thread/438461?ContentTypeID=1</link><pubDate>Thu, 27 Jul 2023 09:07:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:883e576d-0708-448d-807c-d022a1418de7</guid><dc:creator>Ayu7</dc:creator><description>&lt;p&gt;Hi, I am putting question properly&amp;nbsp;with code again. No I was not able to&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I called this function :&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void our_service_change(ble_os_t * p_our_service)
{
uint32_t err_code_2;

static uint16_t start_handle= 0x000B;
const uint16_t end_handle = 0xFFFF;

err_code_2 = sd_ble_gatts_service_changed(p_our_service-&amp;gt;conn_handle,
start_handle,
end_handle);

APP_ERROR_CHECK(err_code_2);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but its showing 12291 error,&amp;nbsp;&lt;span&gt;12291 = 0x3003 and it&amp;#39;s equal to&amp;nbsp;BLE_ERROR_INVALID_ATTR_HANDLE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using following code to add characteristics:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;static uint32_t our_char_add(ble_os_t * p_our_service)
{

uint32_t err_code;
ble_uuid_t char_uuid;
ble_uuid128_t base_uuid = BLE_UUID_OUR_BASE_UUID;
char_uuid.uuid = BLE_UUID_OUR_CHARACTERISTC_UUID;
err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;char_uuid.type);
APP_ERROR_CHECK(err_code);


ble_gatts_char_md_t char_md;
memset(&amp;amp;char_md, 0, sizeof(char_md));
char_md.char_props.read = 1;
char_md.char_props.write = 1;


ble_gatts_attr_md_t cccd_md;
memset(&amp;amp;cccd_md, 0, sizeof(cccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.write_perm);
cccd_md.vloc = BLE_GATTS_VLOC_STACK;
char_md.p_cccd_md = &amp;amp;cccd_md;
char_md.char_props.notify = 1;




ble_gatts_attr_md_t attr_md;
memset(&amp;amp;attr_md, 0, sizeof(attr_md));
attr_md.vloc = BLE_GATTS_VLOC_STACK;



BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.write_perm);


ble_gatts_attr_t attr_char_value;
memset(&amp;amp;attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &amp;amp;char_uuid;
attr_char_value.p_attr_md = &amp;amp;attr_md;


attr_char_value.max_len = 4;
attr_char_value.init_len = 4;
uint8_t value[4] = {0x12,0x34,0x56,0x78};
attr_char_value.p_value = value;


err_code = sd_ble_gatts_characteristic_add(p_our_service-&amp;gt;service_handle,
&amp;amp;char_md,
&amp;amp;attr_char_value,
&amp;amp;p_our_service-&amp;gt;char_handles);
APP_ERROR_CHECK(err_code);
return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to indicate of new characteristics to client without refreshing the nrf connect app in nrf ble?</title><link>https://devzone.nordicsemi.com/thread/438222?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2023 10:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8483ab41-8088-4fdd-9418-91db2b4c805d</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Please elaborate - were you successful in prompting a rediscovery, or did you encounter any issues or questions?&lt;br /&gt;Please also use the&amp;nbsp;&lt;em&gt;Insert -&amp;gt; Code&amp;nbsp;&lt;/em&gt;option when sharing code here on DevZone.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to indicate of new characteristics to client without refreshing the nrf connect app in nrf ble?</title><link>https://devzone.nordicsemi.com/thread/438201?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2023 09:27:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff497da7-7fa7-44ca-9659-03c95fbe3bac</guid><dc:creator>Ayu7</dc:creator><description>&lt;p&gt;Hi, I called this function :&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;void our_service_change(ble_os_t * p_our_service)&lt;br /&gt;{&lt;br /&gt;uint32_t err_code_2;&lt;br /&gt;&lt;br /&gt;static uint16_t start_handle= 0x000B;&lt;br /&gt;const uint16_t end_handle = 0xFFFF;&lt;/p&gt;
&lt;p&gt;err_code_2 = sd_ble_gatts_service_changed(p_our_service-&amp;gt;conn_handle,&lt;br /&gt;start_handle,&lt;br /&gt;end_handle);&lt;/p&gt;
&lt;p&gt;APP_ERROR_CHECK(err_code_2);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but its showing 12291 error,&amp;nbsp;&lt;span&gt;12291 = 0x3003 and it&amp;#39;s equal to&amp;nbsp;BLE_ERROR_INVALID_ATTR_HANDLE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using following code to add characteristics:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;static uint32_t our_char_add(ble_os_t * p_our_service)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; uint32_t err_code;&lt;br /&gt; ble_uuid_t char_uuid;&lt;br /&gt; ble_uuid128_t base_uuid = BLE_UUID_OUR_BASE_UUID;&lt;br /&gt; char_uuid.uuid = BLE_UUID_OUR_CHARACTERISTC_UUID;&lt;br /&gt; err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;char_uuid.type);&lt;br /&gt; APP_ERROR_CHECK(err_code); &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; ble_gatts_char_md_t char_md;&lt;br /&gt; memset(&amp;amp;char_md, 0, sizeof(char_md));&lt;br /&gt; char_md.char_props.read = 1;&lt;br /&gt; char_md.char_props.write = 1;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;ble_gatts_attr_md_t cccd_md;&lt;br /&gt; memset(&amp;amp;cccd_md, 0, sizeof(cccd_md));&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;cccd_md.write_perm);&lt;br /&gt; cccd_md.vloc = BLE_GATTS_VLOC_STACK; &lt;br /&gt; char_md.p_cccd_md = &amp;amp;cccd_md;&lt;br /&gt; char_md.char_props.notify = 1;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; ble_gatts_attr_md_t attr_md;&lt;br /&gt; memset(&amp;amp;attr_md, 0, sizeof(attr_md)); &lt;br /&gt; attr_md.vloc = BLE_GATTS_VLOC_STACK;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);&lt;br /&gt; BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.write_perm);&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; ble_gatts_attr_t attr_char_value;&lt;br /&gt; memset(&amp;amp;attr_char_value, 0, sizeof(attr_char_value));&lt;br /&gt; attr_char_value.p_uuid = &amp;amp;char_uuid;&lt;br /&gt; attr_char_value.p_attr_md = &amp;amp;attr_md;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; attr_char_value.max_len = 4;&lt;br /&gt; attr_char_value.init_len = 4;&lt;br /&gt; uint8_t value[4] = {0x12,0x34,0x56,0x78};&lt;br /&gt; attr_char_value.p_value = value;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; err_code = sd_ble_gatts_characteristic_add(p_our_service-&amp;gt;service_handle,&lt;br /&gt; &amp;amp;char_md,&lt;br /&gt; &amp;amp;attr_char_value,&lt;br /&gt; &amp;amp;p_our_service-&amp;gt;char_handles);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt; return NRF_SUCCESS;&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to indicate of new characteristics to client without refreshing the nrf connect app in nrf ble?</title><link>https://devzone.nordicsemi.com/thread/438175?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2023 08:07:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4eb42c8-094e-461c-a8b2-bd6b4dee3ad5</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;To do this you will need to use the Services Changed notification - this lets your peripheral tell the central that there has been a change to the services / characteristics, and thus prompts the central to do a new discovery.&lt;br /&gt;&lt;br /&gt;Please give this a try, and dont hesitate to let me know if you should encounter any issues or questions! :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>