<?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>changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87943/changing-the-ble-device-name-ble-service-and-gatt-characteristics-dynamically</link><description>Hi, I am using nRF52832 module (GAP peripheral, GATT server) with nRF5SDK, ble_app_uart_pca10040_s112 application. 
 I need some help on dynamically changing the BLE device name, BLE service and GATT Characteristics. 
 What I tried: In main(), I initialized</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 04 Jun 2022 06:14:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87943/changing-the-ble-device-name-ble-service-and-gatt-characteristics-dynamically" /><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370950?ContentTypeID=1</link><pubDate>Sat, 04 Jun 2022 06:14:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad07f306-12ec-444a-9d51-94d467b5047d</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Okay, thank you so much for the support!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370937?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 16:41:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86e7cf56-958f-4082-bd89-3ebfc6db7b3c</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;The main issue seems to be in do-while loop.&lt;br /&gt;You probably enter &amp;quot;if&amp;quot; part and pass the pointer to the process_mcu_data(), data_array gets somehow changed and in next while iteration you go to ble_nus_data_send() with changed data.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370808?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 07:37:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89d9d6a6-519d-4ee2-95c6-e1d16f07f7cf</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Thank you so much!!&amp;nbsp; With this modified changes, communication is taking place for more than an hour now, without an issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would like to&amp;nbsp;get clarifications on the following:&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;attempted similar approach as what you have suggested, but the difference is that I copied the contents of&amp;nbsp;data_array to the different buffer and passed that new buffer to&amp;nbsp;ble_nus_data_send() function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For&amp;nbsp;process_mcu_data(), I sent the&amp;nbsp;&lt;span&gt;data_array&amp;nbsp;as it is. Why this change could not make an impact?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370665?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 11:18:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e639d0b9-d04b-494b-bcba-64fa6e464959</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Could you please replace your uart_event_handle() with the one provided below and try to reproduce your issue? &lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1588.PKANNAN_5F00_uart_5F00_event_5F00_handle.c"&gt;devzone.nordicsemi.com/.../1588.PKANNAN_5F00_uart_5F00_event_5F00_handle.c&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370449?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 12:43:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea1e8352-03af-412e-9ab7-bfab2fe8fcca</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Okay, sure. Thank you for the support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370345?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 07:43:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3418e842-c2d1-42fa-b175-e1babbf1f25d</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Your case has been looked into internally. I&amp;#39;ll get back to you when I get new information.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/370123?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 07:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d835d6b3-dc89-4b82-b80a-4fd69e6b8af7</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have added additional information on how I&amp;#39;m changing services and characteristics w.r.t reset in this&amp;nbsp;&lt;a title="updated_pseudocode" href="https://www.dropbox.com/s/682f43oz02r34fv/nrf52832_pseudocode%20%281%29.txt?dl=0"&gt;updated_pseudocode&lt;/a&gt;&amp;nbsp;text file. Kindly check.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/369756?ContentTypeID=1</link><pubDate>Fri, 27 May 2022 11:24:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19d50f93-b171-4e6c-a106-ceb96875c04f</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;In addition to the name, could you provide more information about service and characteristics?&lt;br /&gt;How do you want to change characteristics dynamically and when (in relation to the reset)?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/369641?ContentTypeID=1</link><pubDate>Thu, 26 May 2022 05:18:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a0e718d-d46a-4325-ab43-88fe643bbd00</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="111786" url="~/f/nordic-q-a/87943/changing-the-ble-device-name-ble-service-and-gatt-characteristics-dynamically/369593#369593"]Could you be more specific about your use case? Is there a specific reason why you need to do it dynamically?[/quote]
&lt;p&gt;I have added the use case in this &lt;a title="nRF_usecase" href="https://www.dropbox.com/scl/fi/7g3mq6cvd6pawmtzrgxix/nRF_usecase.docx?dl=0&amp;amp;rlkey=xcdrca674tjb6y93cbw9cn948"&gt;nRF_usecase&lt;/a&gt;&amp;nbsp;document, please check. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/369593?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 15:19:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b951b7df-9ab9-46a1-86e4-f95d39c6c492</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Indication suggests to the central to do service discovery without the guarantee that this is immediate action. Service discovery is usually done on next re-connection.&lt;br /&gt;&lt;br /&gt;In general, it is not&amp;nbsp; recommended to do attribute table change dynamically. &lt;br /&gt;Could you be more specific about your use case? Is there a specific reason why you need to do it dynamically?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/369410?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 04:57:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c557f550-944b-4f56-b5e8-877ff14d3bf3</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Hi, thank you for your response.&lt;/p&gt;
[quote userid="111786" url="~/f/nordic-q-a/87943/changing-the-ble-device-name-ble-service-and-gatt-characteristics-dynamically/368857#368857"]In general, what you have described might work. However, it might not be possible to change dynamically services and characteristics without updating attribute table and that would require terminating the connection. [/quote]
&lt;p&gt;I understand that, attribute table needs to be updated for changing the services and characteristics.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In my application, the BLE initialization is performed based on data received at run time. If that can work without an issue, then may I know what could be the reason for transmitting incorrect/incomplete data to a GATT client after some point of time? I am not able to debug it since I am not having a Jlink debugger.&lt;/p&gt;
&lt;p&gt;Kindly help, Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/368857?ContentTypeID=1</link><pubDate>Fri, 20 May 2022 14:27:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de2985a0-b8a6-4935-a784-b754ffb72d40</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;In general, what you have described might work. However, it might not be possible to change dynamically services and characteristics without updating attribute table and that would require terminating the connection. On the other hand, there is no such limitation on dynamically updating the device name.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/368496?ContentTypeID=1</link><pubDate>Thu, 19 May 2022 06:02:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c84ad22-2d80-47ee-a94a-751e209f6fa3</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;Hi, herewith I have attached the pseudo code for my custom application. Please check it.&lt;/p&gt;
&lt;p&gt;&lt;a title="custom_application_pseudocode" href="https://www.dropbox.com/s/7l4fcvgbty894gk/nrf52832_pseudocode.txt?dl=0"&gt;nrf52832_pseudocode&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/368267?ContentTypeID=1</link><pubDate>Wed, 18 May 2022 10:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9994d8b0-e44d-4412-a904-0f4ced8723e1</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Could you show relevant part where the function call is located and how you use it?&lt;br /&gt;Is this the same function call through which you receive data, make initializations and advertisements?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/368144?ContentTypeID=1</link><pubDate>Tue, 17 May 2022 09:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0aa85df-d332-4466-a5a5-ab278b98e64e</guid><dc:creator>PKANNAN</dc:creator><description>&lt;p&gt;I would like to mention that I wanted to change the&amp;nbsp;&lt;span&gt;BLE service and characteristics dynamically so that nRF module connects with different GATT client in run time. In this case, may I know how&amp;nbsp;service change notification would help? Please share any references if possible.&lt;/span&gt;&lt;/p&gt;
[quote userid="112716" url="~/f/nordic-q-a/87943/changing-the-ble-device-name-ble-service-and-gatt-characteristics-dynamically"]&lt;p&gt;What I tried:&lt;br /&gt;In main(), I initialized only the UART module. Once UART is up, the nRF module receives data from an application chip (MCU).&lt;br /&gt;In uart_event_handle function, I use a function call to process the received data and set the BLE device name accordingly, inside this function call I am initializing BLE stack, GAP parameters, GATT Init, Services Init followed by BLE advertisement.&lt;/p&gt;
&lt;p&gt;This way, I was successfully able to set BLE device name and Services dynamically. However, after few minutes of communication with a GATT client, incorrect/incomplete data is being transmitted to that peer device.&lt;/p&gt;
&lt;p&gt;Is it good to initialize BLE this way? If not, what should be done?&lt;/p&gt;[/quote]
&lt;p&gt;Also, I would like to know if this method which I followed is correct or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please help, Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: changing the BLE device name, BLE service and GATT Characteristics dynamically</title><link>https://devzone.nordicsemi.com/thread/368068?ContentTypeID=1</link><pubDate>Mon, 16 May 2022 13:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fecce482-6c20-4b78-95d5-772d2bccaf14</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;It is possible to add BLE service and characteristics dynamically, but it is not possible to remove them. It is required to send a service change notification to let the gatt client know that the attribute table has been updated.&lt;br /&gt;Regarding the device name, it is possible to change device name using&amp;nbsp;sd_ble_gap_device_name_set().&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>