centralManager(_:didDiscover:advertisementData:rssi:)
Tells the delegate the central manager discovered a peripheral while scanning for devices.
Declaration
optional func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber)Parameters
- central:
The central manager that provides 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
You can access the advertisement data with the keys listed in Advertisement Data Retrieval Keys. You must retain a local copy of the peripheral if you want to perform commands on it. Use the RSSI data to determine the proximity of a discoverable peripheral device, and whether you want to connect to it automatically.