| // Copyright 2023 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| //! This crate implements the **Broadcast Assistant** role defined in the |
| //! Bluetooth SIG Basic Audio Profile (BAP) v1.0.2 specification. |
| //! |
| //! A Broadcast Assistant is a Bluetooth Low Energy (LE) device that discovers |
| //! Broadcast Sources and assists Broadcast Sinks (Scan Delegators) in |
| //! synchronizing to LE Audio broadcast streams. |
| //! |
| //! # Usage Example |
| //! |
| //! ```rust,no_run |
| //! use futures::StreamExt; |
| //! use bt_broadcast_assistant::assistant::Error; |
| //! use bt_broadcast_assistant::{event::Event, BroadcastAssistant}; |
| //! use bt_gatt::central::Central; |
| //! |
| //! async fn run_assistant<T: bt_gatt::GattTypes + 'static>(central: T::Central) -> Result<(), Error> { |
| //! let mut assistant = BroadcastAssistant::<T>::new(central); |
| //! let mut event_stream = assistant.start()?; |
| //! while let Some(event_res) = event_stream.next().await { |
| //! match event_res? { |
| //! Event::FoundBroadcastSource { peer, advertising_sid, source } => { |
| //! println!("Discovered complete broadcast source: {:?}", source); |
| //! } |
| //! Event::CouldNotParseAdvertisingData { peer, error } => { |
| //! eprintln!("Failed to parse advertisement from peer {:?}: {:?}", peer, error); |
| //! } |
| //! } |
| //! } |
| //! Ok(()) |
| //! } |
| //! ``` |
| |
| pub mod assistant; |
| pub use assistant::event; |
| pub use assistant::BroadcastAssistant; |
| pub mod debug; |
| pub mod types; |