<?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>NCS BLE NUS uninitialize function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86457/ncs-ble-nus-uninitialize-function</link><description>Hello everyone, 
 I am working on an application where I am using the BLE Nordic UART service (NUS) with a changed service UUID. I need to be able to uninitialize the service after a while so it should only be available after startup for a certain time</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 31 Mar 2022 09:50:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86457/ncs-ble-nus-uninitialize-function" /><item><title>RE: NCS BLE NUS uninitialize function</title><link>https://devzone.nordicsemi.com/thread/360969?ContentTypeID=1</link><pubDate>Thu, 31 Mar 2022 09:50:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dce2e07a-4b18-4d32-ae5e-40f2ee85d54d</guid><dc:creator>db_lw</dc:creator><description>&lt;p&gt;Hello Hung Bui,&lt;/p&gt;
&lt;p&gt;thanks for your fast reply.&lt;/p&gt;
[quote userid="2121" url="~/f/nordic-q-a/86457/ncs-ble-nus-uninitialize-function/360962#360962"]Have you tried to call&amp;nbsp;bt_gatt_service_register() and&amp;nbsp;bt_gatt_service_unregister() to enable and disable the service ?[/quote]
&lt;p&gt;So far the bt_gatt_service_register() and&amp;nbsp;bt_gatt_service_unregister() functions do not throw errors with my service structure.&lt;/p&gt;
[quote userid="2121" url="~/f/nordic-q-a/86457/ncs-ble-nus-uninitialize-function/360962#360962"]I would suggest to have a look at the \zephyr\subsys\bluetooth\mesh\pb_gatt_srv.c (for pb-gatt in mesh) as an example. In the example we enable and disable the PB-GATT service dynamically before and after the node is provisioned.&amp;nbsp;[/quote]
&lt;p&gt;Great, this example looks like what I was searching for.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS BLE NUS uninitialize function</title><link>https://devzone.nordicsemi.com/thread/360962?ContentTypeID=1</link><pubDate>Thu, 31 Mar 2022 09:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:726a5d07-6746-4a77-98f2-14b2d5c900b1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi David,&amp;nbsp;&lt;br /&gt;It looks good. Have you tried to call&amp;nbsp;bt_gatt_service_register() and&amp;nbsp;bt_gatt_service_unregister() to enable and disable the service ?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I would suggest to have a look at the \zephyr\subsys\bluetooth\mesh\pb_gatt_srv.c (for pb-gatt in mesh) as an example. In the example we enable and disable the PB-GATT service dynamically before and after the node is provisioned.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>