<?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 show different services in 2 different advertising?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115511/how-to-show-different-services-in-2-different-advertising</link><description>Hello DevZone, 
 I&amp;#39;m developing a HomeKit project for the customer. They require 2 BLE advertising in one device. One advertising is for HomeKit over BLE, and the other one is for their custom BLE service. 
 Environment: NCS v2.5.3 with HomeKit repo.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 26 Jan 2025 19:16:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115511/how-to-show-different-services-in-2-different-advertising" /><item><title>RE: How to show different services in 2 different advertising?</title><link>https://devzone.nordicsemi.com/thread/520100?ContentTypeID=1</link><pubDate>Sun, 26 Jan 2025 19:16:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:549c18ad-20d1-4a17-88dc-1e278d2a46f4</guid><dc:creator>Jayant Tang</dc:creator><description>&lt;p&gt;Hello Susheel,&lt;/p&gt;
&lt;p&gt;Thank you for your reply. Now I&amp;#39;m using this method, and I modified the error return value:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;return BT_GATT_ERR(BT_ATT_ERR_ATTRIBUTE_NOT_FOUND);&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I don&amp;#39;t use this return value, the nRF Connect APP on Android Phone will be not able to read all services.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And I finally find a better way, it&amp;#39;s to dynamically register and unregister my services. Using `bt_gatt_service_register` and `bt_gatt_service_unregister` in my connected and disconnected callbacks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jayant&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to show different services in 2 different advertising?</title><link>https://devzone.nordicsemi.com/thread/506238?ContentTypeID=1</link><pubDate>Tue, 15 Oct 2024 07:32:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99d1d461-4491-42d2-b1fb-9d37fbd20c1d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Jayant,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;that is exactly what you should do if you do not want some other services to be read by peers. During the discovery procedure, the peer tries to read everything in the attribute table by default. The additional check you added in the read_chrc callback is a good way to check that you only allow the peer to read attributes relevant to that connection only.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>