Created
July 27, 2018 08:33
-
-
Save SunXiaoShan/cf0047fe62140e1f06066ef11fb428e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)centralManager:(CBCentralManager *)central | |
| didDiscoverPeripheral:(CBPeripheral *)peripheral | |
| advertisementData:(NSDictionary *)advertisementData | |
| RSSI:(NSNumber *)RSSI { | |
| if ([self isIgnorePeripheral:RSSI]) { | |
| return; | |
| } | |
| if (peripheral) { | |
| if (![self.peripherals containsObject:peripheral]) { | |
| [self.peripherals addObject:peripheral]; | |
| } | |
| [self.centralManager connectPeripheral:peripheral options:nil]; | |
| } | |
| } | |
| - (BOOL)isIgnorePeripheral:(NSNumber *)RSSI { | |
| // Received Signal Strength Indicator | |
| if (RSSI.integerValue > -15) { | |
| return YES; | |
| } | |
| if (RSSI.integerValue < -60) { | |
| return YES; | |
| } | |
| return NO; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment