Loading system/bta/dm/bta_dm_act.cc +5 −0 Original line number Diff line number Diff line Loading @@ -583,6 +583,11 @@ bool BTA_DmSetVisibility(bt_scan_mode_t mode) { conn_mode_param = BTA_DM_CONN; break; case BT_SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE: disc_mode_param = BTA_DM_LIMITED_DISC; conn_mode_param = BTA_DM_CONN; break; default: return false; } Loading system/bta/include/bta_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ typedef uint16_t tBTA_SEC; #define BTA_DM_GENERAL_DISC \ BTM_GENERAL_DISCOVERABLE /* General discoverable. \ */ #define BTA_DM_LIMITED_DISC BTM_LIMITED_DISCOVERABLE typedef uint16_t tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and LE mode */ Loading system/gd/rust/linux/client/src/command_handler.rs +35 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use crate::bt_gatt::AuthReq; use crate::callbacks::{BtGattCallback, BtGattServerCallback}; use crate::ClientContext; use crate::{console_red, console_yellow, print_error, print_info}; use bt_topshim::btif::{BtConnectionState, BtStatus, BtTransport}; use bt_topshim::btif::{BtConnectionState, BtDiscMode, BtStatus, BtTransport}; use bt_topshim::profiles::hid_host::BthhReportType; use bt_topshim::profiles::sdp::{BtSdpMpsRecord, BtSdpRecord}; use bt_topshim::profiles::{gatt::LePhy, ProfileConnectionState}; Loading Loading @@ -121,12 +121,17 @@ fn build_commands() -> HashMap<String, CommandOption> { command_options.insert( String::from("adapter"), CommandOption { rules: vec![String::from( "adapter <enable|disable|show|discoverable|connectable|set-name>", )], rules: vec![ String::from("adapter enable"), String::from("adapter disable"), String::from("adapter show"), String::from("adapter discoverable <on|limited|off> <duration>"), String::from("adapter connectable <on|off>"), String::from("adapter set-name <name>"), ], description: String::from( "Enable/Disable/Show default bluetooth adapter. (e.g. adapter enable)\n Discoverable On/Off (e.g. adapter discoverable on)\n Discoverable On/Limited/Off (e.g. adapter discoverable on 60)\n Connectable On/Off (e.g. adapter connectable on)", ), function_pointer: CommandHandler::cmd_adapter, Loading Loading @@ -506,14 +511,36 @@ impl CommandHandler { } "discoverable" => match &get_arg(args, 1)?[..] { "on" => { let duration = String::from(get_arg(args, 2)?) .parse::<u32>() .or(Err("Failed parsing duration."))?; let discoverable = self .lock_context() .adapter_dbus .as_mut() .unwrap() .set_discoverable(BtDiscMode::GeneralDiscoverable, duration); print_info!( "Set discoverable for {} seconds: {}", duration, if discoverable { "succeeded" } else { "failed" } ); } "limited" => { let duration = String::from(get_arg(args, 2)?) .parse::<u32>() .or(Err("Failed parsing duration."))?; let discoverable = self .lock_context() .adapter_dbus .as_mut() .unwrap() .set_discoverable(true, 60); .set_discoverable(BtDiscMode::LimitedDiscoverable, duration); print_info!( "Set discoverable for 60s: {}", "Set limited discoverable for {} seconds: {}", duration, if discoverable { "succeeded" } else { "failed" } ); } Loading @@ -523,7 +550,7 @@ impl CommandHandler { .adapter_dbus .as_mut() .unwrap() .set_discoverable(false, 60); .set_discoverable(BtDiscMode::NonDiscoverable, 0 /*not used*/); print_info!( "Turn discoverable off: {}", if discoverable { "succeeded" } else { "failed" } Loading system/gd/rust/linux/client/src/dbus_iface.rs +5 −3 Original line number Diff line number Diff line //! D-Bus proxy implementations of the APIs. use bt_topshim::btif::{ BtBondState, BtConnectionState, BtDeviceType, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, BtBondState, BtConnectionState, BtDeviceType, BtDiscMode, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, }; use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy}; use bt_topshim::profiles::hid_host::BthhReportType; Loading Loading @@ -600,6 +600,8 @@ impl IScannerCallback for IScannerCallbackDBus { } } impl_dbus_arg_enum!(BtDiscMode); // Implements RPC-friendly wrapper methods for calling IBluetooth, generated by // `generate_dbus_interface_client` below. pub(crate) struct BluetoothDBusRPC { Loading Loading @@ -700,7 +702,7 @@ impl IBluetooth for BluetoothDBus { } #[dbus_method("SetDiscoverable")] fn set_discoverable(&mut self, mode: bool, duration: u32) -> bool { fn set_discoverable(&mut self, mode: BtDiscMode, duration: u32) -> bool { dbus_generated!() } Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +5 −3 Original line number Diff line number Diff line use bt_topshim::btif::{ BtBondState, BtConnectionState, BtDeviceType, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, BtBondState, BtConnectionState, BtDeviceType, BtDiscMode, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, }; use bt_topshim::profiles::socket::SocketType; use bt_topshim::profiles::ProfileConnectionState; Loading Loading @@ -385,6 +385,8 @@ impl DBusArg for BtSdpRecord { } } impl_dbus_arg_enum!(BtDiscMode); #[allow(dead_code)] struct IBluetoothDBus {} Loading Loading @@ -465,7 +467,7 @@ impl IBluetooth for IBluetoothDBus { } #[dbus_method("SetDiscoverable")] fn set_discoverable(&mut self, mode: bool, duration: u32) -> bool { fn set_discoverable(&mut self, mode: BtDiscMode, duration: u32) -> bool { dbus_generated!() } Loading Loading
system/bta/dm/bta_dm_act.cc +5 −0 Original line number Diff line number Diff line Loading @@ -583,6 +583,11 @@ bool BTA_DmSetVisibility(bt_scan_mode_t mode) { conn_mode_param = BTA_DM_CONN; break; case BT_SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE: disc_mode_param = BTA_DM_LIMITED_DISC; conn_mode_param = BTA_DM_CONN; break; default: return false; } Loading
system/bta/include/bta_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ typedef uint16_t tBTA_SEC; #define BTA_DM_GENERAL_DISC \ BTM_GENERAL_DISCOVERABLE /* General discoverable. \ */ #define BTA_DM_LIMITED_DISC BTM_LIMITED_DISCOVERABLE typedef uint16_t tBTA_DM_DISC; /* this discoverability mode is a bit mask among BR mode and LE mode */ Loading
system/gd/rust/linux/client/src/command_handler.rs +35 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use crate::bt_gatt::AuthReq; use crate::callbacks::{BtGattCallback, BtGattServerCallback}; use crate::ClientContext; use crate::{console_red, console_yellow, print_error, print_info}; use bt_topshim::btif::{BtConnectionState, BtStatus, BtTransport}; use bt_topshim::btif::{BtConnectionState, BtDiscMode, BtStatus, BtTransport}; use bt_topshim::profiles::hid_host::BthhReportType; use bt_topshim::profiles::sdp::{BtSdpMpsRecord, BtSdpRecord}; use bt_topshim::profiles::{gatt::LePhy, ProfileConnectionState}; Loading Loading @@ -121,12 +121,17 @@ fn build_commands() -> HashMap<String, CommandOption> { command_options.insert( String::from("adapter"), CommandOption { rules: vec![String::from( "adapter <enable|disable|show|discoverable|connectable|set-name>", )], rules: vec![ String::from("adapter enable"), String::from("adapter disable"), String::from("adapter show"), String::from("adapter discoverable <on|limited|off> <duration>"), String::from("adapter connectable <on|off>"), String::from("adapter set-name <name>"), ], description: String::from( "Enable/Disable/Show default bluetooth adapter. (e.g. adapter enable)\n Discoverable On/Off (e.g. adapter discoverable on)\n Discoverable On/Limited/Off (e.g. adapter discoverable on 60)\n Connectable On/Off (e.g. adapter connectable on)", ), function_pointer: CommandHandler::cmd_adapter, Loading Loading @@ -506,14 +511,36 @@ impl CommandHandler { } "discoverable" => match &get_arg(args, 1)?[..] { "on" => { let duration = String::from(get_arg(args, 2)?) .parse::<u32>() .or(Err("Failed parsing duration."))?; let discoverable = self .lock_context() .adapter_dbus .as_mut() .unwrap() .set_discoverable(BtDiscMode::GeneralDiscoverable, duration); print_info!( "Set discoverable for {} seconds: {}", duration, if discoverable { "succeeded" } else { "failed" } ); } "limited" => { let duration = String::from(get_arg(args, 2)?) .parse::<u32>() .or(Err("Failed parsing duration."))?; let discoverable = self .lock_context() .adapter_dbus .as_mut() .unwrap() .set_discoverable(true, 60); .set_discoverable(BtDiscMode::LimitedDiscoverable, duration); print_info!( "Set discoverable for 60s: {}", "Set limited discoverable for {} seconds: {}", duration, if discoverable { "succeeded" } else { "failed" } ); } Loading @@ -523,7 +550,7 @@ impl CommandHandler { .adapter_dbus .as_mut() .unwrap() .set_discoverable(false, 60); .set_discoverable(BtDiscMode::NonDiscoverable, 0 /*not used*/); print_info!( "Turn discoverable off: {}", if discoverable { "succeeded" } else { "failed" } Loading
system/gd/rust/linux/client/src/dbus_iface.rs +5 −3 Original line number Diff line number Diff line //! D-Bus proxy implementations of the APIs. use bt_topshim::btif::{ BtBondState, BtConnectionState, BtDeviceType, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, BtBondState, BtConnectionState, BtDeviceType, BtDiscMode, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, }; use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy}; use bt_topshim::profiles::hid_host::BthhReportType; Loading Loading @@ -600,6 +600,8 @@ impl IScannerCallback for IScannerCallbackDBus { } } impl_dbus_arg_enum!(BtDiscMode); // Implements RPC-friendly wrapper methods for calling IBluetooth, generated by // `generate_dbus_interface_client` below. pub(crate) struct BluetoothDBusRPC { Loading Loading @@ -700,7 +702,7 @@ impl IBluetooth for BluetoothDBus { } #[dbus_method("SetDiscoverable")] fn set_discoverable(&mut self, mode: bool, duration: u32) -> bool { fn set_discoverable(&mut self, mode: BtDiscMode, duration: u32) -> bool { dbus_generated!() } Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +5 −3 Original line number Diff line number Diff line use bt_topshim::btif::{ BtBondState, BtConnectionState, BtDeviceType, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, BtBondState, BtConnectionState, BtDeviceType, BtDiscMode, BtPropertyType, BtSspVariant, BtStatus, BtTransport, Uuid, Uuid128Bit, }; use bt_topshim::profiles::socket::SocketType; use bt_topshim::profiles::ProfileConnectionState; Loading Loading @@ -385,6 +385,8 @@ impl DBusArg for BtSdpRecord { } } impl_dbus_arg_enum!(BtDiscMode); #[allow(dead_code)] struct IBluetoothDBus {} Loading Loading @@ -465,7 +467,7 @@ impl IBluetooth for IBluetoothDBus { } #[dbus_method("SetDiscoverable")] fn set_discoverable(&mut self, mode: bool, duration: u32) -> bool { fn set_discoverable(&mut self, mode: BtDiscMode, duration: u32) -> bool { dbus_generated!() } Loading