<?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>Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38488/issue-in-implementing-whitelist</link><description>Hi, 
 I am working on nrf52832 , SDK15 and softdevice S132. I am modifying the ble_app_hrs example code in SDK 
 I was trying to implement a whitelist with the address of my ANdroid phone so that peripheral will connect only to this phone . 
 
 
 I have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 31 Dec 2018 07:11:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38488/issue-in-implementing-whitelist" /><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/163292?ContentTypeID=1</link><pubDate>Mon, 31 Dec 2018 07:11:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b0284ca-54c1-4abb-b2aa-5cf4560015a6</guid><dc:creator>GK</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I apologize for bothering( after a long time)&amp;nbsp; you thus.&lt;/p&gt;
&lt;p&gt;I have tried the following.&lt;/p&gt;
&lt;p&gt;I am having two RIGADO DK. I have installed nRFConnect Desktop App in my PC. So one device I connected to the PC to run the desktop App and another DK I used to flash the &amp;#39;modified ble_app_hrs&amp;#39; code. I have hardcoded the address of the DK (used to run the Desktop App) in the HRM code . And this code is flashed to other DK.&lt;/p&gt;
&lt;p&gt;Now if I press scan button in nRF Connect desktop App, the &amp;#39;Nordic HRM &amp;#39; name will get displayed in the list and when I press &amp;#39;connect &amp;#39;&amp;nbsp; button it will establish connection successfully.&lt;/p&gt;
&lt;p&gt;If I give a different address( hardcode with a different address) then the device is not getting displayed&amp;nbsp; in the liast of nRFConnect Desktop App. So this means the whhitelistin is working fine in this set up. Am I correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But if I use nRFConnect App from mobile phone (instead of using nRFConnect Desktop App) the connection is not happening? Is it because the address type in the phone and in the DK are different?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanking you in advance.&lt;/p&gt;
&lt;p&gt;with regards,&lt;/p&gt;
&lt;p&gt;Geetha&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/149835?ContentTypeID=1</link><pubDate>Fri, 21 Sep 2018 12:33:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca2266e7-5f47-497d-b53a-53bd3579678e</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t have the right address in your code you cant connect. You should be able to connect with the address &amp;nbsp;bc:41:01:33:15:dc added to your whitelist.&lt;/p&gt;
&lt;p&gt;- Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/148902?ContentTypeID=1</link><pubDate>Mon, 17 Sep 2018 06:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46d57720-1bf4-41ac-bd4e-d22cefa46f2c</guid><dc:creator>GK</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;But today also my phone shows the same address&amp;nbsp;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20180917_2D00_120507.png" /&gt;&lt;/p&gt;
&lt;p&gt;But still I could not connect to the phone.&lt;/p&gt;
&lt;p&gt;But I could connect successfully with nRFConnect on desktop.&lt;/p&gt;
&lt;p&gt;Is there anything I need to take care while connecting to phone?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;with regards,&lt;/p&gt;
&lt;p&gt;Geetha&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/148716?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 05:29:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f454b016-f6b1-4a2d-8ba2-d36ce34639e6</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi Geetha.&lt;/p&gt;
&lt;p&gt;There are 5 different macros that the&lt;strong&gt; peer_addr.addr_type&lt;/strong&gt; can be set as, you find if you look at the definition of &lt;strong&gt;BLE_GAP_ADDR_TYPE_RANDOM_STATIC&lt;/strong&gt; in SES.&lt;/p&gt;
&lt;p&gt;They are located in ble_gap.h, and are the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@defgroup BLE_GAP_ADDR_TYPES GAP Address types
 * @{ */
#define BLE_GAP_ADDR_TYPE_PUBLIC                        0x00 /**&amp;lt; Public (identity) address.*/
#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC                 0x01 /**&amp;lt; Random static (identity) address. */
#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE     0x02 /**&amp;lt; Random private resolvable address. */
#define BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE 0x03 /**&amp;lt; Random private non-resolvable address. */
#define BLE_GAP_ADDR_TYPE_ANONYMOUS                     0x7F /**&amp;lt; An advertiser may advertise without its address.
                                                                  This type of advertising is called anonymous. */
/**@} */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note that your phone may have changed its address from the one in the picture you sent, as most phones change Bluetooth address roughly every 15 minutes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/148679?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 18:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0951d2ed-0c70-4de3-8022-af72fa501d24</guid><dc:creator>GK</dc:creator><description>&lt;p&gt;Hello Andreas,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much. I also could&amp;nbsp; check it.&lt;/p&gt;
&lt;p&gt;If I change the address the connection is not happening..&lt;/p&gt;
&lt;p&gt;Thank you very much once again.&lt;/p&gt;
&lt;p&gt;If the address (of the phone) is not of type &amp;quot;BLE_GAP_ADDR_TYPE_RANDOM_STATIC&amp;quot;.Then how can I do this?&lt;/p&gt;
&lt;p&gt;Can you provide some code examples for the same.&lt;/p&gt;
&lt;p&gt;It will be a great help if you can help me in this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you in advance and once again. I could not have done this without your help.&lt;/p&gt;
&lt;p&gt;with regards,&lt;/p&gt;
&lt;p&gt;Geetha&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/148597?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 11:35:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6204bc79-daa9-46e6-9eea-bd849881a5f7</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi Geetha.&lt;/p&gt;
&lt;p&gt;First problem here is that you have used the Wi-FI MAC address. You need to use your Bluetooth address.&lt;br /&gt;Note also that most smart phones change Bluetooth address roughly every 15 minute.&lt;br /&gt;&lt;br /&gt;I made the following change to your code and ran it successfully:&lt;/p&gt;
&lt;p&gt;1) In &lt;strong&gt;advertising_init()&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void advertising_init(void)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = true;
    //init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;  // Comment this line out if you havn&amp;#39;t done it already
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids  = m_adv_uuids;

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;


    init.advdata.flags                     = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; // These two lines are correct
    init.config.ble_adv_whitelist_enabled = true;									//

   
    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2) In on_adv_evt():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	ble_gap_addr_t peer_addr; //peer device address
	ble_gap_addr_t const * p_peer_addr;
	// ble_gap_addr_t const * const * pp_peer_addr; --&amp;gt; This was not needed

	----------------------------------------
	........................................
	----------------------------------------

	case BLE_ADV_EVT_WHITELIST_REQUEST:
	memset(&amp;amp;peer_addr, 0x00, sizeof(peer_addr));


	//peer_addr.addr[0] = 0xbc;			| Reverse the order you placed these:
	//peer_addr.addr[1] = 0x41;			|
	//peer_addr.addr[2] = 0x01;			| Also note that you used wrong address,
	//peer_addr.addr[3] = 0x31;			| as I said in my reply
	//peer_addr.addr[4] = 0x8f;			| 
	//peer_addr.addr[5] = 0x48; 		| Insert the address like this:

	peer_addr.addr[5] = 0xbc;
    peer_addr.addr[4] = 0x41;
    peer_addr.addr[3] = 0x01;
    peer_addr.addr[2] = 0x31;
    peer_addr.addr[1] = 0x8f;
    peer_addr.addr[0] = 0x48;

    peer_addr.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC; // Add the address type

	//peer_addr pointers. Double pointers for the win! :S
	p_peer_addr = &amp;amp;peer_addr;
	//pp_peer_addr = &amp;amp;p_peer_addr; --&amp;gt; Remove this line

	// Set white list
	err_code = sd_ble_gap_whitelist_set(&amp;amp;p_peer_addr, 0x01); //swap pp_peer_addr with &amp;amp;p_peer_addr, like this
	if (err_code == NRF_SUCCESS)
	{
		NRF_LOG_INFO(&amp;quot;Successfully set whitelist!\n&amp;quot;);
	}

	APP_ERROR_CHECK(err_code); //Added an error check, always useful to have.

	// White list reply
	err_code = ble_advertising_whitelist_reply(&amp;amp;m_advertising,p_peer_addr, 1, NULL, (uint32_t) NULL);
	if (err_code == NRF_SUCCESS)
	{
		NRF_LOG_INFO( &amp;quot;Whitelist replied\n&amp;quot;);
	}
	APP_ERROR_CHECK(err_code);

	break;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see in the code you had not set the address type for the&lt;strong&gt; peer_addr&lt;/strong&gt; pointer.&lt;/p&gt;
&lt;p&gt;I ran this successfully with the use of nRF Connect, where you easy can see your Bluetooth Address, example in the picture below:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-0b08e22410704dfe99e02ec4ba703019/pastedimage1536836362642v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The address I added to my whitelist was:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;            peer_addr.addr[5] = 0xE3;
            peer_addr.addr[4] = 0x30;
            peer_addr.addr[3] = 0x15;
            peer_addr.addr[2] = 0x8D;
            peer_addr.addr[1] = 0xDA;
            peer_addr.addr[0] = 0x72;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can se, this is the address i read below nRF5x (E3:30:15:8D:DA:72)&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;- Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/148585?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 10:40:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85f5af85-fd85-4b19-8343-95b28cf5f0a0</guid><dc:creator>GK</dc:creator><description>&lt;p&gt;HI,&lt;/p&gt;
&lt;p&gt;Sorry for the trouble.&lt;/p&gt;
&lt;p&gt;I have modified the same.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue in implementing whitelist</title><link>https://devzone.nordicsemi.com/thread/148579?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 09:56:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42ca0d79-a34c-48d6-94f3-7ef98408df56</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Note the &amp;#39;&lt;strong&gt;Insert Code&lt;/strong&gt;&amp;#39; option on the &amp;#39;Insert&amp;#39; menu - that&amp;#39;s the way to get your code properly formatted!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>