summaryrefslogtreecommitdiff
path: root/system/gd/rust/linux/stack/src/bluetooth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'system/gd/rust/linux/stack/src/bluetooth.rs')
-rw-r--r--system/gd/rust/linux/stack/src/bluetooth.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/system/gd/rust/linux/stack/src/bluetooth.rs b/system/gd/rust/linux/stack/src/bluetooth.rs
index 49e9289e4d..6aa3529873 100644
--- a/system/gd/rust/linux/stack/src/bluetooth.rs
+++ b/system/gd/rust/linux/stack/src/bluetooth.rs
@@ -125,6 +125,9 @@ pub trait IBluetooth {
/// Gets the connection state of a single device.
fn get_connection_state(&self, device: BluetoothDevice) -> u32;
+ /// Gets the connection state of a specific profile.
+ fn get_profile_connection_state(&self, profile: Profile) -> u32;
+
/// Returns the cached UUIDs of a remote device.
fn get_remote_uuids(&self, device: BluetoothDevice) -> Vec<Uuid128Bit>;
@@ -1086,6 +1089,19 @@ impl IBluetooth for Bluetooth {
self.intf.lock().unwrap().get_connection_state(&addr.unwrap())
}
+ fn get_profile_connection_state(&self, profile: Profile) -> u32 {
+ match profile {
+ Profile::A2dpSink | Profile::A2dpSource => {
+ self.bluetooth_media.lock().unwrap().get_a2dp_connection_state()
+ }
+ Profile::Hfp | Profile::HfpAg => {
+ self.bluetooth_media.lock().unwrap().get_hfp_connection_state()
+ }
+ // TODO: (b/223431229) Profile::Hid and Profile::Hogp
+ _ => 0,
+ }
+ }
+
fn get_remote_uuids(&self, device: BluetoothDevice) -> Vec<Uuid128Bit> {
match self.get_remote_device_property(&device, &BtPropertyType::Uuids) {
Some(BluetoothProperty::Uuids(uuids)) => {