pub enum ProfileRequest {
Advertise {
services: Vec<ServiceDefinition>,
parameters: ChannelParameters,
receiver: ClientEnd<ConnectionReceiverMarker>,
responder: ProfileAdvertiseResponder,
},
Search {
service_uuid: ServiceClassProfileIdentifier,
attr_ids: Vec<u16>,
results: ClientEnd<SearchResultsMarker>,
control_handle: ProfileControlHandle,
},
Connect {
peer_id: PeerId,
connection: ConnectParameters,
responder: ProfileConnectResponder,
},
ConnectSco {
peer_id: PeerId,
initiator: bool,
params: Vec<ScoConnectionParameters>,
receiver: ClientEnd<ScoConnectionReceiverMarker>,
control_handle: ProfileControlHandle,
},
_UnknownMethod {
ordinal: u64,
control_handle: ProfileControlHandle,
method_type: MethodType,
},
}
Expand description
Service provides Bluetooth BR/EDR profiles a way to register a service definition, making a profile discoverable by peers. Registered services can receive L2CAP connections made to the advertised records, and can open new connections on peers.
Variants§
Advertise
Fields
services: Vec<ServiceDefinition>
parameters: ChannelParameters
receiver: ClientEnd<ConnectionReceiverMarker>
responder: ProfileAdvertiseResponder
Register a set of services.
The call will resolve when the service advertisement terminates or if there was an error when advertising.
These services will be discoverable via Service Discovery Protocol server.
All services advertising the same channel must be added at once - if services are already
registered on any channel advertised, registration will fail, the receiver will be closed
with ZX_ERR_ALREADY_BOUND and an error will be returned.
The ConnectionReceiver will get calls for connections to the channels included in the
protocol_descriptor
or alternative_protocol_descriptors
in the services advertised.
The receiver will be closed if there are any errors advertising.
If the advertisement cannot be made for any reason, an error of INVALID_ARGUMENTS
will be returned and the receiver will be closed with a suitable epitaph.
Search
Fields
service_uuid: ServiceClassProfileIdentifier
results: ClientEnd<SearchResultsMarker>
control_handle: ProfileControlHandle
Register a search for services on newly connected peers. The SearchResults protocol will be
used to report results for this search. Any service result with a service matching
service_uuid
will be returned with the additional attributes in attr_ids
. If attr_ids
is empty, all attributes will be requested. The additional attribute
BLUETOOTH_PROTOCOL_DESCRIPTOR_LIST is always requested. See the Bluetooth Spec v5.2, Vol 3,
Part B, Section 5) and relevant profile specification documents.
Connect
Connect an L2CAP or RFCOMM channel to the connected peer identified by peer_id
using the
desired connection
parameters listed. Dynamic PSMs can be specified in connection
.
Returns the channel connected once established, or an error code if the channel could not be connected.
ConnectSco
Fields
peer_id: PeerId
params: Vec<ScoConnectionParameters>
receiver: ClientEnd<ScoConnectionReceiverMarker>
control_handle: ProfileControlHandle
Attempt to establish a synchronous connection to peer_id
configured
using params
.
If initiator
is true, a connection request will be sent. Only 1
parameter may be specified.
If initiator
is false, the host will attempt to accept the next
connection request using the parameters given in order. The parameters
will be tried in order until either a connection is successful, all
parameters have been rejected (ScoErrorCode.PARAMETERS_REJECTED
), or
the procedure is canceled.
The result of the connection attempt and the parameters used for the
connection will be returned with receiver
. Dropping receiver
will
cancel the request.
_UnknownMethod
Fields
This variant is marked as non-exhaustive
control_handle: ProfileControlHandle
method_type: MethodType
An interaction was received which does not match any known method.
Implementations§
source§impl ProfileRequest
impl ProfileRequest
pub fn into_advertise( self ) -> Option<(Vec<ServiceDefinition>, ChannelParameters, ClientEnd<ConnectionReceiverMarker>, ProfileAdvertiseResponder)>
pub fn into_search( self ) -> Option<(ServiceClassProfileIdentifier, Vec<u16>, ClientEnd<SearchResultsMarker>, ProfileControlHandle)>
pub fn into_connect( self ) -> Option<(PeerId, ConnectParameters, ProfileConnectResponder)>
pub fn into_connect_sco( self ) -> Option<(PeerId, bool, Vec<ScoConnectionParameters>, ClientEnd<ScoConnectionReceiverMarker>, ProfileControlHandle)>
sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL