Protocol

CBPeripheralDelegate

The delegate of a CBPeripheral object must adopt the CBPeripheralDelegate protocol. The delegate uses this protocol’s methods to monitor the discovery, exploration, and interaction of a remote peripheral’s services and properties. There are no required methods in this protocol.

Topics

Discovering Services

func peripheral(CBPeripheral, didDiscoverServices: Error?)

Invoked when you discover the peripheral’s available services.

func peripheral(CBPeripheral, didDiscoverIncludedServicesFor: CBService, error: Error?)

Invoked when you discover the included services of a specified service.

Discovering Characteristics and Characteristic Descriptors

func peripheral(CBPeripheral, didDiscoverCharacteristicsFor: CBService, error: Error?)

Invoked when you discover the characteristics of a specified service.

func peripheral(CBPeripheral, didDiscoverDescriptorsFor: CBCharacteristic, error: Error?)

Invoked when you discover the descriptors of a specified characteristic.

Retrieving Characteristic and Characteristic Descriptor Values

func peripheral(CBPeripheral, didUpdateValueFor: CBCharacteristic, error: Error?)

Invoked when you retrieve a specified characteristic’s value, or when the peripheral device notifies your app that the characteristic’s value has changed.

func peripheral(CBPeripheral, didUpdateValueFor: CBDescriptor, error: Error?)

Invoked when you retrieve a specified characteristic descriptor’s value.

Writing Characteristic and Characteristic Descriptor Values

func peripheral(CBPeripheral, didWriteValueFor: CBCharacteristic, error: Error?)

Invoked when you write data to a characteristic’s value.

func peripheral(CBPeripheral, didWriteValueFor: CBDescriptor, error: Error?)

Invoked when you write data to a characteristic descriptor’s value.

Managing Notifications for a Characteristic’s Value

func peripheral(CBPeripheral, didUpdateNotificationStateFor: CBCharacteristic, error: Error?)

Invoked when the peripheral receives a request to start or stop providing notifications for a specified characteristic’s value.

Retrieving a Peripheral’s Received Signal Strength Indicator (RSSI) Data

func peripheralDidUpdateRSSI(CBPeripheral, error: Error?)

Invoked when you retrieve the value of the peripheral’s current RSSI while it is connected to the central manager.

Deprecated
func peripheral(CBPeripheral, didReadRSSI: NSNumber, error: Error?)

Invoked after you call readRSSI() to retrieve the value of the peripheral’s current RSSI while it is connected to the central manager.

Monitoring Changes to a Peripheral’s Name or Services

func peripheralDidUpdateName(CBPeripheral)

Invoked when a peripheral’s name changes.

func peripheral(CBPeripheral, didModifyServices: [CBService])

Invoked when a peripheral’s services have changed.

Relationships

Inherits From

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software