<?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>my application is reconnecting the same device even after service discovery.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46556/my-application-is-reconnecting-the-same-device-even-after-service-discovery</link><description>Hi I am working on nRF52832 using SDK15.02 i have below query: 
 During discovery I am connecting each device which is advertising and then discover for services offered by peripheral device. Disconnect after the discovery. If required service found then</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Apr 2019 06:02:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46556/my-application-is-reconnecting-the-same-device-even-after-service-discovery" /><item><title>RE: my application is reconnecting the same device even after service discovery.</title><link>https://devzone.nordicsemi.com/thread/183930?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 06:02:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a7eddda-333c-4250-b3a5-3081c024557e</guid><dc:creator>Rekha</dc:creator><description>&lt;p&gt;Hi I modified my code. if service is found then my device starts connecting to next device.&lt;/p&gt;
&lt;p&gt;i have added a loop to check if service is found then do not connect device again. now problem is if service is not found then device reconnects more than 3 times and then check for next device.&lt;/p&gt;
&lt;p&gt;is there any way to optimize it still more.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my application is reconnecting the same device even after service discovery.</title><link>https://devzone.nordicsemi.com/thread/183410?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 10:50:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:115f6720-6a44-466e-b37d-6c9f0cd9d131</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;You should print some logs and figure out why that&amp;#39;s happening. I&amp;#39;m pretty sure it&amp;#39;s a small logic error somewhere.&lt;/p&gt;
&lt;p&gt;I would look into the saving and comparison of the addresses.&lt;/p&gt;
&lt;p&gt;Why doesn&amp;#39;t this code return? Shouldn&amp;#39;t the address be already saved if you already connected to it? It seems to me that something is going wrong there.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;for ( idx = 0; idx &amp;lt; DEVICE_TO_FIND_MAX; idx++)
{
    // If address is duplicated, then return.
    if (memcmp(p_adv_report-&amp;gt;peer_addr.addr,
               m_device[idx].addr,
               sizeof(p_adv_report-&amp;gt;peer_addr.addr)) == 0)
    {
         /* update rssi value */
        memcpy(&amp;amp;m_device[idx].RSSI_value_RK, 
               &amp;amp;p_adv_report-&amp;gt;rssi, 
               sizeof(p_adv_report-&amp;gt;rssi));
        return;
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my application is reconnecting the same device even after service discovery.</title><link>https://devzone.nordicsemi.com/thread/183400?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 10:22:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0abcc004-a9cc-4644-aaba-9b9f99231042</guid><dc:creator>Rekha</dc:creator><description>&lt;p&gt;here is the code :&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/85776.main.c"&gt;devzone.nordicsemi.com/.../85776.main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;yes i am telling to connect and after discovery i want to disconnect and never connect again if service is discovered. but even after service found its connecting same device.&lt;/p&gt;
&lt;p&gt;if the service is not found flow control goes to next device for connection. here i dont have any problem.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: my application is reconnecting the same device even after service discovery.</title><link>https://devzone.nordicsemi.com/thread/183381?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 09:25:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:761ff4e4-047f-430f-9f20-abe28039e4bb</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;Well it&amp;#39;s not a coincidence that it&amp;#39;s connecting to the same device, you&amp;#39;re telling it to connect to it.&lt;/p&gt;
&lt;p&gt;Can you post your code for the adv report event?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>