summaryrefslogtreecommitdiff
path: root/system/gd/rust/linux/stack/src/bluetooth.rs
diff options
context:
space:
mode:
authorKatherine Lai <laikatherine@google.com>2022-02-24 23:24:48 +0000
committerKatherine Lai <laikatherine@google.com>2022-02-25 18:31:11 +0000
commit58837b82501efeda11d82f369cb15bea9f0987d4 (patch)
tree6290ffa46186dc833989d15569ded987e992c04b /system/gd/rust/linux/stack/src/bluetooth.rs
parent4da5be342b703b01db3916848a095a438b05faa3 (diff)
floss: Add GetDiscoverableTimeout API
Bug: 196885500 Tag: #floss Test: Verify API output with btclient Change-Id: I41061cce090c9e96fb6f27352334bd56c3faa312
Diffstat (limited to 'system/gd/rust/linux/stack/src/bluetooth.rs')
-rw-r--r--system/gd/rust/linux/stack/src/bluetooth.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/system/gd/rust/linux/stack/src/bluetooth.rs b/system/gd/rust/linux/stack/src/bluetooth.rs
index ef9ea31ae9..550de70517 100644
--- a/system/gd/rust/linux/stack/src/bluetooth.rs
+++ b/system/gd/rust/linux/stack/src/bluetooth.rs
@@ -73,6 +73,9 @@ pub trait IBluetooth {
/// Returns whether the adapter is discoverable.
fn get_discoverable(&self) -> bool;
+ /// Returns the adapter discoverable timeout.
+ fn get_discoverable_timeout(&self) -> u32;
+
/// Sets discoverability. If discoverable, limits the duration with given value.
fn set_discoverable(&self, mode: bool, duration: u32) -> bool;
@@ -856,6 +859,16 @@ impl IBluetooth for Bluetooth {
}
}
+ fn get_discoverable_timeout(&self) -> u32 {
+ match self.properties.get(&BtPropertyType::AdapterDiscoverableTimeout) {
+ Some(prop) => match prop {
+ BluetoothProperty::AdapterDiscoverableTimeout(timeout) => timeout.clone(),
+ _ => 0,
+ },
+ _ => 0,
+ }
+ }
+
fn set_discoverable(&self, mode: bool, duration: u32) -> bool {
self.intf
.lock()