Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8640805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:22:07+00:00 2026-06-12T11:22:07+00:00

I am looking for a way to connect to only the nearest peripheral based

  • 0

I am looking for a way to connect to only the nearest peripheral based on the RSSI. My goal is to leave other peripherals listed but only have the closest peripheral connect.

Since RSSI is only available while the device is connected, would it make sense to wait till all the devices are connected then determine the closest peripheral based on the RSSI then disconnect the rest?

Connect

- (void) connectToPeripheral:(CBPeripheral *)peripheral
{
    NSDictionary * options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE],CBConnectPeripheralOptionNotifyOnDisconnectionKey,nil];
    [myCBCentralManager connectPeripheral:peripheral options:options];
}

Delegates used

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI

- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error;

- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral;

CBPeripheral

/*!
 *  @property RSSI
 *
 *  @discussion While connected, the RSSI of the link in decibels.
 */
@property(retain, readonly) NSNumber *RSSI;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:22:09+00:00Added an answer on June 12, 2026 at 11:22 am

    This is what worked best for me. I initially scanned for Peripherals and then just selected the one with the highest RSSI. (Yes, this DOES report back the RSSI for every device. You do NOT need to be connected to it first).

    However, I found this to be unreliable. There were just too much fluctuations in the RSSI value. So I did the following instead.

    I used:

    NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:CBCentralManagerScanOptionAllowDuplicatesKey];//allow duplicates with YES
    [self.CM scanForPeripheralsWithServices:uuidArray options:options]; 
    

    The callback is:

    - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI 
    

    This will continue to report the RSSI of every peripheral until you call the method:

    [self.CM stopScan];
    

    The “didDiscoverPeripheral” you will be called for every ad packet that the Central (your iPhone) sees. Add a routine in this callback to average the RSSI for each unique peripheral found. My experience was that a 1 second scan time was sufficient, but it depends on how often your peripheral is advertising (i.e. its advertising interval)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a way to create a new VPN connection using only
sorry for my stupidity but I'm looking for a way to construct an object
I'm looking for a way to connect 1 browser to another without having to
I'm looking for way to create list view as like in IOS with pinned
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
I'm looking for way to write Javascript programs / scripts on desktop, not inside
I'm looking a way to build conditional assignments in bash: In Java it looks
I am using codeigniter and looking a way to enable directly editting of doc
My problem is that I was looking for way to use both storyboard and
First, I'm not looking a way to parse an RSS-feed. I am creating an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.