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

whitelisting in NRF52480 Dongle using pc-ble-driver-py

I am using NRF52840 Dongle to scan all the BLE advertisement packets.

I wish to scan for the BLE advertisements packets only from a particular device using the whitelisting feature.

Kindly suggest and provide a sample code snippet on how to do the whitelisting configuration using pc_ble_driver_py python library.

Parents
  • Hey Vishal, 
    Sorry for the late reply, we're a bit short-staffed during the summer vacations.

    I believe you need to call connect() with a scan_params where you've defined a pointer to the whitelist structure. 

    I believe this is the structure from ble_gap.h in https://github.com/NordicSemiconductor/pc-ble-driver:

    /**@brief GAP scanning parameters. */
    typedef struct
    {
    uint8_t active : 1;                          /**< If 1, perform active scanning (scan requests). */
    uint8_t selective : 1;                     /**< If 1, ignore unknown devices (non whitelisted). */
    ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */
    uint16_t interval;                          /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
    uint16_t window;                         /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
    uint16_t timeout;                          /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
    } ble_gap_scan_params_t;

    /**@brief Whitelist structure. */
    typedef struct
    {
    ble_gap_addr_t **pp_addrs; /**< Pointer to an array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */
    uint8_t addr_count;               /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */
    ble_gap_irk_t **pp_irks;        /**< Pointer to an array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are    given. */
    uint8_t irk_count;                  /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */
    } ble_gap_whitelist_t;
    You need to create a ble_gap_whitelist_t structure and add it to the scan_params object before you call connect().

    I'm going on vacation for a week myself, but I'll assign your case to another Tech Supporter.

    BR,

    Håkon Holdhus

Reply
  • Hey Vishal, 
    Sorry for the late reply, we're a bit short-staffed during the summer vacations.

    I believe you need to call connect() with a scan_params where you've defined a pointer to the whitelist structure. 

    I believe this is the structure from ble_gap.h in https://github.com/NordicSemiconductor/pc-ble-driver:

    /**@brief GAP scanning parameters. */
    typedef struct
    {
    uint8_t active : 1;                          /**< If 1, perform active scanning (scan requests). */
    uint8_t selective : 1;                     /**< If 1, ignore unknown devices (non whitelisted). */
    ble_gap_whitelist_t * p_whitelist; /**< Pointer to whitelist, NULL if no whitelist or the current active whitelist is to be used. */
    uint16_t interval;                          /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
    uint16_t window;                         /**< Scan window between 0x0004 and 0x4000 in 0.625ms units (2.5ms to 10.24s). */
    uint16_t timeout;                          /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */
    } ble_gap_scan_params_t;

    /**@brief Whitelist structure. */
    typedef struct
    {
    ble_gap_addr_t **pp_addrs; /**< Pointer to an array of device address pointers, pointing to addresses to be used in whitelist. NULL if none are given. */
    uint8_t addr_count;               /**< Count of device addresses in array, up to @ref BLE_GAP_WHITELIST_ADDR_MAX_COUNT. */
    ble_gap_irk_t **pp_irks;        /**< Pointer to an array of Identity Resolving Key (IRK) pointers, each pointing to an IRK in the whitelist. NULL if none are    given. */
    uint8_t irk_count;                  /**< Count of IRKs in array, up to @ref BLE_GAP_WHITELIST_IRK_MAX_COUNT. */
    } ble_gap_whitelist_t;
    You need to create a ble_gap_whitelist_t structure and add it to the scan_params object before you call connect().

    I'm going on vacation for a week myself, but I'll assign your case to another Tech Supporter.

    BR,

    Håkon Holdhus

Children
Related