Instance Method

centralManager:didDiscoverPeripheral:advertisementData:RSSI:

Invoked when the central manager discovers a peripheral while scanning.

Declaration

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary<NSString *,id> *)advertisementData RSSI:(NSNumber *)RSSI;

Parameters

central

The central manager providing the update.

peripheral

The discovered peripheral.

advertisementData

A dictionary containing any advertisement data.

RSSI

The current received signal strength indicator (RSSI) of the peripheral, in decibels.

Discussion

The advertisement data can be accessed through the keys listed in Advertisement Data Retrieval Keys. You must retain a local copy of the peripheral if any command is to be performed on it. In use cases where it makes sense for your app to automatically connect to a peripheral that is located within a certain range, you can use RSSI data to determine the proximity of a discovered peripheral device.