Protocol

CBPeripheralManagerDelegate

The delegate of a CBPeripheralManager object must adopt the CBPeripheralManagerDelegate protocol, a protocol consisting of numerous optional methods and one required method. The protocol’s optional methods are used by the delegate to verify publishing and advertising, and to monitor read, write, and subscription requests from remote central devices. The protocol’s required method, which indicates whether the peripheral manager is available, is called when the peripheral manager’s state is updated.

Symbols

Monitoring Changes to the Peripheral Manager’s State

func peripheralManagerDidUpdateState(CBPeripheralManager)
Required.

Invoked when the peripheral manager's state is updated.

func peripheralManager(CBPeripheralManager, willRestoreState: [String : Any])

Invoked when the peripheral manager is about to be restored by the system.

Adding Services

func peripheralManager(CBPeripheralManager, didAdd: CBService, error: Error?)

Invoked when you publish a service, and any of its associated characteristics and characteristic descriptors, to the local Generic Attribute Profile (GATT) database.

Advertising Peripheral Data

func peripheralManagerDidStartAdvertising(CBPeripheralManager, error: Error?)

Invoked when you start advertising the local peripheral device’s data.

Monitoring Subscriptions to Characteristic Values

func peripheralManager(CBPeripheralManager, central: CBCentral, didSubscribeTo: CBCharacteristic)

Invoked when a remote central device subscribes to a characteristic’s value.

func peripheralManager(CBPeripheralManager, central: CBCentral, didUnsubscribeFrom: CBCharacteristic)

Invoked when a remote central device unsubscribes from a characteristic’s value.

func peripheralManagerIsReady(toUpdateSubscribers: CBPeripheralManager)

Invoked when a local peripheral device is again ready to send characteristic value updates.

Receiving Read and Write Requests

func peripheralManager(CBPeripheralManager, didReceiveRead: CBATTRequest)

Invoked when a local peripheral device receives an Attribute Protocol (ATT) read request for a characteristic that has a dynamic value.

func peripheralManager(CBPeripheralManager, didReceiveWrite: [CBATTRequest])

Invoked when a local peripheral device receives an Attribute Protocol (ATT) write request for a characteristic that has a dynamic value.

Constants

Relationships

Inherits From