Loading system/gd/rust/linux/service/src/iface_bluetooth_media.rs +5 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,11 @@ impl IBluetoothMedia for IBluetoothMediaDBus { dbus_generated!() } #[dbus_method("GetHfpAudioStarted")] fn get_hfp_audio_started(&mut self) -> bool { dbus_generated!() } #[dbus_method("StopScoCall")] fn stop_sco_call(&mut self, address: String) { dbus_generated!() Loading system/gd/rust/linux/stack/src/bluetooth_media.rs +13 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ pub trait IBluetoothMedia { fn start_audio_request(&mut self); fn stop_audio_request(&mut self); fn get_a2dp_audio_started(&mut self) -> bool; fn get_hfp_audio_started(&mut self) -> bool; fn get_presentation_position(&mut self) -> PresentationPosition; fn start_sco_call(&mut self, address: String); Loading Loading @@ -131,6 +132,7 @@ pub struct BluetoothMedia { a2dp_audio_state: BtavAudioState, hfp: Option<Hfp>, hfp_states: HashMap<RawAddress, BthfConnectionState>, hfp_audio_state: BthfAudioState, selectable_caps: HashMap<RawAddress, Vec<A2dpCodecConfig>>, hfp_caps: HashMap<RawAddress, HfpCodecCapability>, device_added_tasks: Arc<Mutex<HashMap<RawAddress, Option<JoinHandle<()>>>>>, Loading @@ -154,6 +156,7 @@ impl BluetoothMedia { a2dp_audio_state: BtavAudioState::RemoteSuspend, hfp: None, hfp_states: HashMap::new(), hfp_audio_state: BthfAudioState::Disconnected, selectable_caps: HashMap::new(), hfp_caps: HashMap::new(), device_added_tasks: Arc::new(Mutex::new(HashMap::new())), Loading Loading @@ -274,6 +277,7 @@ impl BluetoothMedia { warn!("[{}]: Unknown address hfp or slc not ready", addr.to_string()); return; } match state { BthfAudioState::Connected => { info!("[{}]: hfp audio connected.", addr.to_string()); Loading @@ -288,6 +292,8 @@ impl BluetoothMedia { info!("[{}]: hfp audio disconnecting.", addr.to_string()); } } self.hfp_audio_state = state; } HfpCallbacks::VolumeUpdate(volume, addr) => { self.callbacks.lock().unwrap().for_all_callbacks(|callback| { Loading Loading @@ -623,6 +629,13 @@ impl IBluetoothMedia for BluetoothMedia { } } fn get_hfp_audio_started(&mut self) -> bool { match self.hfp_audio_state { BthfAudioState::Connected => true, _ => false, } } fn get_presentation_position(&mut self) -> PresentationPosition { let position = self.a2dp.as_mut().unwrap().get_presentation_position(); PresentationPosition { Loading Loading
system/gd/rust/linux/service/src/iface_bluetooth_media.rs +5 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,11 @@ impl IBluetoothMedia for IBluetoothMediaDBus { dbus_generated!() } #[dbus_method("GetHfpAudioStarted")] fn get_hfp_audio_started(&mut self) -> bool { dbus_generated!() } #[dbus_method("StopScoCall")] fn stop_sco_call(&mut self, address: String) { dbus_generated!() Loading
system/gd/rust/linux/stack/src/bluetooth_media.rs +13 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ pub trait IBluetoothMedia { fn start_audio_request(&mut self); fn stop_audio_request(&mut self); fn get_a2dp_audio_started(&mut self) -> bool; fn get_hfp_audio_started(&mut self) -> bool; fn get_presentation_position(&mut self) -> PresentationPosition; fn start_sco_call(&mut self, address: String); Loading Loading @@ -131,6 +132,7 @@ pub struct BluetoothMedia { a2dp_audio_state: BtavAudioState, hfp: Option<Hfp>, hfp_states: HashMap<RawAddress, BthfConnectionState>, hfp_audio_state: BthfAudioState, selectable_caps: HashMap<RawAddress, Vec<A2dpCodecConfig>>, hfp_caps: HashMap<RawAddress, HfpCodecCapability>, device_added_tasks: Arc<Mutex<HashMap<RawAddress, Option<JoinHandle<()>>>>>, Loading @@ -154,6 +156,7 @@ impl BluetoothMedia { a2dp_audio_state: BtavAudioState::RemoteSuspend, hfp: None, hfp_states: HashMap::new(), hfp_audio_state: BthfAudioState::Disconnected, selectable_caps: HashMap::new(), hfp_caps: HashMap::new(), device_added_tasks: Arc::new(Mutex::new(HashMap::new())), Loading Loading @@ -274,6 +277,7 @@ impl BluetoothMedia { warn!("[{}]: Unknown address hfp or slc not ready", addr.to_string()); return; } match state { BthfAudioState::Connected => { info!("[{}]: hfp audio connected.", addr.to_string()); Loading @@ -288,6 +292,8 @@ impl BluetoothMedia { info!("[{}]: hfp audio disconnecting.", addr.to_string()); } } self.hfp_audio_state = state; } HfpCallbacks::VolumeUpdate(volume, addr) => { self.callbacks.lock().unwrap().for_all_callbacks(|callback| { Loading Loading @@ -623,6 +629,13 @@ impl IBluetoothMedia for BluetoothMedia { } } fn get_hfp_audio_started(&mut self) -> bool { match self.hfp_audio_state { BthfAudioState::Connected => true, _ => false, } } fn get_presentation_position(&mut self) -> PresentationPosition { let position = self.a2dp.as_mut().unwrap().get_presentation_position(); PresentationPosition { Loading