<?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>Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47634/problems-while-discovering-services-on-a-multilink-central</link><description>Hi, 
 
 I developped a multilink central based on the example code ble_app_multilink_central. 
 I want to connect to several peripherals with two different custom services as shown in the following schematic. 
 
 
 The connection work but I have problems</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jul 2023 04:26:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47634/problems-while-discovering-services-on-a-multilink-central" /><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/435603?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2023 04:26:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28eb02be-d67a-458f-82a2-7a48e6252ef4</guid><dc:creator>sne_333</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/jcombes"&gt;JCombes&lt;/a&gt;&amp;nbsp; I am facing the same issue in my central device. Can you please help me sharing how to created a table to keep a track of conn_handle and how to keep it updated?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Snehal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/196244?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 11:56:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ede3334-9e7d-4104-99f4-134051bac74a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jules,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Glad that the issue is now fixed :D Sorry that the case has been dragging for some time. It&amp;#39;s a bit hard to catch the bug :D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/196195?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 09:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da5da827-b6ad-4a06-b154-5feb78ae8f5c</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I missed this and the error was due to this, thank you for your help.&lt;/p&gt;
&lt;p&gt;Now I have a table containing the types (RFID_TYPE our RELAY_TYPE) of devices for each conn_handle which is updated on DISCOVERY_COMPLETE and BLE_GAP_EVT_DISCONNECTED.&lt;/p&gt;
&lt;p&gt;I can count the RFID devices to know which instance of m_rfid_c I have to call in db_disc_handler.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For the relay, since I always use one relay, I define only one instance of relay client and call this one in db_disc_handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/196038?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 14:19:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d03fe2bf-7108-4ab4-804b-0ca29383e2e3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jules,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think I found something wrong here.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you can see in the log, the p_relay_c-&amp;gt;uuid_type showing quite strange value (21, 178).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think it was because of this function:&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;static void db_disc_handler(ble_db_discovery_evt_t * p_evt)&lt;/em&gt;&lt;br /&gt;&lt;em&gt;{&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp; rfid_on_db_disc_evt(&amp;amp;m_rfid_c[p_evt-&amp;gt;conn_handle], p_evt);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp; relay_on_db_disc_evt(&amp;amp;m_relay_c[p_evt-&amp;gt;conn_handle], p_evt);&lt;/em&gt;&lt;br /&gt;&lt;em&gt;}&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In our multilink example this work because we only have one service lbs and there can be a simple match between the index of the m_lbs_c array and the index of connection handle. When it&amp;#39;s not the case with your application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You are declaring&amp;nbsp;&lt;em&gt;m_rfid_c &lt;/em&gt;array with the size of&amp;nbsp;&lt;strong&gt;7&lt;/strong&gt; and m_relay_c with size of &lt;strong&gt;1&lt;/strong&gt;. Calling a function using&amp;nbsp;&lt;em&gt;m_relay_c[p_evt-&amp;gt;conn_handle] &lt;/em&gt;will cause trouble if the conn_handle is not equal to 0.&lt;/p&gt;
&lt;p&gt;And since you don&amp;#39;t know which one will be the first one to connect you can&amp;#39;t be sure that the conn_handle = 0 will be always be the relay.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So you need to define a table that keep track of the connection handle that match with the relay and the list of active RFID node in an array. And keep that table (array) up to date on each CONNECTED/DISCONNECTED event. (You can detect if a device is a relay or a RFID by the if check inside&amp;nbsp;&lt;em&gt;rfid_on_db_disc_evt() and&amp;nbsp;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;relay_on_db_disc_evt() )&amp;nbsp;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/195990?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 12:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e76efb5b-4b52-45b5-9601-0f52de50cba2</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I added logs so we can see the parameters inside the checks in&amp;nbsp;rfid_on_db_disc_evt() and in&amp;nbsp;&lt;span&gt;relay_on_db_disc_evt() when the event is&amp;nbsp;BLE_DB_DISCOVERY_COMPLETE :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;void rfid_on_db_disc_evt(rfid_c_t * p_rfid_c, ble_db_discovery_evt_t const * p_evt)
{
    if(p_evt-&amp;gt;evt_type == 0)
    {
        NRF_LOG_INFO(&amp;quot;rfid_on_db_disc_evt :&amp;quot;);
        NRF_LOG_INFO(&amp;quot;\tp_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : %d&amp;quot;,p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE);
        NRF_LOG_INFO(&amp;quot;\tp_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RFID_UUID : %d&amp;quot;,p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RFID_UUID);
        NRF_LOG_INFO(&amp;quot;\tp_evt-&amp;gt;params.discovered_db.srv_uuid.type : %d\t\t\tp_rfid_c-&amp;gt;uuid_type : %d&amp;quot;,p_evt-&amp;gt;params.discovered_db.srv_uuid.type,p_rfid_c-&amp;gt;uuid_type);
    } 

    // Check if the Led Button Service was discovered.
    if (p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE &amp;amp;&amp;amp;
        p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RFID_UUID &amp;amp;&amp;amp;
        p_evt-&amp;gt;params.discovered_db.srv_uuid.type == p_rfid_c-&amp;gt;uuid_type)
    {
        rfid_c_evt_t evt;

        evt.evt_type    = RFID_C_EVT_DISCOVERY_COMPLETE;
        evt.conn_handle = p_evt-&amp;gt;conn_handle;

        for (uint32_t i = 0; i &amp;lt; p_evt-&amp;gt;params.discovered_db.char_count; i++)
        {
            //NRF_LOG_INFO(&amp;quot;Discovering characteristics.&amp;quot;);
            const ble_gatt_db_char_t * p_char = &amp;amp;(p_evt-&amp;gt;params.discovered_db.charateristics[i]);
            switch (p_char-&amp;gt;characteristic.uuid.uuid)
            {
                case SENSORS_FRAME_CHAR_UUID:
                    evt.params.peer_db.sensors_frame_handle      = p_char-&amp;gt;characteristic.handle_value;
                    evt.params.peer_db.sensors_frame_cccd_handle = p_char-&amp;gt;cccd_handle;
                    break;
                
                case MEASURE_REQUEST_CHAR_UUID:
                    evt.params.peer_db.measure_request_handle     = p_char-&amp;gt;characteristic.handle_value;
                    break;

                default:
                    break;
            }
        }

        //NRF_LOG_INFO(&amp;quot;RFID Service discovered at peer.&amp;quot;);
        //If the instance has been assigned prior to db_discovery, assign the db_handles
        if (p_rfid_c-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID)
        {
            if ((p_rfid_c-&amp;gt;peer_rfid_db.sensors_frame_handle      == BLE_GATT_HANDLE_INVALID)&amp;amp;&amp;amp;
                (p_rfid_c-&amp;gt;peer_rfid_db.sensors_frame_cccd_handle == BLE_GATT_HANDLE_INVALID))
            {
                p_rfid_c-&amp;gt;peer_rfid_db = evt.params.peer_db;
            }
        }

        p_rfid_c-&amp;gt;evt_handler(p_rfid_c, &amp;amp;evt);

    }
}&lt;/pre&gt;&lt;pre class="ui-code" data-mode="text"&gt;void relay_on_db_disc_evt(relay_c_t * p_relay_c, ble_db_discovery_evt_t const * p_evt)
{
    if(p_evt-&amp;gt;evt_type == 0)
    {
        NRF_LOG_INFO(&amp;quot;relay_on_db_disc_evt :&amp;quot;);
        NRF_LOG_INFO(&amp;quot;\tp_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : %d&amp;quot;,p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE);
        NRF_LOG_INFO(&amp;quot;\tp_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID : %d&amp;quot;,p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID);
        NRF_LOG_INFO(&amp;quot;\tp_evt-&amp;gt;params.discovered_db.srv_uuid.type : %d\t\t\tp_relay_c-&amp;gt;uuid_type : %d&amp;quot;,p_evt-&amp;gt;params.discovered_db.srv_uuid.type,p_relay_c-&amp;gt;uuid_type);
    }    

    // Check if the Led Button Service was discovered.
    if (p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE &amp;amp;&amp;amp;
        p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID &amp;amp;&amp;amp;
        p_evt-&amp;gt;params.discovered_db.srv_uuid.type == p_relay_c-&amp;gt;uuid_type)
    {
        relay_c_evt_t evt;

        evt.evt_type    = RELAY_C_EVT_DISCOVERY_COMPLETE;
        evt.conn_handle = p_evt-&amp;gt;conn_handle;

        for (uint32_t i = 0; i &amp;lt; p_evt-&amp;gt;params.discovered_db.char_count; i++)
        {
            //NRF_LOG_INFO(&amp;quot;Discovering characteristics.&amp;quot;);
            const ble_gatt_db_char_t * p_char = &amp;amp;(p_evt-&amp;gt;params.discovered_db.charateristics[i]);
            switch (p_char-&amp;gt;characteristic.uuid.uuid)
            {
                case BLACKLIST_CHAR_UUID:
                    evt.params.peer_db.blacklist_handle      = p_char-&amp;gt;characteristic.handle_value;
                    evt.params.peer_db.blacklist_cccd_handle = p_char-&amp;gt;cccd_handle;
                    break;
                case TRAME_CONCENTRATEUR_CHAR_UUID:
                    evt.params.peer_db.trame_concentrateur_handle     = p_char-&amp;gt;characteristic.handle_value;
                    break;
                default:
                    break;
            }
        }
        //NRF_LOG_INFO(&amp;quot;RELAY Service discovered at peer.&amp;quot;);
        //If the instance has been assigned prior to db_discovery, assign the db_handles
        if (p_relay_c-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID)
        {
            if ((p_relay_c-&amp;gt;peer_relay_db.blacklist_handle      == BLE_GATT_HANDLE_INVALID)&amp;amp;&amp;amp;
                (p_relay_c-&amp;gt;peer_relay_db.blacklist_cccd_handle == BLE_GATT_HANDLE_INVALID))
            {
                p_relay_c-&amp;gt;peer_relay_db = evt.params.peer_db;
            }
        }
        p_relay_c-&amp;gt;evt_handler(p_relay_c, &amp;amp;evt);
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You were right, it seems like the problem is coming from the uuid_type, I get this :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: ------------------------------------------------------------------------------------------
&amp;lt;info&amp;gt; app: -------------------------------------Concentrator-----------------------------------------
&amp;lt;info&amp;gt; app: ------------------------------------------------------------------------------------------
&amp;lt;info&amp;gt; app: Scanning for RFID and RELAY.
&amp;lt;info&amp;gt; app: &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;RFID found&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
&amp;lt;info&amp;gt; app: Connection 0x0 established, attempt to find RFID or RELAY
&amp;lt;info&amp;gt; app: rfid_on_db_disc_evt :
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RFID_UUID : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.type : 2			p_rfid_c-&amp;gt;uuid_type : 2
&amp;lt;info&amp;gt; app: **********RFID service discovered on conn_handle 0x0**********
&amp;lt;info&amp;gt; app: Scanning for RFID and RELAY.
&amp;lt;info&amp;gt; app: relay_on_db_disc_evt :
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.type : 2			p_relay_c-&amp;gt;uuid_type : 3
&amp;lt;info&amp;gt; app: &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;RFID found&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
&amp;lt;info&amp;gt; app: Connection 0x1 established, attempt to find RFID or RELAY
&amp;lt;info&amp;gt; app: rfid_on_db_disc_evt :
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RFID_UUID : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.type : 2			p_rfid_c-&amp;gt;uuid_type : 2
&amp;lt;info&amp;gt; app: **********RFID service discovered on conn_handle 0x1**********
&amp;lt;info&amp;gt; app: Scanning for RFID and RELAY.
&amp;lt;info&amp;gt; app: relay_on_db_disc_evt :
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.type : 2			p_relay_c-&amp;gt;uuid_type : 21
&amp;lt;info&amp;gt; app: &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;RELAY found&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
&amp;lt;info&amp;gt; app: Connection 0x2 established, attempt to find RFID or RELAY
&amp;lt;info&amp;gt; app: rfid_on_db_disc_evt :
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RFID_UUID : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.type : 3			p_rfid_c-&amp;gt;uuid_type : 2
&amp;lt;info&amp;gt; app: relay_on_db_disc_evt :
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID : 1
&amp;lt;info&amp;gt; app: 	p_evt-&amp;gt;params.discovered_db.srv_uuid.type : 3			p_relay_c-&amp;gt;uuid_type : 178
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will send you my source code in a private message.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(P:\Nordic\)&amp;nbsp;was the folder where I put SDK 15 and SDK 15.3.&amp;nbsp; (Now it is&amp;nbsp;C:/Dev/nordic/)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You have to put&amp;nbsp;these two SDK in the folder of your choice and replace the path by the path of the folder you choosed.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I use SDK 15 but there is a exception.&amp;nbsp;Only for the ble_db_discovery module, I use the SDK 15.3&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;I did this in my .emProject file :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;...

c_user_include_directories= &amp;quot;... ;C:/Dev/nordic/nRF5_SDK_15.3.0_59ac345/components/ble/ble_db_discovery; ... &amp;quot;
...
&amp;lt;folder Name=&amp;quot;nRF_BLE&amp;quot;&amp;gt;
&amp;lt;file file_name=&amp;quot;C:/Dev/nordic/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_advdata.c&amp;quot; /&amp;gt;
&amp;lt;file file_name=&amp;quot;C:/Dev/nordic/nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising/ble_advertising.c&amp;quot; /&amp;gt;
&amp;lt;file file_name=&amp;quot;C:/Dev/nordic/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_conn_state.c&amp;quot; /&amp;gt;
&amp;lt;file file_name=&amp;quot;C:/Dev/nordic/nRF5_SDK_15.3.0_59ac345/components/ble/ble_db_discovery/ble_db_discovery.c&amp;quot; /&amp;gt;
&amp;lt;file file_name=&amp;quot;C:/Dev/nordic/nRF5_SDK_15.0.0_a53641a/components/ble/common/ble_srv_common.c&amp;quot; /&amp;gt;
&amp;lt;file file_name=&amp;quot;C:/Dev/nordic/nRF5_SDK_15.0.0_a53641a/components/ble/nrf_ble_gatt/nrf_ble_gatt.c&amp;quot; /&amp;gt;
&amp;lt;/folder&amp;gt;
...&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/195568?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 09:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1711deb1-ff1e-4d8e-a47e-e97c3fb745d7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jules,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think we are getting close, now the problem is around why&amp;nbsp;relay_on_db_disc_evt() (or&amp;nbsp;rfid_on_db_disc_evt() ) wouldn&amp;#39;t detect when there is an UUID match (evt_type = 0 ).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is a following check:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; if (p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE &amp;amp;&amp;amp;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == RELAY_UUID &amp;amp;&amp;amp;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; p_evt-&amp;gt;params.discovered_db.srv_uuid.type == p_relay_c-&amp;gt;uuid_type)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I suspect it could be something wrong with the uuid_type. If you can print out those values in the log, we may be able to find why the function is called but not executing anything.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We can try to test here and debug your application as well. But it doesn&amp;#39;t built here. There is some absolute path you set (P:\Nordic\)&lt;/p&gt;
&lt;p&gt;If possible please send the latest source code. Are you still on SDK v15.0 or you moved to SDK v15.3 ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/195405?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2019 14:29:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ca11f3f-57be-40ad-a0ba-2e0b2bacf221</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;&lt;span style="font-weight:400;"&gt;Hi Hung Bui,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Thank you for your help.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;For the ble_app_hrs_rscs_relay example :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I have tried to start scanning after the discovery is complete and it works. I can&amp;rsquo;t find the issue anymore.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;For my code :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;The two custom services have the same 16 bits UUID but not the same base UUID.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I was thinking it was possible to do this but maybe it&amp;rsquo;s a misunderstanding?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;This is the definition of the UUIDs for my custom service &amp;ldquo;RELAY&amp;rdquo; :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561730891782v1.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;This is the definition of the UUIDs for my custom service &amp;ldquo;RFID&amp;rdquo; :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561730919410v2.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;These are the structures I use in my main.c :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561730949175v3.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;This is in my sdk_config.h :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561730974655v4.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I added NRF_LOG_DEBUG() in&amp;nbsp;discovery_complete_evt_trigger() :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief     Function for triggering a Discovery Complete or Service Not Found event to the
 *            application.
 *
 * @details   This function will fetch the event handler based on the UUID of the service being
 *            discovered. (The event handler is registered by the application beforehand).
 *            It then triggers an event indicating the completion of the service discovery.
 *            If no event handler was found, then this function will do nothing.
 *
 * @param[in] p_db_discovery Pointer to the DB discovery structure.
 * @param[in] is_srv_found   Variable to indicate if the service was found at the peer.
 * @param[in] conn_handle    Connection Handle.
 */
static void discovery_complete_evt_trigger(ble_db_discovery_t * p_db_discovery,
                                           bool                 is_srv_found,
                                           uint16_t             conn_handle)
{
    ble_db_discovery_evt_handler_t   p_evt_handler;
    ble_gatt_db_srv_t              * p_srv_being_discovered;

    p_srv_being_discovered = &amp;amp;(p_db_discovery-&amp;gt;services[p_db_discovery-&amp;gt;curr_srv_ind]);

    NRF_LOG_DEBUG(&amp;quot;m_num_of_handlers_reg = %d&amp;quot;,m_num_of_handlers_reg);
    NRF_LOG_DEBUG(&amp;quot;m_pending_usr_evt_index = %d&amp;quot;,m_pending_usr_evt_index);

    p_evt_handler = registered_handler_get(&amp;amp;(p_srv_being_discovered-&amp;gt;srv_uuid));

    if (p_evt_handler != NULL)
    {
        if (m_pending_usr_evt_index &amp;lt; DB_DISCOVERY_MAX_USERS)
        {
            // Insert an event into the pending event list.
            m_pending_user_evts[m_pending_usr_evt_index].evt.conn_handle = conn_handle;
            m_pending_user_evts[m_pending_usr_evt_index].evt.params.discovered_db =
                *p_srv_being_discovered;

            if (is_srv_found)
            {
                m_pending_user_evts[m_pending_usr_evt_index].evt.evt_type =
                    BLE_DB_DISCOVERY_COMPLETE;
            }
            else
            {
                m_pending_user_evts[m_pending_usr_evt_index].evt.evt_type =
                    BLE_DB_DISCOVERY_SRV_NOT_FOUND;
            }

            m_pending_user_evts[m_pending_usr_evt_index].evt_handler = p_evt_handler;
            m_pending_usr_evt_index++;

            NRF_LOG_DEBUG(&amp;quot;m_pending_usr_evt_index = %d&amp;quot;,m_pending_usr_evt_index);

            if (m_pending_usr_evt_index == m_num_of_handlers_reg)
            {
                // All registered modules have pending events. Send all pending events to the user
                // modules.
                pending_user_evts_send();
            }
            else
            {
                // Too many events pending. Do nothing. (Ideally this should not happen.)
            }
        }
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Now we will see m_num_of_handlers_reg and&amp;nbsp;m_pending_usr_evt_index in the logs.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I observed that even for the last service discovery which don&amp;#39;t work, m_num_of_handlers_reg is equal to m_pending_usr_evt_index so the function pending_user_evts_send() should be called.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;span&gt;I added NRF_LOG_DEBUG() in&amp;nbsp;pending_user_evts_send() to see which event type is passed to the event handler :&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for sending all pending discovery events to the corresponding user modules.
 */
static void pending_user_evts_send(void)
{
    for (uint32_t i = 0; i &amp;lt; m_num_of_handlers_reg; i++)
    {
        
        NRF_LOG_DEBUG(&amp;quot;m_pending_user_evts[i].evt = %d&amp;quot;,m_pending_user_evts[i].evt.evt_type);

        // Pass the event to the corresponding event handler.
        m_pending_user_evts[i].evt_handler(&amp;amp;(m_pending_user_evts[i].evt));
    }

    m_pending_usr_evt_index = 0;
}&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Here is an example of the logs when I don&amp;#39;t get the event EVT_DISCOVERY_COMPLETE :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: ------------------------------------------------------------------------------------------
&amp;lt;info&amp;gt; app: -------------------------------------Concentrator-----------------------------------------
&amp;lt;info&amp;gt; app: ------------------------------------------------------------------------------------------
&amp;lt;info&amp;gt; app: Scanning for RFID and RELAY.
&amp;lt;info&amp;gt; app: &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;RFID found&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
&amp;lt;info&amp;gt; app: Connection 0x0 established, attempt to find RFID or RELAY
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x0.
&amp;lt;debug&amp;gt; ble_db_disc: Found service UUID 0x1.
&amp;lt;debug&amp;gt; ble_db_disc: Discovery of service with UUID 0x1 completed with success on connection handle 0x0.
&amp;lt;debug&amp;gt; ble_db_disc: m_num_of_handlers_reg = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 0
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 1
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x0.
&amp;lt;debug&amp;gt; ble_db_disc: Service UUID 0x1 not found.
&amp;lt;debug&amp;gt; ble_db_disc: m_num_of_handlers_reg = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 1
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_user_evts[i].evt.evt_type = 0
&amp;lt;info&amp;gt; app: **********RFID service discovered on conn_handle 0x0**********
&amp;lt;info&amp;gt; app: Scanning for RFID and RELAY.
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_user_evts[i].evt.evt_type = 2
&amp;lt;info&amp;gt; app: &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;RFID found&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
&amp;lt;info&amp;gt; app: Connection 0x1 established, attempt to find RFID or RELAY
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x1.
&amp;lt;debug&amp;gt; ble_db_disc: Found service UUID 0x1.
&amp;lt;debug&amp;gt; ble_db_disc: Discovery of service with UUID 0x1 completed with success on connection handle 0x1.
&amp;lt;debug&amp;gt; ble_db_disc: m_num_of_handlers_reg = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 0
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 1
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x1.
&amp;lt;debug&amp;gt; ble_db_disc: Service UUID 0x1 not found.
&amp;lt;debug&amp;gt; ble_db_disc: m_num_of_handlers_reg = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 1
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_user_evts[i].evt.evt_type = 0
&amp;lt;info&amp;gt; app: **********RFID service discovered on conn_handle 0x1**********
&amp;lt;info&amp;gt; app: Scanning for RFID and RELAY.
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_user_evts[i].evt.evt_type = 2
&amp;lt;info&amp;gt; app: &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;RELAY found&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;
&amp;lt;info&amp;gt; app: Connection 0x2 established, attempt to find RFID or RELAY
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x2.
&amp;lt;debug&amp;gt; ble_db_disc: Service UUID 0x1 not found.
&amp;lt;debug&amp;gt; ble_db_disc: m_num_of_handlers_reg = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 0
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 1
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x2.
&amp;lt;debug&amp;gt; ble_db_disc: Found service UUID 0x1.
&amp;lt;debug&amp;gt; ble_db_disc: Discovery of service with UUID 0x1 completed with success on connection handle 0x2.
&amp;lt;debug&amp;gt; ble_db_disc: m_num_of_handlers_reg = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 1
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_usr_evt_index = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_user_evts[i].evt.evt_type = 2
&amp;lt;debug&amp;gt; ble_db_disc: m_pending_user_evts[i].evt.evt_type = 0&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Now, I don&amp;#39;t really understand what is going wrong.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/195204?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 15:30:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c01b8258-0fe8-49e2-9613-a473adb29e3a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jules,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I believe the issue&amp;nbsp;of&amp;nbsp;the&amp;nbsp;&lt;span&gt;ble_app_hrs_rscs_relay can be solved by starting scan after the service has been discovered (like in your code) it must be related to the issue when 2 service discovery was performed at the same time. I attached the main.c that i modified to do what similar to your code. Could you have a quick test to see if you have the same issue ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-3c362edca15b4aac9d3448c48fb4a546/main.c"&gt;devzone.nordicsemi.com/.../main.c&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In your code, you already fixed the issue. So there could be a different bug.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;First could you explain why&amp;nbsp;in your log, both of the service was&amp;nbsp;with &amp;quot;UUID 0x1&amp;quot; ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As you already noticed, from the log we can see that the service and characteristic discovery was finished but you didn&amp;#39;t get the&amp;nbsp;EVT_DISCOVERY_COMPLETE event in the the handler in main.c&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We need to debug this. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We print &amp;quot;Discovery of service with UUID 0x%x completed with success&amp;quot; inside&amp;nbsp;on_descriptor_discovery_rsp() and then we call&amp;nbsp;discovery_complete_evt_trigger()&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Inside discovery_complete_evt_trigger(), we will collect the events until&amp;nbsp;they match with the number of handler (m_num_of_handlers_reg) and then we will send out to each handlers in main.c&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We will not send the event(s) out if the number of queued event is still lower than the&amp;nbsp;m_num_of_handlers_reg.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you try printing out some debug log inside&amp;nbsp;discovery_complete_evt_trigger() ? I suspect that&amp;nbsp;pending_user_evts_send() is not called when it should be called.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/194922?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 14:28:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ade40100-a576-43ac-8b58-c7cc22b690db</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;&lt;span style="font-weight:400;"&gt;Hi, thank you for your answer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I don&amp;#39;t know if this info can be useful but for my hardware I use 2 nRF52840DK and 2 BMD-340-EVAL.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;My code :&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I use now the db_discovery library from SDK v15.3.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I did the following tests with one central and 2 RFID peripheral and 1 RELAY peripheral.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;With my code I get the issue 1 time for 2 try.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;This is an example of when it works :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img height="277" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561559074800v1.png" width="376" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;The discovery works and then I get the event &amp;ldquo;RFID_C_EVT_DISCOVERY_COMPLETE&amp;rdquo; and start scanning again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;This is an example of when it doesn&amp;rsquo;t work :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561559127469v2.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;According to the DEBUG logs, it seems that the discovery is successful. But I don&amp;rsquo;t get the event &amp;ldquo;RELAY_C_EVT_DISCOVERY_COMPLETE&amp;rdquo;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I can&amp;rsquo;t reproduce the issue when I use only one peripheral.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example code (SDK 15.3) :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;For the following test I use 1 ble_app_hrs_rscs_relay, 1 ble_app_hrs and 1 ble_app_rscs.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;span style="font-weight:400;"&gt;I had to try at least 15 time to reproduce the issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Example of only the HRS service has been discovered :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img height="355" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561559249876v3.png" width="268" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;img height="288" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1561559298395v4.png" width="269" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Here we have the connection handle 0x0 and 0x1 but only one service is discovered.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;I can&amp;rsquo;t reproduce the issue when I use only one peripheral.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/194859?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 11:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:101a3861-8643-4025-ba4d-31721bc83996</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi JCombes,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m testing here with the ble_app_hrs_rcsc_relay and couldn&amp;#39;t reproduce the issue. How often do you see the issue ?&amp;nbsp;&lt;br /&gt;Could you increase the log level to DEBUG level so we can see more information ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I suspect it&amp;#39;s the issue when you connect 2 device at the same time and before the service can be found on one device the other device start new service discovery. But it should not be the case if you wait until the first device finish and start the second one.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you check if you can reproduce the issue either on&amp;nbsp;&lt;span&gt;ble_app_hrs_rcsc_relay or in your code if you test with only one peripheral ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In addition, I would strongly suggest to use the db_discovery library from SDK v15.3 we fixed an issue with characteristic discovery inside the db_discovery module. You don&amp;#39;t have to move to SDK v15.3 , just need to use the db_discovery library in SDK v15.3&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/193463?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2019 14:03:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24ba5a87-8d4a-495a-bf50-afd399e17fc8</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;I looked at the ble_app_hrs_rscs_relay exemple but for SDK 15.0 beacause it is the SDK I was using for my project. The service discovery look similar to my projects.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I used this project with the ble_app_hrs and ble_app_rscs examples to test the following scenario :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Peripherals&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Relay (central)&lt;br /&gt;+----------+&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; +-------------+&lt;br /&gt;| Heart&amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Heart&amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp;&lt;br /&gt;| Rate&amp;nbsp;&amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp;-----&amp;gt;&amp;nbsp; &amp;nbsp;| Rate&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;br /&gt;| Sensor |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Collector |&amp;nbsp;&lt;br /&gt;+----------+&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; +-------------+&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Running&amp;nbsp; |&lt;br /&gt;+-----------+&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Speed&amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;br /&gt;| Running|&amp;nbsp; &amp;nbsp;------&amp;gt;| Collector |&amp;nbsp;&lt;br /&gt;| Speed&amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; +-------------+&lt;br /&gt;| Sensor&amp;nbsp; |&lt;br /&gt;+-----------+&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I found that there are some case with this example where it don&amp;#39;t work neither. It is less frequent but sometimes the relay does not discover the HRS or the RSCS service.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For example, in this case the relay discovered only the&amp;nbsp;HRS service :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1560866135631v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Edit : I tried with the example ble_app_hrs_rcsc_relay of the SDK 15.3 too and I found the same problem. Sometimes one service is not discovered during the service discovery, did you found this too? Do you have other suggestions? Did you saw my private ticket?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/193176?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 12:34:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb52f0e8-4afd-4f33-8ab0-9e91953ed5fe</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi, I just created a private ticket with a link to download the whole project.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m going to&amp;nbsp;look at&amp;nbsp;&lt;span&gt;ble_app_hrs_rscs_relay, thank you for the advice.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/192961?ContentTypeID=1</link><pubDate>Fri, 14 Jun 2019 14:12:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eec5a277-2ea8-41e3-b4ad-9b3feff1e1ec</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the late answer. You can create a private ticket and upload your project there.&lt;/p&gt;
&lt;p&gt;Edit: I am afraid I cannot really see what you are doing wrong based on main.c. Have you tried to compare your solution against the nRF5_SDK_15.3.0_59ac345\examples\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay example? this example is a client to both HRS and RSCS so it should handle discovery in the same way you application has to do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/190579?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2019 14:56:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fa7ee5c-662a-457b-acef-ef7a0d393d37</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have&amp;nbsp;4 discovery module instances,&amp;nbsp;1 relay instance and&amp;nbsp;3 rfid instance.&lt;/p&gt;
&lt;p&gt;I use &amp;quot;ble_db_discovery_start()&amp;quot; on one instance of the discovery module &amp;quot;&amp;amp;m_db_disc[p_gap_evt-&amp;gt;conn_handle]&amp;quot; in the BLE event handler in case BLE_GAP_EVT_CONNECTED (line313).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is the main.c of my central :&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_sdh_ble.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;bsp_btn_ble.h&amp;quot;
#include &amp;quot;ble.h&amp;quot;
#include &amp;quot;ble_hci.h&amp;quot;
#include &amp;quot;ble_advdata.h&amp;quot;
#include &amp;quot;ble_advertising.h&amp;quot;
#include &amp;quot;ble_conn_params.h&amp;quot;
#include &amp;quot;ble_db_discovery.h&amp;quot;
#include &amp;quot;ble_conn_state.h&amp;quot;
#include &amp;quot;nrf_ble_gatt.h&amp;quot;
#include &amp;quot;nrf_pwr_mgmt.h&amp;quot;

#include &amp;quot;peer_manager.h&amp;quot;
#include &amp;quot;fds.h&amp;quot;

#include &amp;quot;rfid_c.h&amp;quot;
#include &amp;quot;relay_c.h&amp;quot;

#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;


#define APP_BLE_CONN_CFG_TAG      1                                     /**&amp;lt; A tag that refers to the BLE stack configuration we set with @ref sd_ble_cfg_set. Default tag is @ref APP_BLE_CONN_CFG_TAG. */
#define APP_BLE_OBSERVER_PRIO     3                                     /**&amp;lt; Application&amp;#39;s BLE observer priority. You shouldn&amp;#39;t need to modify this value. */

#define SEC_PARAM_BOND              1                                   /**&amp;lt; Perform bonding. */
#define SEC_PARAM_MITM              0                                   /**&amp;lt; Man In The Middle protection not required. */
#define SEC_PARAM_LESC              0                                   /**&amp;lt; LE Secure Connections not enabled. */
#define SEC_PARAM_KEYPRESS          0                                   /**&amp;lt; Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES   BLE_GAP_IO_CAPS_NONE                /**&amp;lt; No I/O capabilities. */
#define SEC_PARAM_OOB               0                                   /**&amp;lt; Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE      7                                   /**&amp;lt; Minimum encryption key size in octets. */
#define SEC_PARAM_MAX_KEY_SIZE      16                                  /**&amp;lt; Maximum encryption key size in octets. */

#define CENTRAL_SCANNING_LED      BSP_BOARD_LED_0
#define CENTRAL_CONNECTED_LED     BSP_BOARD_LED_1
#define LEDBUTTON_LED             BSP_BOARD_LED_2                       /**&amp;lt; LED to indicate a change of state of the the Button characteristic on the peer. */

#define MEASURE_REQUEST_1_BUTTON     BSP_BUTTON_0//we will not need these buttons for the final version
#define MEASURE_REQUEST_2_BUTTON     BSP_BUTTON_1
#define MEASURE_REQUEST_3_BUTTON     BSP_BUTTON_2

#define LEDBUTTON_BUTTON          BSP_BUTTON_0                          /**&amp;lt; Button that will write to the LED characteristic of the peer. */
#define BUTTON_DETECTION_DELAY    APP_TIMER_TICKS(50)                   /**&amp;lt; Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks). */

#define SCAN_INTERVAL             0x00A0                                /**&amp;lt; Determines scan interval in units of 0.625 millisecond. */
#define SCAN_WINDOW               0x00A0                                /**&amp;lt; Determines scan window in units of 0.625 millisecond. */
#define SCAN_DURATION             0x0000                                /**&amp;lt; Duration of the scanning in units of 10 milliseconds. If set to 0x0000, scanning will continue until it is explicitly disabled. */

#define MIN_CONNECTION_INTERVAL   MSEC_TO_UNITS(99, UNIT_1_25_MS)       /**&amp;lt; Determines minimum connection interval in milliseconds. */
#define MAX_CONNECTION_INTERVAL   MSEC_TO_UNITS(100, UNIT_1_25_MS)      /**&amp;lt; Determines maximum connection interval in milliseconds. */
#define SLAVE_LATENCY             0                                     /**&amp;lt; Determines slave latency in terms of connection events. */
#define SUPERVISION_TIMEOUT       MSEC_TO_UNITS(4000, UNIT_10_MS)       /**&amp;lt; Determines supervision time-out in units of 10 milliseconds. */

#define RFID_COUNT                3                                     //number of relay clients
#define RELAY_COUNT               1                                     //number of RFID clients
#define DB_DISC_COUNT             4                                     //number of discovery module, 1 for each peripheral

NRF_BLE_GATT_DEF(m_gatt);                                               /**&amp;lt; GATT module instance. */
RFID_C_ARRAY_DEF(m_rfid_c, RFID_COUNT);                                 /**&amp;lt; RFID service client instances. */
RELAY_C_ARRAY_DEF(m_relay_c, RELAY_COUNT);                              /**&amp;lt; RELAY service client instance. */
BLE_DB_DISCOVERY_ARRAY_DEF(m_db_disc, DB_DISC_COUNT);                   /**&amp;lt; Database discovery module instances. */ 

/**&amp;lt; Name of the devices we try to connect to. These names are searched for in the scan report data*/
static char const m_target_periph_RFID_name[] = &amp;quot;RFID&amp;quot;;             
static char const m_target_IHMI_relay_name[] = &amp;quot;RELAY&amp;quot;;

static uint8_t m_scan_buffer_data[BLE_GAP_SCAN_BUFFER_MIN]; /**&amp;lt; buffer where advertising reports will be stored by the SoftDevice. */

uint8_t cptButtonEvent=0;
uint8_t measure_request[2]={0xFF,0xFF};

//Pour les UUID custom, faire bien attetntion au quel on a d&amp;#233;clar&amp;#233; en premier pour savoir si il s&amp;#39;agit de BEGIN ou BEGIN+1
ble_uuid_t rfid_uuid = {RFID_UUID, BLE_UUID_TYPE_VENDOR_BEGIN};
ble_uuid_t relay_uuid = {RELAY_UUID, BLE_UUID_TYPE_VENDOR_BEGIN+1};

/**@brief Pointer to the buffer where advertising reports will be stored by the SoftDevice. */
static ble_data_t m_scan_buffer =
{
    m_scan_buffer_data,
    BLE_GAP_SCAN_BUFFER_MIN
};

/**@brief Scan parameters requested for scanning and connection. */
static ble_gap_scan_params_t const m_scan_params =
{
    .active   = 0,
    .interval = SCAN_INTERVAL,
    .window   = SCAN_WINDOW,

    .timeout           = SCAN_DURATION,
    .scan_phys         = BLE_GAP_PHY_1MBPS,
    .filter_policy     = BLE_GAP_SCAN_FP_ACCEPT_ALL,

};

/**@brief Connection parameters requested for connection. */
static ble_gap_conn_params_t const m_connection_param =
{
    (uint16_t)MIN_CONNECTION_INTERVAL,
    (uint16_t)MAX_CONNECTION_INTERVAL,
    (uint16_t)SLAVE_LATENCY,
    (uint16_t)SUPERVISION_TIMEOUT
};

static void scan_start(void);

/**@brief Function to handle asserts in the SoftDevice.
 *
 * @details This function will be called in case of an assert in the SoftDevice.
 *
 * @warning This handler is an example only and does not fit a final product. You need to analyze
 *          how your product is supposed to react in case of Assert.
 * @warning On assert from the SoftDevice, the system can only recover on reset.
 *
 * @param[in] line_num     Line number of the failing ASSERT call.
 * @param[in] p_file_name  File name of the failing ASSERT call.
 */
void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
{
    app_error_handler(0xDEADBEEF, line_num, p_file_name);
}


/**@brief Function for handling database discovery events.
 *
 * @details This function is callback function to handle events from the database discovery module.
 *          Depending on the UUIDs that are discovered, this function should forward the events
 *          to their respective services.
 *
 * @param[in] p_event  Pointer to the database discovery event.
 */
static void db_disc_handler(ble_db_discovery_evt_t * p_evt)
{
    NRF_LOG_INFO(&amp;quot;Discovery handler for conn_handle 0x%x\tp_evt-&amp;gt;evt-type : %d&amp;quot;, p_evt-&amp;gt;conn_handle, p_evt-&amp;gt;evt_type);
    rfid_on_db_disc_evt(&amp;amp;m_rfid_c[p_evt-&amp;gt;conn_handle], p_evt);
    relay_on_db_disc_evt(&amp;amp;m_relay_c[p_evt-&amp;gt;conn_handle], p_evt);
}


/**@brief Function for handling Peer Manager events.
 *
 * @param[in] p_evt  Peer Manager event.
 */
/*
static void pm_evt_handler(pm_evt_t const * p_evt)
{
    ret_code_t err_code;

    switch (p_evt-&amp;gt;evt_id)
    {
        case PM_EVT_BONDED_PEER_CONNECTED:
        {
            NRF_LOG_INFO(&amp;quot;Connected to a previously bonded device.&amp;quot;);
        } break;

        case PM_EVT_CONN_SEC_SUCCEEDED:
        {
            NRF_LOG_INFO(&amp;quot;Connection secured: role: %d, conn_handle: 0x%x, procedure: %d.&amp;quot;,
                         ble_conn_state_role(p_evt-&amp;gt;conn_handle),
                         p_evt-&amp;gt;conn_handle,
                         p_evt-&amp;gt;params.conn_sec_succeeded.procedure);
        } break;

        case PM_EVT_CONN_SEC_FAILED:
        {
*/
            /* Often, when securing fails, it shouldn&amp;#39;t be restarted, for security reasons.
             * Other times, it can be restarted directly.
             * Sometimes it can be restarted, but only after changing some Security Parameters.
             * Sometimes, it cannot be restarted until the link is disconnected and reconnected.
             * Sometimes it is impossible, to secure the link, or the peer device does not support it.
             * How to handle this error is highly application dependent. */
/*
        } break;

        case PM_EVT_CONN_SEC_CONFIG_REQ:
        {
            // Reject pairing request from an already bonded peer.
            pm_conn_sec_config_t conn_sec_config = {.allow_repairing = false};
            pm_conn_sec_config_reply(p_evt-&amp;gt;conn_handle, &amp;amp;conn_sec_config);
        } break;

        case PM_EVT_STORAGE_FULL:
        {
            // Run garbage collection on the flash.
            err_code = fds_gc();
            if (err_code == FDS_ERR_NO_SPACE_IN_QUEUES)
            {
                // Retry.
            }
            else
            {
                APP_ERROR_CHECK(err_code);
            }
        } break;

        case PM_EVT_PEERS_DELETE_SUCCEEDED:
        {
            // Bonds are deleted. Start scanning.
            scan_start();
        } break;

        case PM_EVT_PEER_DATA_UPDATE_FAILED:
        {
            // Assert.
            APP_ERROR_CHECK(p_evt-&amp;gt;params.peer_data_update_failed.error);
        } break;

        case PM_EVT_PEER_DELETE_FAILED:
        {
            // Assert.
            APP_ERROR_CHECK(p_evt-&amp;gt;params.peer_delete_failed.error);
        } break;

        case PM_EVT_PEERS_DELETE_FAILED:
        {
            // Assert.
            APP_ERROR_CHECK(p_evt-&amp;gt;params.peers_delete_failed_evt.error);
        } break;

        case PM_EVT_ERROR_UNEXPECTED:
        {
            // Assert.
            APP_ERROR_CHECK(p_evt-&amp;gt;params.error_unexpected.error);
        } break;

        case PM_EVT_CONN_SEC_START:
        case PM_EVT_PEER_DATA_UPDATE_SUCCEEDED:
        case PM_EVT_PEER_DELETE_SUCCEEDED:
        case PM_EVT_LOCAL_DB_CACHE_APPLIED:
        case PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED:
            // This can happen when the local DB has changed.
        case PM_EVT_SERVICE_CHANGED_IND_SENT:
        case PM_EVT_SERVICE_CHANGED_IND_CONFIRMED:
        default:
            break;
    }
}
*/


/**@brief Function for handling the advertising report BLE event.
 *
 * @param[in] p_adv_report  Advertising report from the SoftDevice.
 */
static void on_adv_report(ble_gap_evt_adv_report_t const * p_adv_report)
{
    ret_code_t err_code;
    
    if (ble_advdata_name_find(p_adv_report-&amp;gt;data.p_data, p_adv_report-&amp;gt;data.len, m_target_periph_RFID_name)&amp;amp;&amp;amp;ble_advdata_uuid_find(p_adv_report-&amp;gt;data.p_data, p_adv_report-&amp;gt;data.len, &amp;amp;rfid_uuid))
    {//name found
        if(ble_advdata_uuid_find(p_adv_report-&amp;gt;data.p_data, p_adv_report-&amp;gt;data.len, &amp;amp;rfid_uuid))
        {//custom uuid found
            NRF_LOG_INFO(&amp;quot;RFID peripheral found&amp;quot;);
            err_code = sd_ble_gap_connect(&amp;amp;p_adv_report-&amp;gt;peer_addr, &amp;amp;m_scan_params, &amp;amp;m_connection_param,APP_BLE_CONN_CFG_TAG);
            if (err_code != NRF_SUCCESS)
            {
                NRF_LOG_ERROR(&amp;quot;Connection Request Failed, reason %d&amp;quot;, err_code);
            }
        }
    }
    else if(ble_advdata_name_find(p_adv_report-&amp;gt;data.p_data, p_adv_report-&amp;gt;data.len, m_target_IHMI_relay_name)&amp;amp;&amp;amp;ble_advdata_uuid_find(p_adv_report-&amp;gt;data.p_data, p_adv_report-&amp;gt;data.len, &amp;amp;relay_uuid))
    {//name found
        if(ble_advdata_uuid_find(p_adv_report-&amp;gt;data.p_data, p_adv_report-&amp;gt;data.len, &amp;amp;relay_uuid))
        {//custom uuid found
            NRF_LOG_INFO(&amp;quot;IHMI relay found&amp;quot;);
            err_code = sd_ble_gap_connect(&amp;amp;p_adv_report-&amp;gt;peer_addr, &amp;amp;m_scan_params, &amp;amp;m_connection_param,APP_BLE_CONN_CFG_TAG);
            if (err_code != NRF_SUCCESS)
            {
                NRF_LOG_ERROR(&amp;quot;Connection Request Failed, reason %d&amp;quot;, err_code);
            }
        }
    }
    else
    {
        //NRF_LOG_INFO(&amp;quot;No connection established, scan starts again&amp;quot;);
        err_code = sd_ble_gap_scan_start(NULL, &amp;amp;m_scan_buffer);
        APP_ERROR_CHECK(err_code);
    }
}


/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code;

    // For readability.
    ble_gap_evt_t const * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        // Upon connection, check which peripheral has connected, initiate DB
        // discovery, update LEDs status and resume scanning if necessary.
        case BLE_GAP_EVT_CONNECTED:
        {
            NRF_LOG_INFO(&amp;quot;\tConnection 0x%x established, starting DB discovery.&amp;quot;, p_gap_evt-&amp;gt;conn_handle);

            APP_ERROR_CHECK_BOOL(p_gap_evt-&amp;gt;conn_handle &amp;lt; NRF_SDH_BLE_CENTRAL_LINK_COUNT);

            err_code = ble_db_discovery_start(&amp;amp;m_db_disc[p_gap_evt-&amp;gt;conn_handle], p_gap_evt-&amp;gt;conn_handle);
            APP_ERROR_CHECK(err_code);
            if (err_code != NRF_ERROR_BUSY)
            {
                APP_ERROR_CHECK(err_code);
            }

            // Update LEDs status, and check if we should be looking for more
            // peripherals to connect to.
            bsp_board_led_on(CENTRAL_CONNECTED_LED);

            /*//il faut attendre que le service soit d&amp;#233;couvert avant de relancer le start
            if (ble_conn_state_central_conn_count() == NRF_SDH_BLE_CENTRAL_LINK_COUNT)
            {
                bsp_board_led_off(CENTRAL_SCANNING_LED);
            }
            else
            {
                // Resume scanning.
                bsp_board_led_on(CENTRAL_SCANNING_LED);
                scan_start();
            }
            */
        } break; // BLE_GAP_EVT_CONNECTED

        // Upon disconnection, reset the connection handle of the peer which disconnected, update
        // the LEDs status and start scanning again.
        case BLE_GAP_EVT_DISCONNECTED:
        {
            NRF_LOG_INFO(&amp;quot;Central link 0x%x disconnected (reason: 0x%x)&amp;quot;,
                         p_gap_evt-&amp;gt;conn_handle,
                         p_gap_evt-&amp;gt;params.disconnected.reason);

            if (ble_conn_state_central_conn_count() == 0)
            {
                // Turn off connection indication LED
                bsp_board_led_off(CENTRAL_CONNECTED_LED);
            }

            // Start scanning
            scan_start();

            // Turn on LED for indicating scanning
            bsp_board_led_on(CENTRAL_SCANNING_LED);

        } break;

        case BLE_GAP_EVT_ADV_REPORT:
            on_adv_report(&amp;amp;p_gap_evt-&amp;gt;params.adv_report);
            break;

        case BLE_GAP_EVT_TIMEOUT:
        {
            // We have not specified a timeout for scanning, so only connection attemps can timeout.
            if (p_gap_evt-&amp;gt;params.timeout.src == BLE_GAP_TIMEOUT_SRC_CONN)
            {
                NRF_LOG_INFO(&amp;quot;Connection request timed out.&amp;quot;);
            }
        } break;

        case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
        {
            NRF_LOG_INFO(&amp;quot;BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST.&amp;quot;);
            // Accept parameters requested by peer.
            err_code = sd_ble_gap_conn_param_update(p_gap_evt-&amp;gt;conn_handle,
                                        &amp;amp;p_gap_evt-&amp;gt;params.conn_param_update_request.conn_params);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_INFO(&amp;quot;PHY update request.&amp;quot;);
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            };
            err_code = sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GATTC_EVT_TIMEOUT:
        {
            // Disconnect on GATT Client timeout event.
            NRF_LOG_INFO(&amp;quot;GATT Client Timeout.&amp;quot;);
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gattc_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GATTS_EVT_TIMEOUT:
        {
            // Disconnect on GATT Server timeout event.
            NRF_LOG_INFO(&amp;quot;GATT Server Timeout.&amp;quot;);
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
        } break;

        default:
            // No implementation needed.
            break;
    }
}


/**@brief Function for initializing the BLE stack.
 *
 * @details Initializes the SoftDevice and the BLE event interrupts.
 */
static void ble_stack_init(void)
{
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Register a handler for BLE events.
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}


/**@brief Function for the Peer Manager initialization.
 */
/*
static void peer_manager_init(void)
{
    ble_gap_sec_params_t sec_param;
    ret_code_t err_code;

    err_code = pm_init();
    APP_ERROR_CHECK(err_code);

    memset(&amp;amp;sec_param, 0, sizeof(ble_gap_sec_params_t));

    // Security parameters to be used for all security procedures.
    sec_param.bond           = SEC_PARAM_BOND;
    sec_param.mitm           = SEC_PARAM_MITM;
    sec_param.lesc           = SEC_PARAM_LESC;
    sec_param.keypress       = SEC_PARAM_KEYPRESS;
    sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
    sec_param.oob            = SEC_PARAM_OOB;
    sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
    sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
    sec_param.kdist_own.enc  = 1;
    sec_param.kdist_own.id   = 1;
    sec_param.kdist_peer.enc = 1;
    sec_param.kdist_peer.id  = 1;

    err_code = pm_sec_params_set(&amp;amp;sec_param);
    APP_ERROR_CHECK(err_code);

    err_code = pm_register(pm_evt_handler);
    APP_ERROR_CHECK(err_code);
}
*/


/** @brief Clear bonding information from persistent storage
 */
/*
static void delete_bonds(void)
{
    ret_code_t err_code;

    NRF_LOG_INFO(&amp;quot;Erase bonds!&amp;quot;);

    err_code = pm_peers_delete();
    APP_ERROR_CHECK(err_code);
}
*/


/**@brief Handles events coming from the RFID central module.
 */
static void rfid_c_evt_handler(rfid_c_t * p_rfid_c, rfid_c_evt_t * p_rfid_c_evt)
{
    switch (p_rfid_c_evt-&amp;gt;evt_type)
    {
        case RFID_C_EVT_DISCOVERY_COMPLETE:
        {
            ret_code_t err_code;

            NRF_LOG_INFO(&amp;quot;\t\tRFID SERVICE DISCOVERED on conn_handle 0x%x&amp;quot;, p_rfid_c_evt-&amp;gt;conn_handle);
            
            err_code = rfid_c_handles_assign( p_rfid_c, p_rfid_c_evt-&amp;gt;conn_handle, &amp;amp;p_rfid_c_evt-&amp;gt;params.peer_db);
            APP_ERROR_CHECK(err_code);

            // Initiate bonding.
            /*
            err_code = pm_conn_secure(p_bas_c_evt-&amp;gt;conn_handle, false);
            */
          
            //RFID service discovered. Enable notification of sensors_frame.
            err_code = rfid_c_sensors_frame_notif_and_indic_enable(p_rfid_c);
            APP_ERROR_CHECK(err_code);

            ///
            if (ble_conn_state_central_conn_count() == NRF_SDH_BLE_CENTRAL_LINK_COUNT)
            {
                bsp_board_led_off(CENTRAL_SCANNING_LED);
            }
            else
            {
                // Resume scanning.
                bsp_board_led_on(CENTRAL_SCANNING_LED);
                scan_start();
            }
            ///
        
        } break; // BLE_LBS_C_EVT_DISCOVERY_COMPLETE

        case RFID_C_EVT_SENSORS_FRAME_RECEIVED:
        {
            //we have to send sensors_frame to the relay
            //it&amp;#39;s here that we put functions to execute in case of receiving notifications, not in
            //rfic_c -&amp;gt; BLE_GATTC-EVT_HVX because it can come from another ble service
                  
        } break; // RFID_C_EVT_SENSORS_FRAME_RECEIVED

        default:
            // No implementation needed.
            break;
    }
}


/**@brief Handles events coming from the RELAY central module.
 */
static void relay_c_evt_handler(relay_c_t * p_relay_c, relay_c_evt_t * p_relay_c_evt)
{
    switch (p_relay_c_evt-&amp;gt;evt_type)
    {
        case RELAY_C_EVT_DISCOVERY_COMPLETE:
        {
            ret_code_t err_code;

            NRF_LOG_INFO(&amp;quot;\t\tRELAY SERVICE DISCOVERED on conn_handle 0x%x&amp;quot;, p_relay_c_evt-&amp;gt;conn_handle);

            err_code = relay_c_handles_assign( p_relay_c, p_relay_c_evt-&amp;gt;conn_handle, &amp;amp;p_relay_c_evt-&amp;gt;params.peer_db);
            APP_ERROR_CHECK(err_code);

            // Initiate bonding.
            /*
            err_code = pm_conn_secure(p_bas_c_evt-&amp;gt;conn_handle, false);
            */
            
            //RELAY service discovered. Enable notification of blacklist.
            err_code = relay_c_blacklist_notif_and_indic_enable(p_relay_c);
            APP_ERROR_CHECK(err_code);

            ///
            if (ble_conn_state_central_conn_count() == NRF_SDH_BLE_CENTRAL_LINK_COUNT)
            {
                bsp_board_led_off(CENTRAL_SCANNING_LED);
            }
            else
            {
                // Resume scanning.
                bsp_board_led_on(CENTRAL_SCANNING_LED);
                scan_start();
            }
            ///

        } break; // RELAY_C_EVT_DISCOVERY_COMPLETE

        case RELAY_C_EVT_BLACKLIST_RECEIVED:
        {
            //we have to save the blacklist
                  
        } break; // RELAY_C_EVT_BLACKLIST_RECEIVED

        default:
            // No implementation needed.
            break;
    }
}


/**@brief rfid client initialization.
 */
static void main_rfid_c_init(void)
{
    ret_code_t       err_code;
    rfid_c_init_t rfid_c_init_obj;

    rfid_c_init_obj.evt_handler = rfid_c_evt_handler;

    for (uint32_t i = 0; i &amp;lt; RFID_COUNT; i++)
    {
      err_code = rfid_c_init(&amp;amp;m_rfid_c[i], &amp;amp;rfid_c_init_obj);
      APP_ERROR_CHECK(err_code);
    }
}


/**@brief relay client initialization.
 */
static void main_relay_c_init(void)
{
    ret_code_t       err_code;
    relay_c_init_t relay_c_init_obj;

    relay_c_init_obj.evt_handler = relay_c_evt_handler;

    for (uint32_t i = 0; i &amp;lt; RELAY_COUNT; i++)
    {
        err_code = relay_c_init(&amp;amp;m_relay_c[i], &amp;amp;relay_c_init_obj);
        APP_ERROR_CHECK(err_code);
    }
}


/** @brief Database discovery initialization.
 */
static void db_discovery_init(void)
{
    ret_code_t err_code = ble_db_discovery_init(db_disc_handler);
    APP_ERROR_CHECK(err_code);
}


/**@brief Function to start scanning. */
static void scan_start(void)
{
    ret_code_t ret;

    (void) sd_ble_gap_scan_stop();

    NRF_LOG_INFO(&amp;quot;Scanning for %s and %s peripherals.&amp;quot;, (uint32_t)m_target_periph_RFID_name,(uint32_t)m_target_IHMI_relay_name);
    ret = sd_ble_gap_scan_start(&amp;amp;m_scan_params, &amp;amp;m_scan_buffer);
    APP_ERROR_CHECK(ret);
    // Turn on the LED to signal scanning.
    bsp_board_led_on(CENTRAL_SCANNING_LED);
}


/**@brief Function for initializing power management.
 */
static void power_management_init(void)
{
    ret_code_t err_code;
    err_code = nrf_pwr_mgmt_init();
    APP_ERROR_CHECK(err_code);
}


/**@brief Function for handling the idle state (main loop).
 *
 * @details Handle any pending log operation(s), then sleep until the next event occurs.
 */
static void idle_state_handle(void)
{
    if (NRF_LOG_PROCESS() == false)
    {
        nrf_pwr_mgmt_run();
    }
}


/**@brief Function for handling events from the button handler module.
 *
 * @param[in] pin_no        The pin that the event applies to.
 * @param[in] button_action The button action (press/release).
 */
static void button_event_handler(uint8_t pin_no, uint8_t button_action)
{
    ret_code_t err_code;

    switch (pin_no)
    {
        case MEASURE_REQUEST_1_BUTTON:
            cptButtonEvent++;
            if(cptButtonEvent==2)
            {
              uint8_t measure_request[]={0x1,0x1};
              for (uint32_t i = 0; i&amp;lt; NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++)
              {
                  //NRF_LOG_INFO(&amp;quot;m_rfid_c[%d].conn_handle : 0x%x&amp;quot;,i,m_rfid_c[i].conn_handle);
                  if(m_rfid_c[i].conn_handle != BLE_CONN_HANDLE_INVALID)
                  {
                      write_measure_request(&amp;amp;m_rfid_c[i], measure_request);
                  }
              }
              cptButtonEvent=0;
            }
            break;

        case MEASURE_REQUEST_2_BUTTON:
            cptButtonEvent++;
            if(cptButtonEvent==2)
            {
              uint8_t measure_request[]={0x1,0x2};
              for (uint32_t i = 0; i&amp;lt; NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++)
              {
                  if(m_rfid_c[i].conn_handle != BLE_CONN_HANDLE_INVALID)
                  {
                      write_measure_request(&amp;amp;m_rfid_c[i], measure_request);
                  }
              }
              cptButtonEvent=0;
            }
            break;

        case MEASURE_REQUEST_3_BUTTON:
            cptButtonEvent++;
            if(cptButtonEvent==2)
            {
              uint8_t measure_request[]={0x1,0x3};
              for (uint32_t i = 0; i&amp;lt; NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++)
              {
                  if(m_rfid_c[i].conn_handle != BLE_CONN_HANDLE_INVALID)
                  {
                      write_measure_request(&amp;amp;m_rfid_c[i], measure_request);
                  }
              }
              cptButtonEvent=0;
            }
            break;

        default:
            APP_ERROR_HANDLER(pin_no);
            break;
    }
}


/**@brief Function for initializing the button handler module.
 */
static void buttons_init(void)
{
    ret_code_t err_code;

    //The array must be static because a pointer to it will be saved in the button handler module.
    static app_button_cfg_t buttons[] =
    {
        {MEASURE_REQUEST_1_BUTTON, false, BUTTON_PULL, button_event_handler},
        {MEASURE_REQUEST_2_BUTTON, false, BUTTON_PULL, button_event_handler},
        {MEASURE_REQUEST_3_BUTTON, false, BUTTON_PULL, button_event_handler}
    };

    err_code = app_button_init(buttons, ARRAY_SIZE(buttons),
                               BUTTON_DETECTION_DELAY);
    APP_ERROR_CHECK(err_code);
}


/**@brief Function for the LEDs initialization.
 *
 * @details Initializes all LEDs used by the application.
 */
static void leds_init(void)
{
    bsp_board_init(BSP_INIT_LEDS);
}


/** @brief Function for initializing the log module.
 */
static void log_init(void)
{
    ret_code_t err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_DEFAULT_BACKENDS_INIT();
}


/** @brief Function for initializing the timer.
 */
static void timer_init(void)
{
    ret_code_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
}


/**@brief Function for initializing the GATT module.
 */
static void gatt_init(void)
{
    ret_code_t err_code = nrf_ble_gatt_init(&amp;amp;m_gatt, NULL);
    APP_ERROR_CHECK(err_code);
}


/**@brief Function for starting a scan, or instead trigger it from peer manager (after
 *        deleting bonds).
 *
 * @param[in] p_erase_bonds Pointer to a bool to determine if bonds will be deleted before scanning.
 */
/*
void scanning_start(bool * p_erase_bonds)
{
    // Start scanning for peripherals and initiate connection
    // with devices that advertise GATT Service UUID.
    if (*p_erase_bonds == true)
    {
        // Scan is started by the PM_EVT_PEERS_DELETE_SUCCEEDED event.
        delete_bonds();
    }
    else
    {
        scan_start();
    }
}
*/


int main(void)
{
    ret_code_t err_code;
    bool erase_bonds;

    // Initialize.
    log_init();
    NRF_LOG_INFO(&amp;quot;------------------------------------------------------------------------------------------&amp;quot;);
    NRF_LOG_INFO(&amp;quot;-------------------------------------Concentrator-----------------------------------------&amp;quot;);
    NRF_LOG_INFO(&amp;quot;------------------------------------------------------------------------------------------&amp;quot;);

    NRF_LOG_INFO(&amp;quot;Event types for the discovery :&amp;quot;)
    NRF_LOG_INFO(&amp;quot;\t%d : BLE_DB_DISCOVERY_COMPLETE&amp;quot;,BLE_DB_DISCOVERY_COMPLETE);             
    NRF_LOG_INFO(&amp;quot;\t%d : BLE_DB_DISCOVERY_ERROR&amp;quot;,BLE_DB_DISCOVERY_ERROR);                   
    NRF_LOG_INFO(&amp;quot;\t%d : BLE_DB_DISCOVERY_SRV_NOT_FOUND&amp;quot;,BLE_DB_DISCOVERY_SRV_NOT_FOUND);   
    NRF_LOG_INFO(&amp;quot;\t%d : BLE_DB_DISCOVERY_AVAILABLE&amp;quot;,BLE_DB_DISCOVERY_AVAILABLE);           

    timer_init();
    buttons_init();
    leds_init();
    power_management_init();
    ble_stack_init();
    gatt_init();
    db_discovery_init();
    main_rfid_c_init();
    main_relay_c_init();
    ble_conn_state_init();

    err_code = app_button_enable();
    APP_ERROR_CHECK(err_code);

    //scanning_start(&amp;amp;erase_bonds);
    scan_start();

    // Enter main loop.
    for (;;)
    {
       idle_state_handle();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How can I send you my whole project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/190515?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2019 12:47:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ce9d936-5e93-4beb-be44-cc99a8084df9</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;How many instances of the DB discovery module have you registered? Could you be using the same for all connections? Check: BLE_DB_DISCOVERY_ARRAY_DEF(m_db_discovery, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /**&amp;lt; Database discovery module instances. */&lt;/p&gt;
&lt;p&gt;The ble_app_hrs_rscs_relay example has code that shows how to start multiple instances. See the on_ble_central_evt handler in the BLE_GAP_EVT_CONNECTED event.&lt;/p&gt;
&lt;p&gt;If this doesn&amp;#39;t help is it possible for you to share your project so I can see what you are doing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/189605?ContentTypeID=1</link><pubDate>Tue, 28 May 2019 11:33:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6ee7c76-0931-4ccd-8b6c-912b8b2fc21b</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Do you have any other suggestions to improve my service discovery please run_ar?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/188875?ContentTypeID=1</link><pubDate>Thu, 23 May 2019 14:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2564d698-3ff2-49f2-9250-ef7d42775646</guid><dc:creator>JCombes</dc:creator><description>&lt;p&gt;Hi, thank you for your help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I changed my program so it start to scan again for new peripherals only&amp;nbsp;when the services of the previously connected peripheral has been discovered.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have now the funtion &amp;quot;scan_start();&amp;quot; in my central event handlers in &amp;quot;case C_EVT_DISCOVERY_COMPLETE&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1558620980902v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It works sometimes with this method but not always.&lt;/p&gt;
&lt;p&gt;Here is an example of when it does not work :&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1558621234046v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;On the conn_handle 0x0 the discovery handler continues even if the service is already discovered. Then the RFID service is discovered several times on conn_handle 0x0.&lt;/p&gt;
&lt;p&gt;On the conn_handle 0x1 the relay service is discovered.&lt;/p&gt;
&lt;p&gt;On the conn_handle 0x2 the RFID service is not discovered and the discovery handler stop.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems while discovering services on a multilink central</title><link>https://devzone.nordicsemi.com/thread/188831?ContentTypeID=1</link><pubDate>Thu, 23 May 2019 12:55:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:078bdcfd-fa91-438c-a210-b80610401a2f</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;If I remember correctly there is a limitation with the discovery module. so you should only do service discovery on one peer at the time. Can you try to add a check so you do not start service discovery on the new device if the process is already ongoing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>