summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/gd/rust/linux/client/src/command_handler.rs2
-rw-r--r--system/gd/rust/linux/client/src/dbus_iface.rs4
-rw-r--r--system/gd/rust/linux/service/src/iface_bluetooth.rs13
-rw-r--r--system/gd/rust/linux/stack/src/bluetooth.rs13
4 files changed, 28 insertions, 4 deletions
diff --git a/system/gd/rust/linux/client/src/command_handler.rs b/system/gd/rust/linux/client/src/command_handler.rs
index 9f9f280c85..284654e444 100644
--- a/system/gd/rust/linux/client/src/command_handler.rs
+++ b/system/gd/rust/linux/client/src/command_handler.rs
@@ -269,6 +269,7 @@ impl CommandHandler {
let name = adapter_dbus.get_name();
let uuids = adapter_dbus.get_uuids();
let is_discoverable = adapter_dbus.get_discoverable();
+ let discoverable_timeout = adapter_dbus.get_discoverable_timeout();
let cod = adapter_dbus.get_bluetooth_class();
let multi_adv_supported = adapter_dbus.is_multi_advertisement_supported();
let le_ext_adv_supported = adapter_dbus.is_le_extended_advertising_supported();
@@ -276,6 +277,7 @@ impl CommandHandler {
print_info!("Name: {}", name);
print_info!("State: {}", if enabled { "enabled" } else { "disabled" });
print_info!("Discoverable: {}", is_discoverable);
+ print_info!("DiscoverableTimeout: {}s", discoverable_timeout);
print_info!("Class: {:#06x}", cod);
print_info!("IsMultiAdvertisementSupported: {}", multi_adv_supported);
print_info!("IsLeExtendedAdvertisingSupported: {}", le_ext_adv_supported);
diff --git a/system/gd/rust/linux/client/src/dbus_iface.rs b/system/gd/rust/linux/client/src/dbus_iface.rs
index 1a5c42a7b2..65cd937b10 100644
--- a/system/gd/rust/linux/client/src/dbus_iface.rs
+++ b/system/gd/rust/linux/client/src/dbus_iface.rs
@@ -313,6 +313,10 @@ impl IBluetooth for BluetoothDBus {
self.client_proxy.method("GetDiscoverable", ())
}
+ fn get_discoverable_timeout(&self) -> u32 {
+ self.client_proxy.method("GetDiscoverableTimeout", ())
+ }
+
fn set_discoverable(&self, mode: bool, duration: u32) -> bool {
self.client_proxy.method("SetDiscoverable", (mode, duration))
}
diff --git a/system/gd/rust/linux/service/src/iface_bluetooth.rs b/system/gd/rust/linux/service/src/iface_bluetooth.rs
index 07488e11f4..2447ccefb3 100644
--- a/system/gd/rust/linux/service/src/iface_bluetooth.rs
+++ b/system/gd/rust/linux/service/src/iface_bluetooth.rs
@@ -147,22 +147,27 @@ impl IBluetooth for IBluetoothDBus {
#[dbus_method("GetDiscoverable")]
fn get_discoverable(&self) -> bool {
- true
+ dbus_generated!()
+ }
+
+ #[dbus_method("GetDiscoverableTimeout")]
+ fn get_discoverable_timeout(&self) -> u32 {
+ dbus_generated!()
}
#[dbus_method("SetDiscoverable")]
fn set_discoverable(&self, mode: bool, duration: u32) -> bool {
- true
+ dbus_generated!()
}
#[dbus_method("IsMultiAdvertisementSupported")]
fn is_multi_advertisement_supported(&self) -> bool {
- true
+ dbus_generated!()
}
#[dbus_method("IsLeExtendedAdvertisingSupported")]
fn is_le_extended_advertising_supported(&self) -> bool {
- true
+ dbus_generated!()
}
#[dbus_method("StartDiscovery")]
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()