Expand description
Implements the Published Audio Capabilities Service server role.
Use the ServerBuilder
to define a new Server
instance with the specified
characteristics. The server isn’t published to GATT until
Server::publish
method is called.
Once the Server
is published, poll on it to receive events from the
Server
, which are created as it processes incoming client requests.
For example:
// Set up a GATT Server which implements bt_gatt::ServerTypes::Server
.
let gatt_server = …;
// Define supported and available audio contexts for this PACS.
let supported = AudioContexts::new(…);
let available = AudioContexts::new(…);
let pacs_server = ServerBuilder::new()
.with_sources(…)
.with_sinks(…)
.build(supported, available)?;
// Publish the server.
pacs_server.publish(gatt_server).expect(“publishes fine”);
// Process events from the PACS server.
while let Some(event) = pacs_server.next().await {
// Do something with event
}