bt_hfp/sco/
test_utils.rs
1use bredr::ScoConnectionMarker;
6use fidl_fuchsia_bluetooth_bredr as bredr;
7use fuchsia_bluetooth::types::PeerId;
8
9use crate::codec_id::CodecId;
10use crate::sco::connector::parameter_sets_for_codec;
11use crate::sco::Connection;
12
13#[track_caller]
14pub fn connection_for_codec(
15 peer_id: PeerId,
16 codec_id: CodecId,
17 in_band: bool,
18) -> (Connection, bredr::ScoConnectionRequestStream) {
19 let sco_params = parameter_sets_for_codec(codec_id, in_band).pop().unwrap();
20 let (proxy, stream) = fidl::endpoints::create_proxy_and_stream::<ScoConnectionMarker>();
21 let connection = Connection::build(peer_id, sco_params, proxy);
22 (connection, stream)
23}