diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-03-09 11:17:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-03-09 11:17:04 +0000 |
commit | d1eb3e10336a05f9ab0add583d115fe68ce752e5 (patch) | |
tree | c3506b84847795b702391c929bf9d1ac799f3ea7 /system/gd/rust/linux/stack/src/bluetooth.rs | |
parent | b4dc6962af1fd97d4f76ed4b8f642a7fdbce858e (diff) | |
parent | 1d5e6bf208b4c137906c780495e0212c6318bd58 (diff) |
Merge "floss: Add GetProfileConnectionState adapter API" am: ab46d5fcae am: 5b3c6ac8f4 am: 1d5e6bf208
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2007278
Change-Id: I6ce702d9f219b675f6fb80241d266396da12418e
Diffstat (limited to 'system/gd/rust/linux/stack/src/bluetooth.rs')
-rw-r--r-- | system/gd/rust/linux/stack/src/bluetooth.rs | 16 |
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)) => { |