<?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>Disable HID some of the time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50528/disable-hid-some-of-the-time</link><description>We are developing a device that has different &amp;quot;modes&amp;quot;, and in some modes it acts as a HID keyboard and mouse, but in other modes it does not. This device connects to iOS and android, and in HID modes causes the virtual keyboard to be hidden as it is a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Oct 2020 12:25:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50528/disable-hid-some-of-the-time" /><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/277796?ContentTypeID=1</link><pubDate>Fri, 30 Oct 2020 12:25:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46f98bfe-8d40-47af-ab1d-2c86d00435e1</guid><dc:creator>khodidas</dc:creator><description>&lt;p&gt;Hello Nick,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You mentioned&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;span&gt;We&amp;nbsp;have an existing device on a different platform which already implements this. When switching between HID and non-HID modes, it will modify the HID report and send a services modified indication for the HID service, causing iOS to re-read the HID report. This works fine.&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please if you can inform us&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(1) is that worked for you with nordic solution in iOS?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(2) was that working for you with different platform for android OS, where you modify the HID report from keyboard to any other one and android phone still recognize it as keyboard Vs non-keyboard device? You mentioned that iOS re-read the HID report and working fine. But does same works well for android ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;khodidas&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/207899?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 11:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3a60f6d-2984-4256-a266-418f9f99f7e8</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;There is a way to find this information, here is a function that will determine the end handle for a given service handle:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t get_service_end_handle(uint16_t service_handle, uint16_t *end_handle) {
    VERIFY_PARAM_NOT_NULL(end_handle);
    ret_code_t err_code = NRF_SUCCESS;
    for (uint16_t handle = service_handle + 1; handle &amp;lt; UINT16_MAX; handle++) {
        ble_uuid_t uuid;
        err_code = sd_ble_gatts_attr_get(handle, &amp;amp;uuid, NULL);
        if (err_code == NRF_ERROR_NOT_FOUND) {
            *end_handle = handle - 1;
            return NRF_SUCCESS;
        }
        VERIFY_SUCCESS(err_code);
        if (uuid.type != BLE_UUID_TYPE_BLE ||
            (uuid.uuid != BLE_UUID_SERVICE_PRIMARY &amp;amp;&amp;amp; uuid.uuid != BLE_UUID_SERVICE_SECONDARY)) {
            continue;
        }
        *end_handle = handle - 1;
        return NRF_SUCCESS;
    }
    *end_handle = UINT16_MAX;
    return NRF_ERROR_NOT_FOUND;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This end handle can then be passed to&amp;nbsp;sd_ble_gatts_service_changed:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t service_changed(uint16_t conn_handle, uint16_t service_handle) {
    uint16_t service_end;
    (void)get_service_end_handle(service_handle, &amp;amp;service_end);
    return sd_ble_gatts_service_changed(conn_handle, service_handle, service_end);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202979?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 08:10:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f64e5307-0b6d-44b2-bce3-528a7fce2455</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Nick&lt;/p&gt;
&lt;p&gt;Sorry, there doesn&amp;#39;t seem to be a way to find this in the peripheral. However, while scouring the DevZone, I found&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/887/how-to-use-sd_ble_gatts_service_changed"&gt; this case&lt;/a&gt;, which describes how to use the sd_ble_gatts_service_changed. Please check out Pål&amp;#39;s answers, as they are very descriptive.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202794?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 10:33:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c8ce217-ed20-4d34-9167-7f6447e1341b</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;That&amp;#39;s just for centrals though, correct? I was asking if there was a way to determine the service end handle programmatically in the peripheral to pass to&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;sd_ble_gatts_service_changed&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202777?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 09:28:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54a9ceb2-1d14-438b-9a82-f33a7e32558e</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Nick&lt;/p&gt;
&lt;p&gt;You should be able to find the HID service end handle, by printing end_handle from &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v6.1.1%2Fgroup___b_l_e___g_a_t_t_c___e_n_u_m_e_r_a_t_i_o_n_s.html&amp;amp;resultof=%22%73%64%5f%62%6c%65%5f%67%61%74%74%63%5f%70%72%69%6d%61%72%79%5f%73%65%72%76%69%63%65%73%5f%64%69%73%63%6f%76%65%72%22%20"&gt;SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER&lt;/a&gt;. Please use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v6.1.1%2Fgroup___b_l_e___g_a_t_t_c___p_r_i_m___s_r_v_c___d_i_s_c___m_s_c.html&amp;amp;cp=3_4_2_1_2_2_3_10"&gt;message sequence chart&lt;/a&gt; and &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/40387/custom-service-discovery-in-ble_central/158295#158295"&gt;this thread&lt;/a&gt; for reference. The &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Fgroup__ble__db__discovery.html&amp;amp;resultof=%22%62%6c%65%5f%64%62%5f%64%69%73%63%6f%76%65%72%79%22%20%22%6d%6f%64%75%6c%65%22%20%22%6d%6f%64%75%6c%22%20"&gt;database discovery module documentation&lt;/a&gt; should also be helpful for understanding the module itself.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202489?ContentTypeID=1</link><pubDate>Mon, 05 Aug 2019 17:50:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54cb22cd-b55a-484b-89b9-484598bde204</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;This is what I was wanting originally, as I mentioned sending a services changed indication for the existing HID service causes the OS to re-read the HID report, and if the report does not contain a keyboard then the virtual keyboard will be shown. Is there any way to determine the HID service end handle? or would it be a case of adding an offset to the final characteristic handle?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202324?ContentTypeID=1</link><pubDate>Mon, 05 Aug 2019 07:53:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5da1b8d4-eed3-4e1f-a26f-77cd680f0c67</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Nick&lt;/p&gt;
&lt;p&gt;sd_ble_gatts_service_changed is used to perform a Service Changed Indication to one or more peers. You can add and change services, but you won&amp;#39;t be able to remove any. I&amp;#39;m not entirely sure how this works with HID, but I imagine &amp;quot;removing&amp;quot; the HID function might count as removing a service. In any case, you&amp;#39;re welcome to try it out, and yes, you can use 0xFFFF as the end handle if you&amp;#39;re not adding any further services.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202146?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 12:38:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dd0e692-0b12-4f78-98cf-cf370e9794fb</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Actually there is the function&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;sd_ble_gatts_service_changed&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;You can pass a start handle and end handle. The start handle of the service is provided when creating. How can I get the end handle? Or perhaps I can just pass 0xFFFF if the service is the last service to be added?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202128?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 11:55:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e520af17-38cf-4c1a-a5d0-dbebc4a3071d</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;It isn&amp;#39;t as fast, and we have our own services which would be interrupted by disconnection which then requires rediscovery on reconnection. If going from non-HID to HID mode, bonding&amp;nbsp;would not exist as bonding&amp;nbsp;will not be required in non-HID modes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202124?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 11:52:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49dc226e-ecbf-436a-85aa-293ecfcfc067</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;I asked around in the support team, and as far as we know, and based on what I&amp;#39;ve seen in various posts on Devzone. No, there isn&amp;#39;t. Although I don&amp;#39;t see why disconnecting between these &amp;quot;modes&amp;quot; would be a problem, when bonded, the device should be able to reconnect automatically after the reinitialize.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202123?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 11:44:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccbca53c-d03a-4f4b-833a-d3063b115d69</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Ok thanks, so there is no way I can force a service changed indication to be sent?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Disable HID some of the time</title><link>https://devzone.nordicsemi.com/thread/202122?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 11:42:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc0d4c74-6d2a-419c-a73f-cb1ad3bc9bf9</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Nick&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think this will be attainable without disconnecting due to the modification limitation you mentioned. We can send a service indication, HID report, etc. but disconnecting and reinitializing the SoftDevice with the new attribute table will be necessary.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>