<?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>Basics of whitelist set function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35624/basics-of-whitelist-set-function</link><description>Hi, 
 Custom board based on nrf52810 
 Soft device - S112 v6.0 
 I am trying to understand the usage of the function pm_whitelist_set (pm_peer_id_t const * p_peers, uint32_t peer_cnt). I am not able to understand what to pass for peer_cnt ? for example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Jun 2018 07:34:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35624/basics-of-whitelist-set-function" /><item><title>RE: Basics of whitelist set function</title><link>https://devzone.nordicsemi.com/thread/137203?ContentTypeID=1</link><pubDate>Fri, 22 Jun 2018 07:34:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3db36f91-0350-4fce-9014-de91ded730d1</guid><dc:creator>rakesh_hirur</dc:creator><description>&lt;p&gt;Great Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Basics of whitelist set function</title><link>https://devzone.nordicsemi.com/thread/137201?ContentTypeID=1</link><pubDate>Fri, 22 Jun 2018 07:30:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d08b0787-bfbd-4c79-bda7-d667b6521ca0</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Yes, peer_cnt should be 0x02 if the whitelist contains 2 peers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Basics of whitelist set function</title><link>https://devzone.nordicsemi.com/thread/137147?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 15:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d8c67b5-cecf-44db-a867-890edbf40242</guid><dc:creator>rakesh_hirur</dc:creator><description>&lt;p&gt;Oh alright I see it. So just to absolutely clear, in the example that I have described, &lt;strong&gt;peer_cnt&lt;/strong&gt; should be &lt;strong&gt;0x02&lt;/strong&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Basics of whitelist set function</title><link>https://devzone.nordicsemi.com/thread/137126?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 13:58:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edfecd94-4ba6-4bc1-8337-64353ef99f4d</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;Hello Rakesh,&lt;/p&gt;
&lt;p&gt;peer_cnt is the total number of peers.&lt;/p&gt;
&lt;p&gt;Notice how examples using whitelist will get the stored list of peers first and then set the whitelist.&lt;/p&gt;
&lt;p&gt;Excerpt beneath from when hid keyboard example (peripheral/ble_app_hids) starts advertising&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for starting advertising.
 */
static void advertising_start(bool erase_bonds)
{
    if (erase_bonds == true)
    {
        delete_bonds();
        // Advertising is started by PM_EVT_PEERS_DELETE_SUCCEEDED event.
    }
    else
    {
        ret_code_t ret;

        memset(m_whitelist_peers, PM_PEER_ID_INVALID, sizeof(m_whitelist_peers));
        m_whitelist_peer_cnt = (sizeof(m_whitelist_peers) / sizeof(pm_peer_id_t));

        peer_list_get(m_whitelist_peers, &amp;amp;m_whitelist_peer_cnt);

        ret = pm_whitelist_set(m_whitelist_peers, m_whitelist_peer_cnt);
        APP_ERROR_CHECK(ret);

        // Setup the device identies list.
        // Some SoftDevices do not support this feature.
        ret = pm_device_identities_list_set(m_whitelist_peers, m_whitelist_peer_cnt);
        if (ret != NRF_ERROR_NOT_SUPPORTED)
        {
            APP_ERROR_CHECK(ret);
        }

        ret = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
        APP_ERROR_CHECK(ret);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Fetch the list of peer manager peer IDs.
 *
 * @param[inout] p_peers   The buffer where to store the list of peer IDs.
 * @param[inout] p_size    In: The size of the @p p_peers buffer.
 *                         Out: The number of peers copied in the buffer.
 */
static void peer_list_get(pm_peer_id_t * p_peers, uint32_t * p_size)
{
    pm_peer_id_t peer_id;
    uint32_t     peers_to_copy;

    peers_to_copy = (*p_size &amp;lt; BLE_GAP_WHITELIST_ADDR_MAX_COUNT) ?
                     *p_size : BLE_GAP_WHITELIST_ADDR_MAX_COUNT;

    peer_id = pm_next_peer_id_get(PM_PEER_ID_INVALID);
    *p_size = 0;

    while ((peer_id != PM_PEER_ID_INVALID) &amp;amp;&amp;amp; (peers_to_copy--))
    {
        p_peers[(*p_size)++] = peer_id;
        peer_id = pm_next_peer_id_get(peer_id);
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>