<?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>Not able to receive handles of custom service characteristics in central device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63752/not-able-to-receive-handles-of-custom-service-characteristics-in-central-device</link><description>I am working in nRF52840 chip with SDK 15.3.0 and softdevice s140. I am looking to automate third party BLE peripheral device, this device is designed to connect with smart phone and then smartphone is communicating with server through internet. I am</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Aug 2020 13:09:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63752/not-able-to-receive-handles-of-custom-service-characteristics-in-central-device" /><item><title>RE: Not able to receive handles of custom service characteristics in central device</title><link>https://devzone.nordicsemi.com/thread/262809?ContentTypeID=1</link><pubDate>Mon, 03 Aug 2020 13:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3794ae21-9d87-43d1-a6e8-628cc2e80748</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. I was out of office the last 14 days due to vacation.&lt;/p&gt;
&lt;p&gt;If you are still struggling with this:&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what your implementation looks like. If you look at the implementation from the ble_app_uart_c example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_nus_c_on_db_disc_evt(ble_nus_c_t * p_ble_nus_c, ble_db_discovery_evt_t * p_evt)
{
    ble_nus_c_evt_t nus_c_evt;
    memset(&amp;amp;nus_c_evt,0,sizeof(ble_nus_c_evt_t));

    ble_gatt_db_char_t * p_chars = p_evt-&amp;gt;params.discovered_db.charateristics;

    // Check if the NUS 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 == BLE_UUID_NUS_SERVICE)
        &amp;amp;&amp;amp;  (p_evt-&amp;gt;params.discovered_db.srv_uuid.type == p_ble_nus_c-&amp;gt;uuid_type))
    {
        for (uint32_t i = 0; i &amp;lt; p_evt-&amp;gt;params.discovered_db.char_count; i++)
        {
            switch (p_chars[i].characteristic.uuid.uuid)
            {
                case BLE_UUID_NUS_RX_CHARACTERISTIC:
                    nus_c_evt.handles.nus_rx_handle = p_chars[i].characteristic.handle_value;
                    break;

                case BLE_UUID_NUS_TX_CHARACTERISTIC:
                    nus_c_evt.handles.nus_tx_handle = p_chars[i].characteristic.handle_value;
                    nus_c_evt.handles.nus_tx_cccd_handle = p_chars[i].cccd_handle;
                    break;

                default:
                    break;
            }
        }
        if (p_ble_nus_c-&amp;gt;evt_handler != NULL)
        {
            nus_c_evt.conn_handle = p_evt-&amp;gt;conn_handle;
            nus_c_evt.evt_type    = BLE_NUS_C_EVT_DISCOVERY_COMPLETE;
            p_ble_nus_c-&amp;gt;evt_handler(p_ble_nus_c, &amp;amp;nus_c_evt);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You see that it checks a few things before it looks at the uuids:&lt;/p&gt;
&lt;p&gt;if ( (p_evt-&amp;gt;evt_type == BLE_DB_DISCOVERY_COMPLETE)&lt;br /&gt; &amp;amp;&amp;amp; (p_evt-&amp;gt;params.discovered_db.srv_uuid.uuid == BLE_UUID_NUS_SERVICE)&lt;br /&gt; &amp;amp;&amp;amp; (p_evt-&amp;gt;params.discovered_db.srv_uuid.type == p_ble_nus_c-&amp;gt;uuid_type))&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you do the same check? Perhaps it is not a BLE_DB_DISCOVERY_COMPLETE event at all, in which case the uuids would not be populated.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to receive handles of custom service characteristics in central device</title><link>https://devzone.nordicsemi.com/thread/260908?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2020 06:40:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9db38123-6f41-4392-8c77-8402307ed7ca</guid><dc:creator>Abhishek</dc:creator><description>&lt;p&gt;Hi Edvin&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was checking&amp;nbsp;&lt;span&gt;ble_nus_c_evt_handler&amp;nbsp;for&amp;nbsp;&lt;/span&gt;same function which you mentioned and i checked the pointer in watch window for all&amp;nbsp;&lt;span&gt;p_chars[], but all uuid were 0x00.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As my custom characteristic foot print is similar to nRF LBS service&amp;nbsp;modified ble_app_blinky_c example to suit my needs and now it is working. How ever i am not sure what went wrong with&amp;nbsp;ble_app_uart_c project modification.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Not able to receive handles of custom service characteristics in central device</title><link>https://devzone.nordicsemi.com/thread/260198?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 15:18:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4af0362f-57e1-4753-b857-af79b4e567da</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I believe that the ble_app_uart_c is a good reference project to discover services and characteristics.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Now in code I am connected to device during db_discovery i am getting to the configured callback function but i am not getting characteristics of the peripheral.&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;Is that the&amp;nbsp;ble_nus_c_evt_handler with the evt_type = BLE_NUC_C_EVT_DISCOVERY_COMPLETE, or the&amp;nbsp;ble_nus_c_on_db_disc_evt() in ble_nus_c.c? Or somewhere else?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If it is the&amp;nbsp;ble_nus_c_on_db_disc_evt(). Look at the unmodified implementation of ble_nus_c.c. What is the p_chars[i].characteristic.uuid.uuid? Is it the UUID that you expect? (Note that this callback may occur several times if the device has several services, so make sure you are checking the correct event, when p_evt-&amp;gt;params.discovered_db.srv.uuid is the one that you expect.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>