Get scanned device report in Nordic BLE Central Mode

Hello, I am using SDK nRF5_SDK_15.3.0_59ac345 with nrf32832 in BLE central mode and want to connect the closest peripheral device with a name prefix with "XYZ_ ". I know that exciting filter can't help me and I need to write on code. The issue is that I am not able to find scan reports which can tell me about all nearby device names and RSSI. 

Can anyone please help me?

Parents
  • Hi Chandan, 

    If you want to manual filtering you can do normal scanning without filter and then catch the NRF_BLE_SCAN_EVT_NOT_FOUND event in the scan_evt_handler(). In that you can look at the param.p_not_found to see the content of the advertising packet to manually filter the advertiser. 

  • Thanks for the reply. p_not_found has below structure but can't find device name parameter. Please suggest. 

    typedef struct
    {
      ble_gap_adv_report_type_t type;                  /**< Advertising report type. See @ref ble_gap_adv_report_type_t. */
      ble_gap_addr_t            peer_addr;             /**< Bluetooth address of the peer device. If the peer_addr is resolved:
                                                            @ref ble_gap_addr_t::addr_id_peer is set to 1 and the address is the
                                                            peer's identity address. */
      ble_gap_addr_t            direct_addr;           /**< Contains the target address of the advertising event if
                                                            @ref ble_gap_adv_report_type_t::directed is set to 1. If the
                                                            SoftDevice was able to resolve the address,
                                                            @ref ble_gap_addr_t::addr_id_peer is set to 1 and the direct_addr
                                                            contains the local identity address. If the target address of the
                                                            advertising event is @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE,
                                                            and the SoftDevice was unable to resolve it, the application may try
                                                            to resolve this address to find out if the advertising event was
                                                            directed to us. */
      uint8_t                   primary_phy;           /**< Indicates the PHY on which the primary advertising packet was received.
                                                            See @ref BLE_GAP_PHYS. */
      uint8_t                   secondary_phy;         /**< Indicates the PHY on which the secondary advertising packet was received.
                                                            See @ref BLE_GAP_PHYS. This field is set to @ref BLE_GAP_PHY_NOT_SET if no packets
                                                            were received on a secondary advertising channel. */
      int8_t                    tx_power;              /**< TX Power reported by the advertiser in the last packet header received.
                                                            This field is set to @ref BLE_GAP_POWER_LEVEL_INVALID if the
                                                            last received packet did not contain the Tx Power field.
                                                            @note TX Power is only included in extended advertising packets. */
      int8_t                    rssi;                  /**< Received Signal Strength Indication in dBm of the last packet received. */
      uint8_t                   ch_index;              /**< Channel Index on which the last advertising packet is received (0-39). */
      uint8_t                   set_id;                /**< Set ID of the received advertising data. Set ID is not present
                                                            if set to @ref BLE_GAP_ADV_REPORT_SET_ID_NOT_AVAILABLE. */
      uint16_t                  data_id:12;            /**< The advertising data ID of the received advertising data. Data ID
                                                            is not present if @ref ble_gap_evt_adv_report_t::set_id is set to
                                                            @ref BLE_GAP_ADV_REPORT_SET_ID_NOT_AVAILABLE. */
      ble_data_t                data;                  /**< Received advertising or scan response data. If
                                                            @ref ble_gap_adv_report_type_t::status is not set to
                                                            @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA, the data buffer provided
                                                            in @ref sd_ble_gap_scan_start is now released. */
      ble_gap_aux_pointer_t     aux_pointer;           /**< The offset and PHY of the next advertising packet in this extended advertising
                                                            event. @note This field is only set if @ref ble_gap_adv_report_type_t::status
                                                            is set to @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA. */
    } ble_gap_evt_adv_report_t;
    d

Reply
  • Thanks for the reply. p_not_found has below structure but can't find device name parameter. Please suggest. 

    typedef struct
    {
      ble_gap_adv_report_type_t type;                  /**< Advertising report type. See @ref ble_gap_adv_report_type_t. */
      ble_gap_addr_t            peer_addr;             /**< Bluetooth address of the peer device. If the peer_addr is resolved:
                                                            @ref ble_gap_addr_t::addr_id_peer is set to 1 and the address is the
                                                            peer's identity address. */
      ble_gap_addr_t            direct_addr;           /**< Contains the target address of the advertising event if
                                                            @ref ble_gap_adv_report_type_t::directed is set to 1. If the
                                                            SoftDevice was able to resolve the address,
                                                            @ref ble_gap_addr_t::addr_id_peer is set to 1 and the direct_addr
                                                            contains the local identity address. If the target address of the
                                                            advertising event is @ref BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE,
                                                            and the SoftDevice was unable to resolve it, the application may try
                                                            to resolve this address to find out if the advertising event was
                                                            directed to us. */
      uint8_t                   primary_phy;           /**< Indicates the PHY on which the primary advertising packet was received.
                                                            See @ref BLE_GAP_PHYS. */
      uint8_t                   secondary_phy;         /**< Indicates the PHY on which the secondary advertising packet was received.
                                                            See @ref BLE_GAP_PHYS. This field is set to @ref BLE_GAP_PHY_NOT_SET if no packets
                                                            were received on a secondary advertising channel. */
      int8_t                    tx_power;              /**< TX Power reported by the advertiser in the last packet header received.
                                                            This field is set to @ref BLE_GAP_POWER_LEVEL_INVALID if the
                                                            last received packet did not contain the Tx Power field.
                                                            @note TX Power is only included in extended advertising packets. */
      int8_t                    rssi;                  /**< Received Signal Strength Indication in dBm of the last packet received. */
      uint8_t                   ch_index;              /**< Channel Index on which the last advertising packet is received (0-39). */
      uint8_t                   set_id;                /**< Set ID of the received advertising data. Set ID is not present
                                                            if set to @ref BLE_GAP_ADV_REPORT_SET_ID_NOT_AVAILABLE. */
      uint16_t                  data_id:12;            /**< The advertising data ID of the received advertising data. Data ID
                                                            is not present if @ref ble_gap_evt_adv_report_t::set_id is set to
                                                            @ref BLE_GAP_ADV_REPORT_SET_ID_NOT_AVAILABLE. */
      ble_data_t                data;                  /**< Received advertising or scan response data. If
                                                            @ref ble_gap_adv_report_type_t::status is not set to
                                                            @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA, the data buffer provided
                                                            in @ref sd_ble_gap_scan_start is now released. */
      ble_gap_aux_pointer_t     aux_pointer;           /**< The offset and PHY of the next advertising packet in this extended advertising
                                                            event. @note This field is only set if @ref ble_gap_adv_report_type_t::status
                                                            is set to @ref BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA. */
    } ble_gap_evt_adv_report_t;
    d

Children
No Data
Related