This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ble_app_hrs_c) Reason for using whitelist

Hi, I'm using nRF52832 Software Development Kit, PCA10040, S132.
Like the subject, I'd like to change 'ble_app_hrs_c' and connect it to my device.
I changed the service UUID and the characteristic UUID, but that doesn't connect.
I think it's because of whitelist, but why is it not used in "ble_app_uart" but only in "hrs"?
I want to erase the whitelist function, but I don't know how to approach it.
And does whitelist apply in on_whitelist_req()?
This is code..
static void on_whitelist_req(void)
{
    ret_code_t err_code;

    // Whitelist buffers.
    ble_gap_addr_t whitelist_addrs[8];
    ble_gap_irk_t  whitelist_irks[8];

    memset(whitelist_addrs, 0x00, sizeof(whitelist_addrs));
    memset(whitelist_irks,  0x00, sizeof(whitelist_irks));

    uint32_t addr_cnt = (sizeof(whitelist_addrs) / sizeof(ble_gap_addr_t));
    uint32_t irk_cnt  = (sizeof(whitelist_irks)  / sizeof(ble_gap_irk_t));

    // Reload the whitelist and whitelist all peers.
    whitelist_load();

    // Get the whitelist previously set using pm_whitelist_set().
    err_code = pm_whitelist_get(whitelist_addrs, &addr_cnt,
                                whitelist_irks,  &irk_cnt);

    if (((addr_cnt == 0) && (irk_cnt == 0)) ||
        (m_whitelist_disabled))
    {
        // Don't use whitelist.
        err_code = nrf_ble_scan_params_set(&m_scan, NULL);
        APP_ERROR_CHECK(err_code);
    }
}
  • I'm sorry. I'd like to add a few more questions.

    After the question, I studied more and succeeded in connecting with my device without whitelist.
    But if I don't use whitelist, I find that I don't receive data from peripheral continuously as in the example of hrs.
    So I want to change the whitelist and connect my device, but I don't know where to correct it. I want you to help me with this.

    BR,

    Lyrics

  • lyrics said:
    But if I don't use whitelist, I find that I don't receive data from peripheral continuously as in the example of hrs.

    Did you disable the whitelist by setting the filter policy to BLE_GAP_SCAN_FP_ACCEPT_ALL in the m_scan_param struct? The whitelist does not affect behaviour during connection, so I'm thinking the problem could be related to the way it was disabled.

    /**< Scan parameters requested for scanning and connection. */
    static ble_gap_scan_params_t const m_scan_param =
    {
        .active        = 0x01,
    #if (NRF_SD_BLE_API_VERSION > 7)
        .interval_us   = NRF_BLE_SCAN_SCAN_INTERVAL * UNIT_0_625_MS,
        .window_us     = NRF_BLE_SCAN_SCAN_WINDOW * UNIT_0_625_MS,
    #else
        .interval      = NRF_BLE_SCAN_SCAN_INTERVAL,
        .window        = NRF_BLE_SCAN_SCAN_WINDOW,
    #endif // (NRF_SD_BLE_API_VERSION > 7)
        .filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL, //BLE_GAP_SCAN_FP_WHITELIST,
        .timeout       = SCAN_DURATION_WITELIST,
        .scan_phys     = BLE_GAP_PHY_1MBPS,
    };
    

    Best regards,

    Vidar

  • Thank you for your answer.


    I found the same answer as your answer after posting the question, and I wanted to know if that was the correct answer. Thank you.

Related