pub enum PairingDelegateRequest {
OnPairingRequest {
peer: Peer,
method: PairingMethod,
displayed_passkey: u32,
responder: PairingDelegateOnPairingRequestResponder,
},
OnPairingComplete {
id: PeerId,
success: bool,
control_handle: PairingDelegateControlHandle,
},
OnRemoteKeypress {
id: PeerId,
keypress: PairingKeypress,
control_handle: PairingDelegateControlHandle,
},
}
Expand description
A Bluetooth Pairing Delegate is responsible for confirming or denying pairing requests received from Bluetooth peers that connect or are being connected to the local device.
Any new pairing will result in a call to PairingDelegate.OnPairingRequest
,
including pairings where the InputCapability and OutputCapability are set
to none. The delegate is expected to have enough context to derive whether
to accept or deny the pairing.
Only one delegate is allowed to be set per system at a time. See
fuchsia.bluetooth.sys.Pairing
for how to set the pairing delegate.
Variants§
OnPairingRequest
Called to confirm a pairing. The pairing process will be continued if
accept
response is true and rejected otherwise.
If the pairing method requires a passkey it must be included as well.
Pairing methods that do not require a passkey ignore the entered_passkey
repsonse.
The pairing can fail (usually by timeout or peer disconnect) before the response is received. The OnPairingComplete method will be called when this occurs. Any response sent in this case will be ignored.
- request
peer
information about the peer being paired - request
method
method of pairing active. SeePairingMethod
- request
displayed_passkey
a passkey to display to the user if PASSKEY_DISPLAY or PASSKEY_COMPARISON is being used. Meaningless otherwise.
- response
accept
true if the pairing is accepted - response
entered_passkey
passkey entered by the user. Ignored unless method is PASSKEY_ENTRY.
OnPairingComplete
Called when the pairing procedure for a peer has been completed. This can be due to successful completion or an error (e.g. due to cancellation by the peer, a timeout, or disconnection).
- request
id
The Bluetooth peer ID of the peer which was being paired. - request
success
true if the pairing succeeded, otherwise false.
OnRemoteKeypress
Called to notify keypresses from the peer device during pairing using
PairingMethod.PASSKEY_DISPLAY
.
This event is used to provide key press events to the delegate for a responsive user experience as the user types the passkey on the peer device. This event will be called once for each keypress.
This event will only be called between when an OnPairingRequest has been sent for
id
and when OnPairingComplete is sent.
Note: many devices do not send these events
- request
id
The peer id of the peer that sent the keypress event. - request
keypress
The type of event which was received.
Implementations§
Source§impl PairingDelegateRequest
impl PairingDelegateRequest
pub fn into_on_pairing_request( self, ) -> Option<(Peer, PairingMethod, u32, PairingDelegateOnPairingRequestResponder)>
pub fn into_on_pairing_complete( self, ) -> Option<(PeerId, bool, PairingDelegateControlHandle)>
pub fn into_on_remote_keypress( self, ) -> Option<(PeerId, PairingKeypress, PairingDelegateControlHandle)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL