<?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>Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26814/service-discovery-call-back-returns-incorrect-service-uuid</link><description>I&amp;#39;m printing the value of the UUID of the service(s) discovered on two types devices when the BLE Multi-link Example connects to them, an NRF52 flashed with the blinky app in the same SDK, and my Android phone running this server app . 
 /**
 * This</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 12 Nov 2017 19:37:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26814/service-discovery-call-back-returns-incorrect-service-uuid" /><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105394?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 19:37:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40bd4ef8-5c77-411b-a31a-08e92fe8c0af</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Yes, this is the right understanding how connections are handled by SD and its API!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105393?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 19:21:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2738753-dca3-474f-a1cb-9b623d0a3522</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;Right, I want to know exactly what I my code is doing and how to use it. I don&amp;#39;t like using these example as crutches, but they help me learn.&lt;/p&gt;
&lt;p&gt;So this is my understanding of connection handle. A connection handle is a unique number returned by the SD in the connection call back (don&amp;#39;t remember the exact name of the call-back). Then I can pass this number back to the SD card through functions, like for example relaying a packet to or disconnecting from a peripheral.&lt;/p&gt;
&lt;p&gt;So then, connecting to mutiple peripherals is simple. I just need to keep track of the connection handles to manage them.&lt;/p&gt;
&lt;p&gt;So basically, I can parse a packet for some number like a MAC address, and connect to the device. Then I can connect to another device, and basically as many devices as are supported without any special logic right? You&amp;#39;re basically just saying, keep track of and manage the connections with the handles.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105392?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 18:34:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47db407d-ecc7-49fa-a4d1-a215556ce731</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;So yes, the code snippet might be used wisely for multi-connectable application, you just need to take ownership of the code and stop reusing examples blindly;) There are usually no easy ways, no free hugs, no food falling down from the tree just like that;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105396?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 18:32:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5d55939-4b30-488b-b6a7-893175d85613</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;You get it right basically. There is opportunity to broadcast one or more Service UUIDs to hint that this is the device which implements GATT Server and that it had UUID which is interesting for some applications. But because standard BLE adv. packet (BT 4.0-4.2) can fit only one 128-bit UUID or few 16-bit (and these are not interesting unless your main use-case is some standard profile) then it&amp;#39;s pretty legit use case to connect to each GAP Peripheral and try to discover the server for UUIDs which you want to interact with. If you find proper set of UUIDs then you go on, if not then you disconnect.&lt;/p&gt;
&lt;p&gt;When it comes to multi-connectivity: it&amp;#39;s just about using proper connection handles! So make sure that all functions are having connection handle as input (and use it for all SD calls) and the same for event handlers (each event must be handled in the context of its connection handle).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105395?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 18:03:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a79480ce-007a-476e-a30b-47ea99861e02</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;Thanks again. I think I understand now. Correct me if I&amp;#39;m wrong. A GATT server does not have a UUID. A server is vertical stack of attributes where each attribute is assigned a unique UUID. A client will parse an advertisement packet for a MAC address and connect to the server on the basis of this MAC address.&lt;/p&gt;
&lt;p&gt;However, the client I should program will not know the MAC address of the server beforehand, so my client should connect to the server on the basis of the first primary service UUID. This is a legitimate approach right?&lt;/p&gt;
&lt;p&gt;Lastly, thank you for the sample code. Will the client app that uses this code be able to connect to multiple servers concurrently, or are multiple concurrent connections a special feature supported by the multi-connect example? I would like to avoid the more complicated multi-connect example if possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105399?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 10:48:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:771dd624-5e3e-441a-bf5e-116c7ec604dd</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Btw. &lt;a href="https://devzone.nordicsemi.com/question/15930/s130-custom-uuid-service-discovery/"&gt;here is one Q&amp;amp;A which shows how to do simple Service Discovery algorithm based on older S130 and SDk version&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105391?ContentTypeID=1</link><pubDate>Sun, 12 Nov 2017 10:04:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dad0f76-ae19-423f-b67a-6bd66f3c87dd</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Again: the device is recognized by MAC not UUID, so you cannot immediately make GATT Server and some UUID as equal. But assuming each of GATT Servers you use will have different UUIDs we can go on.&lt;/p&gt;
&lt;p&gt;When it comes to &lt;code&gt;examples\ble_central\ble_app_multilink_central&lt;/code&gt; project then it&amp;#39;s good starting point for multiple GAP Central and GATT Client connections in single nRF52 chip. However have you started from there just to get familiar with the project and debug while having it on DK and simulating 2-4 Peripheral boards by another nRF5x Dev Kits? That might be a good starting point. How GATT service discovery looks there? And more importantly can you get also BLE trace from some sniffer so you can understand what is really happening when DB module does the job and if you might be able to write it shorter and more efficiently?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105398?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2017 23:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d21900b-e603-4d7b-920a-79778a64817a</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;Thanks. This is exactly what I want to do. I want to connect to multiple GATT servers I know the UUIDs of. Is this multi-link app the closest example in the SDK of what I want to accomplish? You make it sound so simple, but I have no idea how to accomplish this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105397?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2017 22:52:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0daceb11-5297-4e2b-b7ad-e3bad82b3133</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Well I cannot comment much on how exactly db_discovery module works because as I said I never found use for it. If I&amp;#39;m looking for specific Service and Characteristics then it can be done in two simple loops going through certain ranges of GATT handles and there are even GATT Methods where you ask for handle with given UUID and you get straight answer so why to discover all objects and building some database? This is what generic devices with separated GATT Client and APP layers do, e.g. all phones and tablets and probably PCs. But that&amp;#39;s basically never the case on embedded system such as nRF5x. You basically always know what UUID are you looking for right now so I don&amp;#39;t see any use of this module...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105389?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2017 22:15:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0b5be03-c4bb-4611-8bbb-716fdf125ed7</guid><dc:creator>MichaelNordicUser</dc:creator><description>&lt;p&gt;Thanks for the feeback. I will flash the chip and start from scratch. I am reading the docs and trying to understand the database discovery module. Am I correct when I say that the discovery event handler forwards discovery events to the &lt;code&gt;ble_lbs_on_db_disc_evt&lt;/code&gt; function if the server UUID in the discovery event matches the registered Light Service UUID? Or are all discovery events whose UUID matches a registered UUID (and no others) forward to &lt;code&gt;ble_lbs_on_db_disc_evt&lt;/code&gt; function? Or am I just not making any sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105390?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2017 19:46:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b1f44c4-ebfe-4f46-a588-95f3ea83f854</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;You seems to be missing how advertiser/broadcaster and connection link work. The scenario you describe is very much unlikely and the probability that you have bug in your code is many times bigger. GATT Service discovery has nothing to do with advertisement and it cannot be disturbed by any such packet even if it would be sent (mainly because receiver cannot by any chance accept it as part of the valid link). I&amp;#39;m afraid you lost control over your project long time ago and from some messy RTT debug messages (which you are unsure what they say and where they come from) it will be hard to get it together again.&lt;/p&gt;
&lt;p&gt;Also 95% of GATT Clients have very simple use case of &amp;quot;find one service =&amp;gt; find one characteristic under it =&amp;gt; use it as communication tube&amp;quot; so I have feeling that most of things your client does on app layer is totally wasting of time and code space.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105388?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2017 10:47:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dcc665f-fe3a-49b3-a425-e3e079664c40</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;and apart from that there are various error codes which tell you whether the data is even valid and none of those have been checked. So this is a print out of random nubers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service discovery call back returns incorrect service UUID?</title><link>https://devzone.nordicsemi.com/thread/105387?ContentTypeID=1</link><pubDate>Sat, 11 Nov 2017 10:08:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f62b89ee-a215-45d9-b5bc-2563824aae37</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The point is that you print out only short 16-bit (2-byte) UUIDs. Nordic stack always work with full 128-bit UUIDs in a little bit special form (which makes sense if you appreciate how UUIDs are defined in BT SIG specification):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Each UUID is pair of short UUID value (in your case &lt;code&gt;0x1523&lt;/code&gt; or &lt;code&gt;0x0011&lt;/code&gt;) and &amp;quot;UUID type&amp;quot; which is actually index in virtual table of known (= provisioned to Soft Devie BLE stack through GATT API function &lt;code&gt;sd_ble_uuid_vs_add&lt;/code&gt;) - or actually unknown - 128-bit UUID bases.&lt;/li&gt;
&lt;li&gt;So the fact that some UUIDs have the same 16-bit short part can be only coincidence, the type says all.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition there are definitely more than one service on phone&amp;#39;s GATT Server so firstly I&amp;#39;m not sure if your service discovery is doing what it should (or what you want) and secondly the questions &lt;em&gt;&amp;quot;Why is it that the service UUID of the my phone is 1523 ? Is that right?&amp;quot;&lt;/em&gt; don&amp;#39;t make any sense. if you as if it&amp;#39;s possible that GATT Server on the phone has such service then indeed it&amp;#39;s possible, why not? If there is any application which provisions such GATT Service then it&amp;#39;s there. Who knows what you have on that phone?:) And btw. there can be even more GATT objects with the same UUID on the same server. They will have different handle IDs but UUID is like a name and you can have several people named John in your house so it works the same way.&lt;/p&gt;
&lt;p&gt;When it comes tho discovery of your blinky app it kind of indicates that your GATT Service discovery is out of control or just acting weirdly: why would your discovery DB module report the same service 8 times? Unless you modified the GATT Server code and it really contains 8 such Services... but I doubt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>