Package apple.corebluetooth.protocol
Interface CBPeripheralManagerDelegate
-
public interface CBPeripheralManagerDelegate[@protocol] CBPeripheralManagerDelegate The delegate of a @link CBPeripheralManager @/link object must adopt theCBPeripheralManagerDelegateprotocol. The single required method indicates the availability of the peripheral manager, while the optional methods provide information about centrals, which can connect and access the local database.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidperipheralManagerCentralDidSubscribeToCharacteristic(CBPeripheralManager peripheral, CBCentral central, CBCharacteristic characteristic)peripheralManager:central:didSubscribeToCharacteristic: This method is invoked when a central configures characteristic to notify or indicate.default voidperipheralManagerCentralDidUnsubscribeFromCharacteristic(CBPeripheralManager peripheral, CBCentral central, CBCharacteristic characteristic)peripheralManager:central:didUnsubscribeFromCharacteristic: This method is invoked when a central removes notifications/indications from characteristic.default voidperipheralManagerDidAddServiceError(CBPeripheralManager peripheral, CBService service, NSError error)peripheralManager:didAddService:error: This method returns the result of an @link addService: @/link call.default voidperipheralManagerDidOpenL2CAPChannelError(CBPeripheralManager peripheral, CBL2CAPChannel channel, NSError error)peripheralManager:didOpenL2CAPChannel:error: This method returns the result of establishing an incoming L2CAP channel , following publishing a channel using @link publishL2CAPChannel: @link call.default voidperipheralManagerDidPublishL2CAPChannelError(CBPeripheralManager peripheral, char PSM, NSError error)peripheralManager:didPublishL2CAPChannel:error: This method is the response to a @link publishL2CAPChannel: @/link call.default voidperipheralManagerDidReceiveReadRequest(CBPeripheralManager peripheral, CBATTRequest request)peripheralManager:didReceiveReadRequest: This method is invoked when peripheral receives an ATT request for a characteristic with a dynamic value.default voidperipheralManagerDidReceiveWriteRequests(CBPeripheralManager peripheral, NSArray<? extends CBATTRequest> requests)peripheralManager:didReceiveWriteRequests: This method is invoked when peripheral receives an ATT request or command for one or more characteristics with a dynamic value.default voidperipheralManagerDidStartAdvertisingError(CBPeripheralManager peripheral, NSError error)peripheralManagerDidStartAdvertising:error: This method returns the result of a @link startAdvertising: @/link call.default voidperipheralManagerDidUnpublishL2CAPChannelError(CBPeripheralManager peripheral, char PSM, NSError error)peripheralManager:didUnublishL2CAPChannel:error: This method is the response to a @link unpublishL2CAPChannel: @/link call.voidperipheralManagerDidUpdateState(CBPeripheralManager peripheral)peripheralManagerDidUpdateState: Invoked whenever the peripheral manager's state has been updated.default voidperipheralManagerIsReadyToUpdateSubscribers(CBPeripheralManager peripheral)peripheralManagerIsReadyToUpdateSubscribers: This method is invoked after a failed call to @link updateValue:forCharacteristic:onSubscribedCentrals: @/link, when peripheral is again ready to send characteristic value updates.default voidperipheralManagerWillRestoreState(CBPeripheralManager peripheral, NSDictionary<java.lang.String,?> dict)peripheralManager:willRestoreState: For apps that opt-in to state preservation and restoration, this is the first method invoked when your app is relaunched into the background to complete some Bluetooth-related task.
-
-
-
Method Detail
-
peripheralManagerCentralDidSubscribeToCharacteristic
default void peripheralManagerCentralDidSubscribeToCharacteristic(CBPeripheralManager peripheral, CBCentral central, CBCharacteristic characteristic)
peripheralManager:central:didSubscribeToCharacteristic: This method is invoked when a central configures characteristic to notify or indicate. It should be used as a cue to start sending updates as the characteristic value changes.- Parameters:
peripheral- The peripheral manager providing this update.central- The central that issued the command.characteristic- The characteristic on which notifications or indications were enabled.
-
peripheralManagerCentralDidUnsubscribeFromCharacteristic
default void peripheralManagerCentralDidUnsubscribeFromCharacteristic(CBPeripheralManager peripheral, CBCentral central, CBCharacteristic characteristic)
peripheralManager:central:didUnsubscribeFromCharacteristic: This method is invoked when a central removes notifications/indications from characteristic.- Parameters:
peripheral- The peripheral manager providing this update.central- The central that issued the command.characteristic- The characteristic on which notifications or indications were disabled.
-
peripheralManagerDidAddServiceError
default void peripheralManagerDidAddServiceError(CBPeripheralManager peripheral, CBService service, NSError error)
peripheralManager:didAddService:error: This method returns the result of an @link addService: @/link call. If the service could not be published to the local database, the cause will be detailed in the error parameter.- Parameters:
peripheral- The peripheral manager providing this information.service- The service that was added to the local database.error- If an error occurred, the cause of the failure.
-
peripheralManagerDidReceiveReadRequest
default void peripheralManagerDidReceiveReadRequest(CBPeripheralManager peripheral, CBATTRequest request)
peripheralManager:didReceiveReadRequest: This method is invoked when peripheral receives an ATT request for a characteristic with a dynamic value. For every invocation of this method, @link respondToRequest:withResult: @/link must be called.- Parameters:
peripheral- The peripheral manager requesting this information.request- ACBATTRequestobject.- See Also:
CBATTRequest
-
peripheralManagerDidReceiveWriteRequests
default void peripheralManagerDidReceiveWriteRequests(CBPeripheralManager peripheral, NSArray<? extends CBATTRequest> requests)
peripheralManager:didReceiveWriteRequests: This method is invoked when peripheral receives an ATT request or command for one or more characteristics with a dynamic value. For every invocation of this method, @link respondToRequest:withResult: @/link should be called exactly once. If requests contains multiple requests, they must be treated as an atomic unit. If the execution of one of the requests would cause a failure, the request and error reason should be provided torespondToRequest:withResult:and none of the requests should be executed.- Parameters:
peripheral- The peripheral manager requesting this information.requests- A list of one or moreCBATTRequestobjects.- See Also:
CBATTRequest
-
peripheralManagerWillRestoreState
default void peripheralManagerWillRestoreState(CBPeripheralManager peripheral, NSDictionary<java.lang.String,?> dict)
peripheralManager:willRestoreState: For apps that opt-in to state preservation and restoration, this is the first method invoked when your app is relaunched into the background to complete some Bluetooth-related task. Use this method to synchronize your app's state with the state of the Bluetooth system.- Parameters:
peripheral- The peripheral manager providing this information.dict- A dictionary containing information about peripheral that was preserved by the system at the time the app was terminated.
-
peripheralManagerDidStartAdvertisingError
default void peripheralManagerDidStartAdvertisingError(CBPeripheralManager peripheral, NSError error)
peripheralManagerDidStartAdvertising:error: This method returns the result of a @link startAdvertising: @/link call. If advertisement could not be started, the cause will be detailed in the error parameter.- Parameters:
peripheral- The peripheral manager providing this information.error- If an error occurred, the cause of the failure.
-
peripheralManagerDidUpdateState
void peripheralManagerDidUpdateState(CBPeripheralManager peripheral)
peripheralManagerDidUpdateState: Invoked whenever the peripheral manager's state has been updated. Commands should only be issued when the state isCBPeripheralManagerStatePoweredOn. A state belowCBPeripheralManagerStatePoweredOnimplies that advertisement has paused and any connected centrals have been disconnected. If the state moves belowCBPeripheralManagerStatePoweredOff, advertisement is stopped and must be explicitly restarted, and the local database is cleared and all services must be re-added.- Parameters:
peripheral- The peripheral manager whose state has changed.- See Also:
state
-
peripheralManagerIsReadyToUpdateSubscribers
default void peripheralManagerIsReadyToUpdateSubscribers(CBPeripheralManager peripheral)
peripheralManagerIsReadyToUpdateSubscribers: This method is invoked after a failed call to @link updateValue:forCharacteristic:onSubscribedCentrals: @/link, when peripheral is again ready to send characteristic value updates.- Parameters:
peripheral- The peripheral manager providing this update.
-
peripheralManagerDidOpenL2CAPChannelError
default void peripheralManagerDidOpenL2CAPChannelError(CBPeripheralManager peripheral, CBL2CAPChannel channel, NSError error)
peripheralManager:didOpenL2CAPChannel:error: This method returns the result of establishing an incoming L2CAP channel , following publishing a channel using @link publishL2CAPChannel: @link call.- Parameters:
peripheral- The peripheral manager requesting this information.channel- ACBL2CAPChannelobject.error- If an error occurred, the cause of the failure.
-
peripheralManagerDidPublishL2CAPChannelError
default void peripheralManagerDidPublishL2CAPChannelError(CBPeripheralManager peripheral, char PSM, NSError error)
peripheralManager:didPublishL2CAPChannel:error: This method is the response to a @link publishL2CAPChannel: @/link call. The PSM will contain the PSM that was assigned for the published channel- Parameters:
peripheral- The peripheral manager requesting this information.PSM- The PSM of the channel that was published.error- If an error occurred, the cause of the failure.
-
peripheralManagerDidUnpublishL2CAPChannelError
default void peripheralManagerDidUnpublishL2CAPChannelError(CBPeripheralManager peripheral, char PSM, NSError error)
peripheralManager:didUnublishL2CAPChannel:error: This method is the response to a @link unpublishL2CAPChannel: @/link call.- Parameters:
peripheral- The peripheral manager requesting this information.PSM- The PSM of the channel that was published.error- If an error occurred, the cause of the failure.
-
-