From 58837b82501efeda11d82f369cb15bea9f0987d4 Mon Sep 17 00:00:00 2001 From: Katherine Lai Date: Thu, 24 Feb 2022 23:24:48 +0000 Subject: floss: Add GetDiscoverableTimeout API Bug: 196885500 Tag: #floss Test: Verify API output with btclient Change-Id: I41061cce090c9e96fb6f27352334bd56c3faa312 --- system/gd/rust/linux/stack/src/bluetooth.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'system/gd/rust/linux/stack') 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() -- cgit v1.2.3