pub unsafe trait CBPeripheralManagerDelegate: NSObjectProtocol {
// Provided methods
unsafe fn peripheralManagerDidUpdateState(
&self,
peripheral: &CBPeripheralManager,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_willRestoreState(
&self,
peripheral: &CBPeripheralManager,
dict: &NSDictionary<NSString, AnyObject>,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManagerDidStartAdvertising_error(
&self,
peripheral: &CBPeripheralManager,
error: Option<&NSError>,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_didAddService_error(
&self,
peripheral: &CBPeripheralManager,
service: &CBService,
error: Option<&NSError>,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_central_didSubscribeToCharacteristic(
&self,
peripheral: &CBPeripheralManager,
central: &CBCentral,
characteristic: &CBCharacteristic,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_central_didUnsubscribeFromCharacteristic(
&self,
peripheral: &CBPeripheralManager,
central: &CBCentral,
characteristic: &CBCharacteristic,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_didReceiveReadRequest(
&self,
peripheral: &CBPeripheralManager,
request: &CBATTRequest,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_didReceiveWriteRequests(
&self,
peripheral: &CBPeripheralManager,
requests: &NSArray<CBATTRequest>,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManagerIsReadyToUpdateSubscribers(
&self,
peripheral: &CBPeripheralManager,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_didPublishL2CAPChannel_error(
&self,
peripheral: &CBPeripheralManager,
psm: CBL2CAPPSM,
error: Option<&NSError>,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_didUnpublishL2CAPChannel_error(
&self,
peripheral: &CBPeripheralManager,
psm: CBL2CAPPSM,
error: Option<&NSError>,
)
where Self: Sized + Message { ... }
unsafe fn peripheralManager_didOpenL2CAPChannel_error(
&self,
peripheral: &CBPeripheralManager,
channel: Option<&CBL2CAPChannel>,
error: Option<&NSError>,
)
where Self: Sized + Message { ... }
}CBPeripheralManager only.Expand description
The delegate of a
CBPeripheralManagerobject must adopt the
CBPeripheralManagerDelegate
protocol. 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.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn peripheralManagerDidUpdateState(
&self,
peripheral: &CBPeripheralManager,
)
Available on crate feature CBManager only.
unsafe fn peripheralManagerDidUpdateState( &self, peripheral: &CBPeripheralManager, )
CBManager only.Parameter peripheral: The peripheral manager whose state has changed.
Invoked whenever the peripheral manager’s state has been updated. Commands should only be issued when the state is
CBPeripheralManagerStatePoweredOn
. A state below
CBPeripheralManagerStatePoweredOn
implies that advertisement has paused and any connected centrals have been disconnected. If the state moves below
CBPeripheralManagerStatePoweredOff
, advertisement is stopped and must be explicitly restarted, and the
local database is cleared and all services must be re-added.
See: state
Sourceunsafe fn peripheralManager_willRestoreState(
&self,
peripheral: &CBPeripheralManager,
dict: &NSDictionary<NSString, AnyObject>,
)
Available on crate feature CBManager only.
unsafe fn peripheralManager_willRestoreState( &self, peripheral: &CBPeripheralManager, dict: &NSDictionary<NSString, AnyObject>, )
CBManager only.Parameter peripheral: The peripheral manager providing this information.
Parameter dict: A dictionary containing information about
peripheral
that was preserved by the system at the time the app was terminated.
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.
See also: CBPeripheralManagerRestoredStateServicesKey;
See also: CBPeripheralManagerRestoredStateAdvertisementDataKey;
Sourceunsafe fn peripheralManagerDidStartAdvertising_error(
&self,
peripheral: &CBPeripheralManager,
error: Option<&NSError>,
)
Available on crate feature CBManager only.
unsafe fn peripheralManagerDidStartAdvertising_error( &self, peripheral: &CBPeripheralManager, error: Option<&NSError>, )
CBManager only.Parameter peripheral: The peripheral manager providing this information.
Parameter error: If an error occurred, the cause of the failure.
This method returns the result of a
startAdvertising:call. If advertisement could not be started, the cause will be detailed in the error parameter.
Sourceunsafe fn peripheralManager_didAddService_error(
&self,
peripheral: &CBPeripheralManager,
service: &CBService,
error: Option<&NSError>,
)
Available on crate features CBAttribute and CBManager and CBService only.
unsafe fn peripheralManager_didAddService_error( &self, peripheral: &CBPeripheralManager, service: &CBService, error: Option<&NSError>, )
CBAttribute and CBManager and CBService only.Parameter peripheral: The peripheral manager providing this information.
Parameter service: The service that was added to the local database.
Parameter error: If an error occurred, the cause of the failure.
This method returns the result of an
addService:call. If the service could not be published to the local database, the cause will be detailed in the error parameter.
Sourceunsafe fn peripheralManager_central_didSubscribeToCharacteristic(
&self,
peripheral: &CBPeripheralManager,
central: &CBCentral,
characteristic: &CBCharacteristic,
)
Available on crate features CBAttribute and CBCentral and CBCharacteristic and CBManager and CBPeer only.
unsafe fn peripheralManager_central_didSubscribeToCharacteristic( &self, peripheral: &CBPeripheralManager, central: &CBCentral, characteristic: &CBCharacteristic, )
CBAttribute and CBCentral and CBCharacteristic and CBManager and CBPeer only.Parameter peripheral: The peripheral manager providing this update.
Parameter central: The central that issued the command.
Parameter characteristic: The characteristic on which notifications or indications were enabled.
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.
Sourceunsafe fn peripheralManager_central_didUnsubscribeFromCharacteristic(
&self,
peripheral: &CBPeripheralManager,
central: &CBCentral,
characteristic: &CBCharacteristic,
)
Available on crate features CBAttribute and CBCentral and CBCharacteristic and CBManager and CBPeer only.
unsafe fn peripheralManager_central_didUnsubscribeFromCharacteristic( &self, peripheral: &CBPeripheralManager, central: &CBCentral, characteristic: &CBCharacteristic, )
CBAttribute and CBCentral and CBCharacteristic and CBManager and CBPeer only.Parameter peripheral: The peripheral manager providing this update.
Parameter central: The central that issued the command.
Parameter characteristic: The characteristic on which notifications or indications were disabled.
This method is invoked when a central removes notifications/indications from characteristic .
Sourceunsafe fn peripheralManager_didReceiveReadRequest(
&self,
peripheral: &CBPeripheralManager,
request: &CBATTRequest,
)
Available on crate features CBATTRequest and CBManager only.
unsafe fn peripheralManager_didReceiveReadRequest( &self, peripheral: &CBPeripheralManager, request: &CBATTRequest, )
CBATTRequest and CBManager only.Parameter peripheral: The peripheral manager requesting this information.
Parameter request: A
CBATTRequest
object.
This method is invoked when peripheral receives an ATT request for a characteristic with a dynamic value. For every invocation of this method,
respondToRequest:withResult:must be called.
See: CBATTRequest
Sourceunsafe fn peripheralManager_didReceiveWriteRequests(
&self,
peripheral: &CBPeripheralManager,
requests: &NSArray<CBATTRequest>,
)
Available on crate features CBATTRequest and CBManager only.
unsafe fn peripheralManager_didReceiveWriteRequests( &self, peripheral: &CBPeripheralManager, requests: &NSArray<CBATTRequest>, )
CBATTRequest and CBManager only.Parameter peripheral: The peripheral manager requesting this information.
Parameter requests: A list of one or more
CBATTRequest
objects.
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,
respondToRequest:withResult: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 to
respondToRequest:withResult:
and none of the requests should be executed.
See: CBATTRequest
Sourceunsafe fn peripheralManagerIsReadyToUpdateSubscribers(
&self,
peripheral: &CBPeripheralManager,
)
Available on crate feature CBManager only.
unsafe fn peripheralManagerIsReadyToUpdateSubscribers( &self, peripheral: &CBPeripheralManager, )
CBManager only.Parameter peripheral: The peripheral manager providing this update.
This method is invoked after a failed call to
updateValue:forCharacteristic:onSubscribedCentrals:, when peripheral is again ready to send characteristic value updates.
Sourceunsafe fn peripheralManager_didPublishL2CAPChannel_error(
&self,
peripheral: &CBPeripheralManager,
psm: CBL2CAPPSM,
error: Option<&NSError>,
)
Available on crate features CBL2CAPChannel and CBManager only.
unsafe fn peripheralManager_didPublishL2CAPChannel_error( &self, peripheral: &CBPeripheralManager, psm: CBL2CAPPSM, error: Option<&NSError>, )
CBL2CAPChannel and CBManager only.Parameter peripheral: The peripheral manager requesting this information.
Parameter PSM: The PSM of the channel that was published.
Parameter error: If an error occurred, the cause of the failure.
This method is the response to a
publishL2CAPChannel:call. The PSM will contain the PSM that was assigned for the published channel
Sourceunsafe fn peripheralManager_didUnpublishL2CAPChannel_error(
&self,
peripheral: &CBPeripheralManager,
psm: CBL2CAPPSM,
error: Option<&NSError>,
)
Available on crate features CBL2CAPChannel and CBManager only.
unsafe fn peripheralManager_didUnpublishL2CAPChannel_error( &self, peripheral: &CBPeripheralManager, psm: CBL2CAPPSM, error: Option<&NSError>, )
CBL2CAPChannel and CBManager only.Parameter peripheral: The peripheral manager requesting this information.
Parameter PSM: The PSM of the channel that was published.
Parameter error: If an error occurred, the cause of the failure.
This method is the response to a
unpublishL2CAPChannel:call.
Sourceunsafe fn peripheralManager_didOpenL2CAPChannel_error(
&self,
peripheral: &CBPeripheralManager,
channel: Option<&CBL2CAPChannel>,
error: Option<&NSError>,
)
Available on crate features CBL2CAPChannel and CBManager only.
unsafe fn peripheralManager_didOpenL2CAPChannel_error( &self, peripheral: &CBPeripheralManager, channel: Option<&CBL2CAPChannel>, error: Option<&NSError>, )
CBL2CAPChannel and CBManager only.Parameter peripheral: The peripheral manager requesting this information.
Parameter channel: A
CBL2CAPChannel
object.
Parameter error: If an error occurred, the cause of the failure.
This method returns the result of establishing an incoming L2CAP channel , following publishing a channel using
publishL2CAPChannel: @link call.