<?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>How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32652/how-to-use-ble_hids-with-multiple-peripherals</link><description>I&amp;#39;m trying to create a HID bluetooth device with multiple connections to centrals. Looking at the ble_hids service implementation, the on_connect event handler sets the connection handle of a new connection on the hids instance. How can I associate one</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Mar 2018 19:47:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32652/how-to-use-ble_hids-with-multiple-peripherals" /><item><title>RE: How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/thread/126414?ContentTypeID=1</link><pubDate>Thu, 29 Mar 2018 19:47:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f374c79-3c45-4e7d-a45b-ab34c60b64c8</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Hi Martin, could you help with these last questions? Many thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/thread/125805?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 16:52:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e225df21-b1ed-44c6-bdc8-0e8f48cb6366</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Ok great. Is it OK to copy and modify the standard ble_hids.c/.h from the SDK? In the header it says:&lt;/p&gt;
&lt;pre&gt;To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
qualification listings, this section of source code must not be modified.&lt;/pre&gt;
&lt;p&gt;By changing the implementation do I lose qualification?&lt;/p&gt;
&lt;p&gt;Will you be updating the services in the SDK to support multiple peripherals by default in the future?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/thread/125804?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 16:44:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:261bc501-9ca9-4ba8-86d9-917cd81b77cf</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;No worries.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So the&amp;nbsp;one&amp;nbsp;peripheral will send the exact same data to multiple peripherals? Then&amp;nbsp;instead of changing the hids&amp;nbsp;service&amp;nbsp;structure I would rather change the functions that transmit the data you need. Take the function&amp;nbsp;ble_hids_inp_rep_send() in ble_hids.c for example. It takes a hids&amp;nbsp;service&amp;nbsp;structure as parameter and uses&amp;nbsp;p_hids-&amp;gt;conn_handle when sending notifications with&amp;nbsp;sd_ble_gatts_hvx(). If you change the function signature for ble_hids_inp_rep_send() to accept the connection handle directly you could just call the function multiple times, but pass different connection handles to it. You can&amp;nbsp;store all your connection handles in an array and iterate through that in a for loop to transmit data to all connections:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;for(number of active connections)
{
    ble_hids_inp_rep_send(conn_handle, ...)
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can also possibly get some inspiration from the&amp;nbsp;&lt;a title="Experimental: BLE Multiperipheral Application" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/ble_sdk_app_multiperipheral.html?cp=4_0_1_4_2_2_23"&gt;BLE Multiperipheral Application&lt;/a&gt;&amp;nbsp;example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/thread/125776?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 15:06:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca5b6a21-079e-4610-bc52-8af8d688de78</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Ok, I&amp;#39;m quite new so please forgive any misunderstanding.&lt;/p&gt;
&lt;p&gt;Really I&amp;#39;d like one hids that works with multiple clients, but as the hids implementation only stores one connection handle I&amp;#39;m not sure that&amp;#39;s possible without modifying it or having multiple instances, is that correct? Which of those options would you recommend?&lt;/p&gt;
&lt;p&gt;If I should use multiple instances, am I correct in thinking I should call ble_hids_on_ble_evt manually instead of registering the service for notifications with NRF_SDH_BLE_OBSERVER?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/thread/125772?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 15:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e2893bc-1caf-4324-b5a8-b5eef7ae7e90</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not quite sure if I understand your problem. In&amp;nbsp;Nordic&amp;#39;s&amp;nbsp;Softdevices you cannot have more than one GATT database, so associating&amp;nbsp;one instance of a service to just one connection doesn&amp;#39;t quite make sense to me. You can have two services of the same type in your database though, and map them to two different links. Then you can declare two&amp;nbsp;p_hids variables,&amp;nbsp;p_hids_1 and&amp;nbsp;p_hids_2, and have some logic in on_connect() that associates the instances with different links.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use ble_hids with multiple peripherals</title><link>https://devzone.nordicsemi.com/thread/125531?ContentTypeID=1</link><pubDate>Thu, 22 Mar 2018 12:40:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffb90d14-f1fa-4176-9cfa-f5e121f213be</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Should I not use NRF_SDH_BLE_OBSERVER(...) and instead call ble_hids_on_ble_evt when appropriate for that instance of the service?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>