<?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 Issues using the discovery manager.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58757/service-discovery-issues-using-the-discovery-manager</link><description>I am trying to do service discovery using the discovery manager library on any BLE device I connect to my central. I start the service with bt_gatt_dm_start(conn, NULL, &amp;amp;discovery_cb, NULL) and every works fine on the first service discovered. I run into</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Mar 2020 14:21:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58757/service-discovery-issues-using-the-discovery-manager" /><item><title>RE: Service Discovery Issues using the discovery manager.</title><link>https://devzone.nordicsemi.com/thread/240280?ContentTypeID=1</link><pubDate>Tue, 17 Mar 2020 14:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81e1dbf1-1abd-4ac7-903d-60fbf81967e4</guid><dc:creator>Joakim Andersson</dc:creator><description>&lt;p&gt;Hi. Very good description. Thank you for that.&lt;br /&gt;I have created a fix here to address the issue:&amp;nbsp;&lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/2028"&gt;https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/2028&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Issues using the discovery manager.</title><link>https://devzone.nordicsemi.com/thread/239600?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 16:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fcd34f7-75cc-4424-8c54-aa2d669c5ca6</guid><dc:creator>apluke</dc:creator><description>&lt;p&gt;Yes I have. That was also an issue I was having and that PR was created based on information I provided Joakim. I believe this problem may be a separate issue than the one in that PR as that issue was based on the end handle rolling over back to 0 and the discovery service not found callback&amp;nbsp;never being&amp;nbsp;invoked at the end. This seems to have been solved in later versions of the NCS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Issues using the discovery manager.</title><link>https://devzone.nordicsemi.com/thread/239584?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 15:33:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2045a4f2-fa0c-4a4a-993d-2bf3ad61d1e1</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Have you tried implementing &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/1441"&gt;this PR&lt;/a&gt;? It might solve it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Issues using the discovery manager.</title><link>https://devzone.nordicsemi.com/thread/239196?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 16:40:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31bc24ba-4cee-471a-90c4-b1f1170c2b49</guid><dc:creator>apluke</dc:creator><description>&lt;p&gt;I have yes and I figured out where it is happening at. In&amp;nbsp;discovery_process_service you can see that the start handle has one added to it with&amp;nbsp;attr-&amp;gt;handle + 1. This becomes an issue when trying to do discovering on an empty service such as the 0x1801 service in the heart rate monitor where the end handle and start handle will be the same. Thus adding 1 to the starts makes it larger than the end. Maybe there needs to be a check if they are equal to each other before adding one to the start?&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static u8_t discovery_process_service(struct bt_gatt_dm *dm,
				      const struct bt_gatt_attr *attr,
				      struct bt_gatt_discover_params *params)
{
	int err;

	if (!attr) {
		discovery_complete_not_found(dm);
		return BT_GATT_ITER_STOP;
	}

	struct bt_gatt_service_val *service_val = attr-&amp;gt;user_data;
	struct bt_gatt_attr *cur_attr = attr_store(dm, attr);

	if (!cur_attr) {
		LOG_ERR(&amp;quot;Not enough memory for service attribute.&amp;quot;);
		discovery_complete_error(dm, -ENOMEM);
		return BT_GATT_ITER_STOP;
	}
	LOG_DBG(&amp;quot;Service detected, handles range: &amp;lt;%u, %u&amp;gt;&amp;quot;,
		attr-&amp;gt;handle + 1,
		service_val-&amp;gt;end_handle);

	cur_attr-&amp;gt;uuid = uuid_store(dm, attr-&amp;gt;uuid);
	service_val = user_data_store(dm, service_val, sizeof(*service_val));
	service_val-&amp;gt;uuid = uuid_store(dm, service_val-&amp;gt;uuid);
	cur_attr-&amp;gt;user_data = service_val;

	if (!cur_attr-&amp;gt;uuid || !service_val ||
	    !service_val-&amp;gt;uuid) {
		LOG_ERR(&amp;quot;Not enough memory for service attribute data.&amp;quot;);
		discovery_complete_error(dm, -ENOMEM);
		return BT_GATT_ITER_STOP;
	}

	dm-&amp;gt;discover_params.uuid         = NULL;
	dm-&amp;gt;discover_params.type         = BT_GATT_DISCOVER_ATTRIBUTE;
	dm-&amp;gt;discover_params.start_handle = attr-&amp;gt;handle + 1;    ///ISSUE HERE
	dm-&amp;gt;discover_params.end_handle   = service_val-&amp;gt;end_handle;
	LOG_DBG(&amp;quot;Starting descriptors discovery&amp;quot;);
	err = bt_gatt_discover(dm-&amp;gt;conn, &amp;amp;(dm-&amp;gt;discover_params));

	if (err) {
		LOG_ERR(&amp;quot;Descriptor discover failed, error: %d.&amp;quot;, err);
		discovery_complete_error(dm, -ENOMEM);
		return BT_GATT_ITER_STOP;
	}

	return BT_GATT_ITER_STOP;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Service Discovery Issues using the discovery manager.</title><link>https://devzone.nordicsemi.com/thread/239096?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 12:25:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4e5b763-edae-43bb-b415-1f641a7db066</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;have you checked the values of params-&amp;gt;start_handle and params-&amp;gt;end_handle?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>