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

How can set listening single channel on scanner?

My Environment

  • Nrf52840
  • SDK : nrf51_15.0.0
  • soft device : s140
  • Target  : Scanner (central)

I am trying to set GAP parameter for listening single channel that is from beacon to use single channel.

so. i have had to set GAP Parameter for scanning but it is not work.

how can i right approach ? Please let me know

Question

1. How can i set GAP parameter for listening single channel on central(scanner)

* Please let me example code or sample link , if you can

Parents
  • Hi,

    Use the ble_gap_ch_mask_t structure in included in the ble_gap_scan_params_t structure and pass that to  sd_ble_gap_scan_start(). Take note of what the documentation says about the ble_gap_ch_mask_t structure:

    * Every channel is represented with a bit positioned as per channel index defined in Bluetooth Core Specification v5.0,
    * Vol 6, Part B, Section 1.4.1. The LSB contained in array element 0 represents channel index 0, and bit 39 represents
    * channel index 39. If a bit is set to 1, the channel is not used.

    To avoid scanning on channel 39 for example, you can modify m_scan_params in the ble_app_uart_c example like this:

    /** @brief Parameters used when scanning. */
    static ble_gap_scan_params_t const m_scan_params =
    {
        .active   = 1,
        .interval = SCAN_INTERVAL,
        .window   = SCAN_WINDOW,
        .timeout          = SCAN_DURATION,
        .scan_phys        = BLE_GAP_PHY_1MBPS,
        .filter_policy    = BLE_GAP_SCAN_FP_ACCEPT_ALL,
        .channel_mask[4] = 0x80, // <- DON'T SCAN ON CHANNEL 39
    };

  • Hi MartinBL,

    it is work.

    Thanks for your help

Reply Children
No Data
Related