<?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>How to pair nearby via RSSI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75552/how-to-pair-nearby-via-rssi</link><description>hello, 
 if i want to connect to a peripheral device with strongest RSSI. I need to get the RSSI before connecting. 
 and i know i can get the RSSI from event of BLE_GAP_EVT_ADV_REPORT. 
 But there is a lot of peripheral devices around central device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 May 2021 02:27:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75552/how-to-pair-nearby-via-rssi" /><item><title>RE: How to pair nearby via RSSI</title><link>https://devzone.nordicsemi.com/thread/311933?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 02:27:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32440ad1-c69e-4088-872b-b09653dc103b</guid><dc:creator>yu1998</dc:creator><description>&lt;p&gt;use phy address to distinguish I think I have&amp;nbsp; answered your question&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair nearby via RSSI</title><link>https://devzone.nordicsemi.com/thread/311932?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 02:14:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:455cde6a-0b50-488a-8ca7-b5b09b768f9a</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Try using .&lt;em&gt;peer_addr&lt;/em&gt;&amp;nbsp;in &lt;em&gt;ble_gap_evt_adv_report_t&lt;/em&gt; which is expected to be unique&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair nearby via RSSI</title><link>https://devzone.nordicsemi.com/thread/311929?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 01:58:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4021a790-49cc-408c-a4a9-36f46a1139dc</guid><dc:creator>Ryon_pan</dc:creator><description>&lt;p&gt;hello,&lt;/p&gt;
&lt;p&gt;the peripheral devices have the same UUID and device name.&lt;/p&gt;
&lt;p&gt;and if there are 20 peripheral devices broadcasting at the same time.&lt;/p&gt;
&lt;p&gt;how can i distinguish which peripheral device these RSSI come from,because&amp;nbsp;I want to arrange and combine the historical RSSI of all devices, remove the maximum and minimum values, and average&lt;/p&gt;
&lt;p&gt;Then pair nearby via RSSI.&lt;/p&gt;
&lt;p&gt;or&amp;nbsp;what should I do if I want to pair up nearby via RSSI.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair nearby via RSSI</title><link>https://devzone.nordicsemi.com/thread/311354?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 08:38:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a332522-f799-4567-85c5-a7b04a616fb5</guid><dc:creator>yu1998</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;typedef struct
{
  ble_gap_adv_report_type_t type;                  /**&amp;lt; Advertising report type. See @ref ble_gap_adv_report_type_t. */
  ble_gap_addr_t            peer_addr;             /**&amp;lt; 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&amp;#39;s identity address. */
  ble_gap_addr_t            direct_addr;           /**&amp;lt; 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;           /**&amp;lt; Indicates the PHY on which the primary advertising packet was received.
                                                        See @ref BLE_GAP_PHYS. */
  uint8_t                   secondary_phy;         /**&amp;lt; 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;              /**&amp;lt; 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;                  /**&amp;lt; Received Signal Strength Indication in dBm of the last packet received.
                                                        @note ERRATA-153 and ERRATA-225 require the rssi sample to be compensated based on a temperature measurement. */
  uint8_t                   ch_index;              /**&amp;lt; Channel Index on which the last advertising packet is received (0-39). */
  uint8_t                   set_id;                /**&amp;lt; 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;            /**&amp;lt; 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;                  /**&amp;lt; 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;           /**&amp;lt; 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;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;in ble. gap.h you cat get all information you need&lt;/p&gt;
&lt;p&gt;each struct can&amp;nbsp;&lt;span&gt;distinguish&amp;nbsp; with&amp;nbsp;ble_data_t&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;or address itself&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;typedef struct
{
    bool    is_not_empty;                   /**&amp;lt; Indicates that the structure is not empty. */
    deviceType cnt_type;
    uint8_t addr[BLE_GAP_ADDR_LEN];         /**&amp;lt; Device address. */
  
    char    dev_name[DEVICE_NAME_MAX_SIZE]; /**&amp;lt; Device name. */

  
} scanned_device_t;

&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;or you can just check the adreess with&amp;nbsp; scanned_device_t in ble_m.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;or if you are lucky the device do have device name compare with Name&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i wrote some app before i think both of this can accomplish your goal&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>