<?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>I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53926/i-give-up-how-do-i-do-a-service-changed</link><description>The documentation is VERY difficult to search. A search only goes over the chapter. I get different results depending upon which one I am in .... aarrg! And there are SOOO many. 
 So I want to do something very basic; 
 On my peripheral I want to expose</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Nov 2019 16:33:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53926/i-give-up-how-do-i-do-a-service-changed" /><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/221151?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2019 16:33:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:821acecf-9ee3-4a47-bd82-21edd7cfc54c</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As pc-ble-driver is &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_serialization.html"&gt;serialization&lt;/a&gt; of the same SoftDevice that is used by the nRF5 SDK, all code from the nRF5 SDK using the SoftDevice can be used for referencing how to use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v6.1.1%2Findex.html"&gt;SoftDevice API&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/220798?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2019 11:28:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc976669-2c5a-40c2-b4b1-b91bda0a53eb</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;this is the pc-ble-driver.&lt;/p&gt;
&lt;p&gt;Following those examples does not solve the problem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/219860?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 10:03:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b937f445-694e-42b4-9c0a-56354a579a89</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Hung is out-of-office and I am having a look at this while he is away.&lt;/p&gt;
&lt;p&gt;The file gatt_cache_manager.c is found in the SDK at &amp;lt;sdk root folder&amp;gt;/components/ble/peer_manager/gatt_cache_manager.c&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/219263?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2019 11:50:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b66a647-5d2d-4a31-886e-7f10650cc889</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;UI experience: The problem is the reply button doesnt&amp;#39; EXIST! I have to go through loops an hoops to get it to appear (refreshes and reloads). When it finally appears, all is rosy.&lt;/p&gt;
&lt;p&gt;That aside, I do not have the tools to build the HEX files needed to test the example in the NRF SDK. The other problem is that I could not find the file you referenced in the SDK (at least in my copy). So I can&amp;#39;t even look at it. I found something similar in another file and that is why I did the &amp;#39;loop&amp;#39; over&amp;nbsp;ever-increasing handles.&lt;/p&gt;
&lt;p&gt;That &amp;#39;loop-guess&amp;#39; part still stinks even if it DID work; not knowing what the handle of the service changed characteristic is, providing no means to get it,&amp;nbsp;yet requiring it in the call to invoke the service changed indication.&lt;/p&gt;
&lt;p&gt;Clearly there needs to be an sd_* call that gets the handle needed in the sd_ call that invokes the service changed. Doesn&amp;#39;t that make sense? Otherwise DONT demand the handle and have the soft device find it. It clearly knows it!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In the end&lt;/strong&gt; the problem is that softdevice thinks it doesn&amp;#39;t have the system attributes. What that error means is still unclear to me because a get clearly shows they are there!&lt;/p&gt;
&lt;p&gt;If it was TRULY the case that Android had not enabled indications I would expect the error&lt;/p&gt;
&lt;p&gt;&lt;a class="el" title="Invalid state, operation disallowed in this state." href="https://devzone.nordicsemi.com/f/nordic-q-a/53926/i-give-up-how-do-i-do-a-service-changed/group__nrf__error.html#gaf0aff2ba7864b34a36b4a96986e1851e"&gt;NRF_ERROR_INVALID_STATE&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;not&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a class="el" href="https://devzone.nordicsemi.com/f/nordic-q-a/53926/i-give-up-how-do-i-do-a-service-changed/group___b_l_e___e_r_r_o_r_s___g_a_t_t_s.html#ga1d0833ac31d0c319e5286623b6301d0a"&gt;BLE_ERROR_GATTS_SYS_ATTR_MISSING&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At least that&amp;#39;s what the documentation says.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/219258?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2019 11:24:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afbe71cc-354c-4877-a169-e68d4ac4bc1b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Brian,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry for the bad user experience. You can click on the Reply button right under the question.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The&amp;nbsp;&lt;span&gt;service_changed_send_in_evt() you can find in gatt_cache_manager.c. The file is used in the ble_app_gatts.&amp;nbsp;&lt;br /&gt;From what you described, it seems to be correct to me. Not sure why the function still complaining.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But I strongly suggest to try testing the ble_app_gatts and ble_app_gatts_c and then compare to the behavior of your application. Try comparing the difference in the code on the working examples with yours. I think you are pretty close.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/219245?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2019 10:19:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32907278-71ea-4a30-a3d6-9007ef3c2b74</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;where do I find&amp;nbsp;&lt;span&gt;service_changed_send_in_evt()?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As stated, my&amp;nbsp;\examples\connectivity\ble_connectivity does nto have the code you referenced above&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/219237?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2019 10:04:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b1ff37a-3ee0-4382-a1cd-b1a8a5115edc</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Just a note on this web app: The &amp;#39;reply&amp;#39;, verify answer, etc buttons/options often don&amp;#39;t show up until I do many screen refreshes, especially on the last messages. If you have a &amp;#39;reply&amp;#39; from an older message but not the last message, hitting the reply there makes the buttons appear on the last message. Nothing do to with this thread but it makes participation annoying and sometimes &amp;#39;come back later to try&amp;#39;.&lt;/p&gt;
&lt;p&gt;Back to the issue:&lt;/p&gt;
&lt;p&gt;Turns out Android auto-handles service changed because I handled it too and I wrote a trap in my Nordic peripheral to catch all descriptor writes and I was writing the service changed CCCD twice (and the heart rate measurement once).&lt;/p&gt;
&lt;p&gt;I have this code to catch the descriptor-writing attempts by the Android&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;case BLE_GATTS_EVT_WRITE:
    if (p_ble_evt-&amp;gt;evt.gatts_evt.params.write.handle ==
            m_heart_rate_measurement_handle.cccd_handle)
    {
        uint8_t write_data = p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data[0];
        m_send_notifications = (write_data == BLE_GATT_HVX_NOTIFICATION);
        cccdSet = m_send_notifications;
		printf(&amp;quot;Enabling CCCD with %d at time %llu\n&amp;quot;, write_data, (GetTickCount64() - elapsedTimeStart));
    }
    else
    {
        uint8_t write_data = p_ble_evt-&amp;gt;evt.gatts_evt.params.write.data[0];
            printf(&amp;quot;Client Enabling CCCD of characeteristic handle %d with value %d at time %llu\n&amp;quot;,
                p_ble_evt-&amp;gt;evt.gatts_evt.params.write.handle, write_data, (GetTickCount64() - elapsedTimeStart));
    }
    break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and I see the Android write all the descriptors available to write.&lt;/p&gt;
&lt;p&gt;But the Android&amp;nbsp;enables the service changed on the first connection.&amp;nbsp;Its the second connection where the attempt to send the service changed indication fails. So I believe this has to be some kind of configuration issue as it is very clear the Android is enabling the service changed. So&lt;/p&gt;
&lt;p&gt;Either I am not saving and&amp;nbsp; restoring the CCCDs correctly between the first run and the second run, or I am trying to invoke the service changed at the wrong time on the reconnect or I have to wait until the Android enables the service changed again (which it won&amp;#39;t do since it has already done it ... unless I do it separately. The latter can&amp;#39;t be the case since that violates the spec. So am I saving/restoring wrong?&lt;/p&gt;
&lt;p&gt;When the first run disconnects, I invoke the following to get the CCCD data&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;sd_ble_gatts_sys_attr_get(m_adapter, p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, NULL, &amp;amp;saveDataLength, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
if(saveDataLength &amp;gt; 0)
{ 
    saveDataBuffer = calloc(1, saveDataLength * sizeof(uint8_t));
    err_code = sd_ble_gatts_sys_attr_get(m_adapter, p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, saveDataBuffer, &amp;amp;saveDataLength, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
    if (err_code != NRF_SUCCESS)
    {
        printf(&amp;quot;Failed getting persistent sys attr info. Error code: 0x%02X\n&amp;quot;, err_code);
        fflush(stdout);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And on program close I save the &amp;#39;saveDataBuffer&amp;#39; to a file.&lt;/p&gt;
&lt;p&gt;On restart of the application I read &amp;#39;saveDataBuffer&amp;#39; from the file and in the connection event callback I invoke this code&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;if (saveDataBuffer != NULL)
{
    err_code = sd_ble_gatts_sys_attr_set(m_adapter, p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, saveDataBuffer,
        saveDataLength, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
    if (err_code != NRF_SUCCESS)
    {
        printf(&amp;quot;Failed updating persistent sys attr info. Error code: 0x%02X\n&amp;quot;, err_code);
        fflush(stdout);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have looked at what is in saveDataBuffer both going out and coming in and its only 8 bytes in length so as far as I can tell its the service changed CCCD info.&lt;/p&gt;
&lt;p&gt;At this point I call the service changed right after I restore the CCCDs; thus in the connection event. I waited until after encryption but I got the same result of service attributes missing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/219212?ContentTypeID=1</link><pubDate>Fri, 08 Nov 2019 08:23:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bdaefc4f-e2e0-4b80-b4d6-74835c0396b8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;&lt;span&gt;I did use Android and it works with other devices =&amp;gt; no this doesn&amp;#39;t guarantee that the phone has written to CCCD before your call.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It&amp;#39;s much easier to test when you have full control of the central device. Please use the nRFConnect on PC to continue.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To get the system attribute you call&amp;nbsp;sd_ble_gatts_sys_attr_get(). And when the bonded connection is reestablished, you call&amp;nbsp;sd_ble_gatts_sys_attr_set() with the exact same data.&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t need to know which handle the service changed handle is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have code to find the service changed cccd handle value in&amp;nbsp;service_changed_cccd() in gatt_cache_manager.c . But it only used to check if the service changed actually&amp;nbsp;exist or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please have&amp;nbsp; a look inside&amp;nbsp;service_changed_send_in_evt() to see how we handle the error codes when calling&amp;nbsp;sd_ble_gatts_service_changed()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218749?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2019 09:14:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f54e2111-7812-4620-bec0-5e806ff93b50</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Yes I have (I did use Android and it works with other devices). If I knew the handle value of the service changed characteristic I should be able to catch it in my peripheral code ... unless Nordic doesn&amp;#39;t pass that one up to the application (like it does other notification/indication attempts).&lt;/p&gt;
&lt;p&gt;I trapped all attempts by collector to enable characteristics and I see this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Client Enabling CCCD of characeteristic handle 13 with value 2 at time 1953&lt;/p&gt;
&lt;p&gt;However, on a reconnect when I attempt to do a service changed indication I get this:&lt;/p&gt;
&lt;p&gt;Started advertising at time 0&lt;br /&gt;Connected at time 234, connection handle 0x0001&lt;br /&gt;Failed invoking service changed indication. Invalid handle 0&lt;br /&gt;Failed invoking service changed indication. Invalid handle 1&lt;br /&gt;Failed invoking service changed indication. Invalid handle 2&lt;br /&gt;Failed invoking service changed indication. Invalid handle 3&lt;br /&gt;Failed invoking service changed indication. Invalid handle 4&lt;br /&gt;Failed invoking service changed indication. Invalid handle 5&lt;br /&gt;Failed invoking service changed indication. Invalid handle 6&lt;br /&gt;Failed invoking service changed indication. Invalid handle 7&lt;br /&gt;Failed invoking service changed indication. Invalid handle 8&lt;br /&gt;Failed invoking service changed indication. Invalid handle 9&lt;br /&gt;Failed invoking service changed indication. Invalid handle 10&lt;br /&gt;Failed invoking service changed indication. Invalid handle 11&lt;br /&gt;Failed invoking service changed indication. Invalid handle 12&lt;br /&gt;Failed invoking service changed indication. Invalid handle 13&lt;br /&gt;Failed invoking service changed indication. Service attributes missing&lt;br /&gt;Result of sending encryption params 0&lt;br /&gt;Security settings reported at time 843:&lt;br /&gt; security level: 2&lt;br /&gt; security mode: 1&lt;br /&gt; key length: 16&lt;br /&gt;Disconnected at time 1078&lt;/p&gt;
&lt;p&gt;Of course the Android central is going to fail now as it will try to write to handles based upon the old service tables as it never re-did service discovery to find out that there is no DIS anymore and the HeartRate service values have changed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218742?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2019 09:04:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89f32bbb-a037-403d-8694-10986beef9e0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Have you enabled indication from the central side ? Please use nRFConnect to test first, before using Android.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218619?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 14:24:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3aa28220-db67-40e8-8ead-62eb0ad4d59e</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Then I better start from 0 and not what I get from the &amp;#39;get&amp;#39; method. I am still suspicious that it has something to do with the fact I cannot restore the system attributes because I do not get signaled the ..._SYS_ATTR_MISSING event&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Since my&amp;nbsp;&lt;span&gt;\examples\connectivity\ble_connectivity does not have the code you reference above, I am kind of stuck with trial and error from zero ... if it even works.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I definitely will not hard code, as I am implementing a peripheral, running it, disconnecting, and then implementing another, one after the other. So far it all works except for the service changed and the&amp;nbsp;BLE_GATTS_EVT_SYS_ATTR_MISSING event. However, my central always re-enables indications and notifications because of the misbehaving devices that do not do bonding correctly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Doing the &amp;#39;cycle&amp;#39; starting with 0 I no longer get the invalid handle, instead I get&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BLE_ERROR_GATTS_SYS_ATTR_MISSING&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218599?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 13:55:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8853ac68-2564-4ad1-bfdd-edc3e077d597</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Could you try follow our code in&amp;nbsp;gscm_service_changed_ind_send () in gatts_cache_manager ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;do
    {
        err_code = sd_ble_gatts_service_changed(conn_handle, start_handle, end_handle);
        if (err_code == BLE_ERROR_INVALID_ATTR_HANDLE)
        {
            start_handle += 1;
        }
    } while (err_code == BLE_ERROR_INVALID_ATTR_HANDLE);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not 100% sure why we need to do the &amp;quot;trial and error&amp;quot; method like this,&amp;nbsp;may need to check with the developer. But you don&amp;#39;t need to do this all the time, if you find the value you can hardcode it I believe.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218556?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 12:53:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d2c0dfd-f4e3-4954-9dc6-e5c9db45683a</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;The &amp;#39;get&amp;#39; function gives me a value of 0xD.&lt;/p&gt;
&lt;p&gt;So I tried both 0 and the value provided by the table from the &amp;#39;get()&amp;#39; method.. Both gave me the same error 0x3003&lt;/p&gt;
&lt;p&gt;&amp;#39;INVALID ATTRIBUTE HANDLE&amp;#39;&lt;/p&gt;
&lt;p&gt;There must be something more missing. For example, the restoration of the of the &amp;#39;system attributes&amp;#39; from the previous connection. However that doesn&amp;#39;t happen because I never get a&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BLE_GATTS_EVT_SYS_ATTR_MISSING&lt;/p&gt;
&lt;p&gt;event. So maybe that&amp;#39;s the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218520?ContentTypeID=1</link><pubDate>Tue, 05 Nov 2019 11:49:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96839abd-1eaa-45bb-943b-0c5c99475fcd</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Have you really looked into the examples we provide?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can find in function&amp;nbsp;gscm_service_changed_ind_send() we use&amp;nbsp;sd_ble_gatts_initial_user_handle_get() to get the start_handle for the&amp;nbsp;&lt;span&gt;sd_ble_gatts_service_changed() call (you can also use 0 AFAIK)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The handle of the service change characteristic is not related to the&amp;nbsp;&lt;span&gt;start_handle. You only need the handle of service changed characteristic on the client side. This I assume is handled by the Android phone.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/span&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: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218375?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2019 22:47:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d00a6897-f8a5-442b-868f-2951ca05655f</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;The bottom line is I need the handle of the Service Changed characteristic on the nrf52380 dongle. There are no sp_* APIs in the pc-ble-driver to obtain that value.&lt;/p&gt;
&lt;p&gt;I need to invoke the method&amp;nbsp;&lt;/p&gt;
&lt;p&gt;sd_ble_gatts_service_changed(adapter_t *adapter, uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle));&lt;/p&gt;
&lt;p&gt;and I need the start handle. I use the 0xFFFF for the end handle.&lt;/p&gt;
&lt;p&gt;Some help with these&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint8_t* p_sys_attr_data;&lt;br /&gt; uint16_t p_len = 0;&lt;br /&gt; sd_ble_gatts_sys_attr_get(m_adapter, m_connection_handle, NULL, &amp;amp;p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);&lt;br /&gt; p_sys_attr_data = calloc(1, p_len);&lt;br /&gt; sd_ble_gatts_sys_attr_get(m_adapter, m_connection_handle, p_sys_attr_data, &amp;amp;p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);&lt;br /&gt; sd_ble_gatts_sys_attr_set(m_adapter, m_connection_handle, p_sys_attr_data, p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);&lt;/p&gt;
&lt;p&gt;would also be nice. The table generated is kind of useless as it has no UUID so you have no idea what attribute it is talking about. The docs say to use this method to get the start handle in the service changed call. Arrg.&lt;/p&gt;
&lt;p&gt;I already asked what a system attribute was. After seeing the table I am more confused. Why is there only one entry? Does this table contain only descriptors? None of this makes too much sense, but somebody must know the relation between the handles and UUIDs!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218340?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2019 16:42:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a820b05-9334-44c5-9112-4806fb8f5aea</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Please correct me if I&amp;#39;m wrong. You are implementing the peripheral on the pc-ble-driver ? And on this you have the GATT server ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would suggest to use nRF Connect on PC (you would need one extra dongle/dk) to do service discovery on the device and check if the service changed characteristic is available in the GATT server. You can try to write to the CCCD to enable indication.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that Android won&amp;#39;t enable indication of service changed characteristic if there is no bond. When there is no bond, the client is not expected to store the&amp;nbsp;service discovery database.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t tried myself but if you don&amp;#39;t see the service changed characteristic in the GATT table, you most likely need to enable in the nRF52 code which is&amp;nbsp;at this folder:&amp;nbsp;\examples\connectivity\ble_connectivity&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218269?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2019 14:29:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffdbc295-b908-4ba0-a045-12b247993aa0</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;Thanks for the response. I understand that a client&amp;nbsp;can support services; its just in practice (out in the field) I have never seen it ... except perhaps for a CTS.&lt;/p&gt;
&lt;p&gt;In any case, I am using the pc-ble-driver so I must use sd_* calls myself. Even so, it looks like it should be easy. Basically, as far as I can tell the GATT service is already set up and the service changed characteristic exists. Now I have an Android application that will attempt to enable indications on the service changed characteristic if it finds one. It works fine for peripheral devices out in the field.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also have no sd_* APIs in the pc-ble-driver that allow me to get the handle of the GATT services, characteristics, or descriptors. Looked for answers on that, too. I did see some post which suggests the handle is 0x0B but that may even be another platform, so I don&amp;#39;t know if that is even right. Found no documentation on it though.&lt;/p&gt;
&lt;p&gt;So that&amp;#39;s where I am at. What config step am I missing? Where can I find documentation on how to do this?&lt;/p&gt;
&lt;p&gt;UPDATE: It appears the handle I am using 0x0B for the Service Changed characteristic is wrong.&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;sd_ble_gatts_service_changed() method returns the error incorrect handle. But I cannot get the handle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I give up; how do I do a service changed?</title><link>https://devzone.nordicsemi.com/thread/218243?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2019 13:43:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2faa8a5-3b47-4ffe-a8f3-c8e03615fc35</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Brian,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have two examples in the SDK :&amp;nbsp;ble_app_gatts_c and&amp;nbsp;ble_app_gatts. Have you tried to test them ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;They are not exactly the same as you wanted (server on peripheral and client on central) however, you can use them as the referral.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Basically, on the server, you need to enable service changed, and send the indication. This is already handled by gatt_cache_manager.c and you just need to call&amp;nbsp;pm_local_database_has_changed() to send the indication. ( it&amp;#39;s inside&amp;nbsp;bsp_event_handler() in ble_app_gatts)&lt;/p&gt;
&lt;p&gt;On the client, you need to do service discovery and write to the CCCD to enable indication. This is already handled by nrf_ble_gatts.c and the ble_db_discovery.c modules. Please have a look in gatts_evt_handler in main.c in ble_app_gatts_c.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>