pub enum AccessRequest {
SetPairingDelegate {
input: InputCapability,
output: OutputCapability,
delegate: ClientEnd<PairingDelegateMarker>,
control_handle: AccessControlHandle,
},
SetLocalName {
name: String,
control_handle: AccessControlHandle,
},
SetDeviceClass {
device_class: DeviceClass,
control_handle: AccessControlHandle,
},
MakeDiscoverable {
token: ServerEnd<ProcedureTokenMarker>,
responder: AccessMakeDiscoverableResponder,
},
StartDiscovery {
token: ServerEnd<ProcedureTokenMarker>,
responder: AccessStartDiscoveryResponder,
},
WatchPeers {
responder: AccessWatchPeersResponder,
},
Connect {
id: PeerId,
responder: AccessConnectResponder,
},
Disconnect {
id: PeerId,
responder: AccessDisconnectResponder,
},
Pair {
id: PeerId,
options: PairingOptions,
responder: AccessPairResponder,
},
Forget {
id: PeerId,
responder: AccessForgetResponder,
},
}
Expand description
Protocol that abstracts the operational modes and procedures defined in the Bluetooth Generic Access Profile (see Core Specification v5.1, Vol 3, Part C).
The procedures under this protocol apply to the system as a whole. The Bluetooth controller that plays an active role in these procedures can be managed using the HostWatcher protocol.
The procedures initiated by an Access protocol instance are terminated when the underlying channel is closed.
Variants§
SetPairingDelegate
Assign a PairingDelegate to respond to drive pairing procedures. The delegate will be configured to use the provided I/O capabilities to determine the pairing method.
Only one PairingDelegate can be registered at a time. Closing a PairingDelegate aborts all on-going pairing procedures associated with a delegate and closes the PairingDelegate previously assigned for this Access instance.
- request
input
Bluetooth input capability - request
output
Bluetooth output capability - request
delegate
The client end of a PairingDelegate channel.
§Deprecation - This method is folded into the fuchsia.bluetooth.sys/Pairing protocol. See
https://fxbug.dev/42180744 for more details on the migration.
Fields
input: InputCapability
output: OutputCapability
delegate: ClientEnd<PairingDelegateMarker>
control_handle: AccessControlHandle
SetLocalName
Assign a local name for the Bluetooth system. This name will be visible to nearby peers when the system is in discoverable mode and during name discovery procedures.
- request
name
The complete local name to assign to the system.
SetDeviceClass
Set the local device class that will be visible to nearby peers when the system is in discoverable mode.
- request
device_class
The device class to assign to the system.
MakeDiscoverable
Put the system into the “General Discoverable” mode on the BR/EDR transport. The active host will respond to general inquiry (by regularly entering the inquiry scan mode).
- request
token
[fuchsia.bluetooth.sys/ProcedureToken
] that will remain valid while a discoverable mode session is active. NOTE: The system may remain discoverable until all [fuchsia.bluetooth.sys/Access
] clients drop their tokens.
- error Reports Error.FAILED if inquiry mode cannot be entered.
StartDiscovery
Start a general discovery procedure. All general discoverable BR/EDR, LE,
and BR/EDR/LE devices will appear in the peer list, which can be observed by calling
[fuchsia.bluetooth.sys/Access.WatchPeers
].
- request
token
[fuchsia.bluetooth.sys/ProcedureToken
] that will remain valid while discovery is in progress. NOTE: The radio will continue performing discovery until all [fuchsia.bluetooth.sys/Access
] drop their tokens.
- error Reports Error.FAILED if discovery on either transport cannot be initiated.
WatchPeers
Returns a list of all peers (connectable Bluetooth devices) known to the system. The first
call results in a snapshot of all known peers to be sent immediately in the updated
return
paremeter. Subsequent calls receive a response only when one or more entries have been
added, modified, or removed from the entries reported since the most recent call.
- response
updated
Peers that were added or updated since the last call to WatchPeers(). - response
removed
Ids of peers that were removed since the last call to WatchPeers().
Fields
responder: AccessWatchPeersResponder
Connect
Initiate a connection to the peer with the given id
. This method connects both BR/EDR and
LE transports depending on the technologies that the peer is known to support.
- request
id
The id of the peer to connect.
- error Reports
Error.FAILED
if a connection to the peer cannot be initiated. - error Reports
Error.PEER_NOT_FOUND
ifid
is not recognized.
Disconnect
Disconnect all logical links to the peer with the given id
. This includes LE and
BR/EDR links that have been initiated using all Access and fuchsia.bluetooth.le protocol
instances.
- request
id
The id of the peer to disconnect.
- error Reports
Error.PEER_NOT_FOUND
ifid
is not recognized.
Pair
Initiate a pairing to the remote id
with the given options
.
This call completes only once the pairing procedure has completed or aborted.
Returns an error if no connected peer with id
is found or the pairing procedure fails.
If the named peer is already paired, this returns immediately with a success value - unless
the pairing is over LE and the PairingOptions.le_security_level is more secure than the
current security level, in which case we will attempt to raise security to the requested
level.
Pairing will take place over whichever transport is indicated by options.transport
. If
that transport isn’t currently connected, the pairing will fail with Error.PEER_NOT_FOUND
.
Currently, if DUAL_MODE is requested, we will attempt to pair over the LE transport.
- request
id
The id of the peer to initiate pairing with - request
options
The configuration options to use for this pairing request
- error Reports
Error.PEER_NOT_FOUND
ifid
is not recognized, or the peer is not connected on the requested transport. - error Reports
Error.INVALID_ARGUMENTS
if ill-formed options are passed - error Reports
Error.FAILED
if an error occurs during pairing
Forget
Removes all bonding information and disconnects any existing links with the peer with the
given id
.
- request
id
The id of the peer to forget.
- error Reports
Error.PEER_NOT_FOUND
ifid
is not recognized.
Implementations§
Source§impl AccessRequest
impl AccessRequest
pub fn into_set_pairing_delegate( self, ) -> Option<(InputCapability, OutputCapability, ClientEnd<PairingDelegateMarker>, AccessControlHandle)>
pub fn into_set_local_name(self) -> Option<(String, AccessControlHandle)>
pub fn into_set_device_class(self) -> Option<(DeviceClass, AccessControlHandle)>
pub fn into_make_discoverable( self, ) -> Option<(ServerEnd<ProcedureTokenMarker>, AccessMakeDiscoverableResponder)>
pub fn into_start_discovery( self, ) -> Option<(ServerEnd<ProcedureTokenMarker>, AccessStartDiscoveryResponder)>
pub fn into_watch_peers(self) -> Option<AccessWatchPeersResponder>
pub fn into_connect(self) -> Option<(PeerId, AccessConnectResponder)>
pub fn into_disconnect(self) -> Option<(PeerId, AccessDisconnectResponder)>
pub fn into_pair(self) -> Option<(PeerId, PairingOptions, AccessPairResponder)>
pub fn into_forget(self) -> Option<(PeerId, AccessForgetResponder)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL