Loading system/gd/rust/linux/client/src/command_handler.rs +10 −2 Original line number Diff line number Diff line Loading @@ -487,18 +487,26 @@ impl CommandHandler { name: String::from("Classic Device"), }; let (bonded, connected, uuids) = { let (name, alias, device_type, class, bonded, connected, uuids) = { let ctx = self.context.lock().unwrap(); let adapter = ctx.adapter_dbus.as_ref().unwrap(); let name = adapter.get_remote_name(device.clone()); let device_type = adapter.get_remote_type(device.clone()); let alias = adapter.get_remote_alias(device.clone()); let class = adapter.get_remote_class(device.clone()); let bonded = adapter.get_bond_state(device.clone()); let connected = adapter.get_connection_state(device.clone()); let uuids = adapter.get_remote_uuids(device.clone()); (bonded, connected, uuids) (name, alias, device_type, class, bonded, connected, uuids) }; print_info!("Address: {}", &device.address); print_info!("Name: {}", name); print_info!("Alias: {}", alias); print_info!("Type: {:?}", device_type); print_info!("Class: {}", class); print_info!("Bonded: {}", bonded); print_info!("Connected: {}", connected); print_info!( Loading system/gd/rust/linux/client/src/dbus_iface.rs +24 −3 Original line number Diff line number Diff line //! D-Bus proxy implementations of the APIs. use bt_topshim::btif::{BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::profiles::gatt::GattStatus; use btstack::bluetooth::{ Loading Loading @@ -37,12 +37,13 @@ fn make_object_path(idx: i32, name: &str) -> dbus::Path { dbus::Path::new(format!("/org/chromium/bluetooth/hci{}/{}", idx, name)).unwrap() } impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(GattStatus); impl_dbus_arg_enum!(GattWriteRequestStatus); impl_dbus_arg_enum!(GattWriteType); impl_dbus_arg_enum!(LePhy); impl_dbus_arg_enum!(GattWriteRequestStatus); impl_dbus_arg_enum!(Profile); // Represents Uuid128Bit as an array in D-Bus. Loading Loading @@ -383,6 +384,26 @@ impl IBluetooth for BluetoothDBus { dbus_generated!() } #[dbus_method("GetRemoteName")] fn get_remote_name(&self, device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteType")] fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType { dbus_generated!() } #[dbus_method("GetRemoteAlias")] fn get_remote_alias(&self, device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteClass")] fn get_remote_class(&self, device: BluetoothDevice) -> u32 { dbus_generated!() } #[dbus_method("GetConnectionState")] fn get_connection_state(&self, device: BluetoothDevice) -> u32 { dbus_generated!() Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +23 −2 Original line number Diff line number Diff line extern crate bt_shim; use bt_topshim::btif::{BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use btstack::bluetooth::{ BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback, Loading Loading @@ -63,8 +63,9 @@ impl IBluetoothCallback for BluetoothCallbackDBus { } } impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(Profile); #[allow(dead_code)] Loading Loading @@ -232,6 +233,26 @@ impl IBluetooth for IBluetoothDBus { dbus_generated!() } #[dbus_method("GetRemoteName")] fn get_remote_name(&self, _device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteType")] fn get_remote_type(&self, _device: BluetoothDevice) -> BtDeviceType { dbus_generated!() } #[dbus_method("GetRemoteAlias")] fn get_remote_alias(&self, _device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteClass")] fn get_remote_class(&self, _device: BluetoothDevice) -> u32 { dbus_generated!() } #[dbus_method("GetConnectionState")] fn get_connection_state(&self, _device: BluetoothDevice) -> u32 { dbus_generated!() Loading system/gd/rust/linux/stack/src/bluetooth.rs +42 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,8 @@ use bt_topshim::btif::{ BaseCallbacks, BaseCallbacksDispatcher, BluetoothInterface, BluetoothProperty, BtAclState, BtBondState, BtDiscoveryState, BtHciErrorCode, BtPinCode, BtPropertyType, BtScanMode, BtSspVariant, BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit, BtBondState, BtDeviceType, BtDiscoveryState, BtHciErrorCode, BtPinCode, BtPropertyType, BtScanMode, BtSspVariant, BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit, }; use bt_topshim::{ profiles::hid_host::{HHCallbacksDispatcher, HidHost}, Loading Loading @@ -122,6 +122,18 @@ pub trait IBluetooth { /// Confirm that a pairing should be completed on a bonding device. fn set_pairing_confirmation(&self, device: BluetoothDevice, accept: bool) -> bool; /// Gets the name of the remote device. fn get_remote_name(&self, device: BluetoothDevice) -> String; /// Gets the type of the remote device. fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType; /// Gets the alias of the remote device. fn get_remote_alias(&self, device: BluetoothDevice) -> String; /// Gets the class of the remote device. fn get_remote_class(&self, device: BluetoothDevice) -> u32; /// Gets the connection state of a single device. fn get_connection_state(&self, device: BluetoothDevice) -> u32; Loading Loading @@ -1082,6 +1094,34 @@ impl IBluetooth for Bluetooth { ) == 0 } fn get_remote_name(&self, device: BluetoothDevice) -> String { match self.get_remote_device_property(&device, &BtPropertyType::BdName) { Some(BluetoothProperty::BdName(name)) => return name.clone(), _ => return "".to_string(), } } fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType { match self.get_remote_device_property(&device, &BtPropertyType::TypeOfDevice) { Some(BluetoothProperty::TypeOfDevice(device_type)) => return device_type, _ => return BtDeviceType::Unknown, } } fn get_remote_alias(&self, device: BluetoothDevice) -> String { match self.get_remote_device_property(&device, &BtPropertyType::RemoteFriendlyName) { Some(BluetoothProperty::RemoteFriendlyName(name)) => return name.clone(), _ => "".to_string(), } } fn get_remote_class(&self, device: BluetoothDevice) -> u32 { match self.get_remote_device_property(&device, &BtPropertyType::ClassOfDevice) { Some(BluetoothProperty::ClassOfDevice(class)) => return class, _ => 0, } } fn get_connection_state(&self, device: BluetoothDevice) -> u32 { let addr = RawAddress::from_string(device.address.clone()); Loading system/gd/rust/topshim/src/btif.rs +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ pub enum BtDeviceType { Bredr, Ble, Dual, Unknown, } #[derive(Clone, Debug, Eq, Hash, FromPrimitive, ToPrimitive, PartialEq, PartialOrd)] Loading Loading
system/gd/rust/linux/client/src/command_handler.rs +10 −2 Original line number Diff line number Diff line Loading @@ -487,18 +487,26 @@ impl CommandHandler { name: String::from("Classic Device"), }; let (bonded, connected, uuids) = { let (name, alias, device_type, class, bonded, connected, uuids) = { let ctx = self.context.lock().unwrap(); let adapter = ctx.adapter_dbus.as_ref().unwrap(); let name = adapter.get_remote_name(device.clone()); let device_type = adapter.get_remote_type(device.clone()); let alias = adapter.get_remote_alias(device.clone()); let class = adapter.get_remote_class(device.clone()); let bonded = adapter.get_bond_state(device.clone()); let connected = adapter.get_connection_state(device.clone()); let uuids = adapter.get_remote_uuids(device.clone()); (bonded, connected, uuids) (name, alias, device_type, class, bonded, connected, uuids) }; print_info!("Address: {}", &device.address); print_info!("Name: {}", name); print_info!("Alias: {}", alias); print_info!("Type: {:?}", device_type); print_info!("Class: {}", class); print_info!("Bonded: {}", bonded); print_info!("Connected: {}", connected); print_info!( Loading
system/gd/rust/linux/client/src/dbus_iface.rs +24 −3 Original line number Diff line number Diff line //! D-Bus proxy implementations of the APIs. use bt_topshim::btif::{BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::profiles::gatt::GattStatus; use btstack::bluetooth::{ Loading Loading @@ -37,12 +37,13 @@ fn make_object_path(idx: i32, name: &str) -> dbus::Path { dbus::Path::new(format!("/org/chromium/bluetooth/hci{}/{}", idx, name)).unwrap() } impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(GattStatus); impl_dbus_arg_enum!(GattWriteRequestStatus); impl_dbus_arg_enum!(GattWriteType); impl_dbus_arg_enum!(LePhy); impl_dbus_arg_enum!(GattWriteRequestStatus); impl_dbus_arg_enum!(Profile); // Represents Uuid128Bit as an array in D-Bus. Loading Loading @@ -383,6 +384,26 @@ impl IBluetooth for BluetoothDBus { dbus_generated!() } #[dbus_method("GetRemoteName")] fn get_remote_name(&self, device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteType")] fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType { dbus_generated!() } #[dbus_method("GetRemoteAlias")] fn get_remote_alias(&self, device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteClass")] fn get_remote_class(&self, device: BluetoothDevice) -> u32 { dbus_generated!() } #[dbus_method("GetConnectionState")] fn get_connection_state(&self, device: BluetoothDevice) -> u32 { dbus_generated!() Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +23 −2 Original line number Diff line number Diff line extern crate bt_shim; use bt_topshim::btif::{BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use btstack::bluetooth::{ BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback, Loading Loading @@ -63,8 +63,9 @@ impl IBluetoothCallback for BluetoothCallbackDBus { } } impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(Profile); #[allow(dead_code)] Loading Loading @@ -232,6 +233,26 @@ impl IBluetooth for IBluetoothDBus { dbus_generated!() } #[dbus_method("GetRemoteName")] fn get_remote_name(&self, _device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteType")] fn get_remote_type(&self, _device: BluetoothDevice) -> BtDeviceType { dbus_generated!() } #[dbus_method("GetRemoteAlias")] fn get_remote_alias(&self, _device: BluetoothDevice) -> String { dbus_generated!() } #[dbus_method("GetRemoteClass")] fn get_remote_class(&self, _device: BluetoothDevice) -> u32 { dbus_generated!() } #[dbus_method("GetConnectionState")] fn get_connection_state(&self, _device: BluetoothDevice) -> u32 { dbus_generated!() Loading
system/gd/rust/linux/stack/src/bluetooth.rs +42 −2 Original line number Diff line number Diff line Loading @@ -2,8 +2,8 @@ use bt_topshim::btif::{ BaseCallbacks, BaseCallbacksDispatcher, BluetoothInterface, BluetoothProperty, BtAclState, BtBondState, BtDiscoveryState, BtHciErrorCode, BtPinCode, BtPropertyType, BtScanMode, BtSspVariant, BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit, BtBondState, BtDeviceType, BtDiscoveryState, BtHciErrorCode, BtPinCode, BtPropertyType, BtScanMode, BtSspVariant, BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit, }; use bt_topshim::{ profiles::hid_host::{HHCallbacksDispatcher, HidHost}, Loading Loading @@ -122,6 +122,18 @@ pub trait IBluetooth { /// Confirm that a pairing should be completed on a bonding device. fn set_pairing_confirmation(&self, device: BluetoothDevice, accept: bool) -> bool; /// Gets the name of the remote device. fn get_remote_name(&self, device: BluetoothDevice) -> String; /// Gets the type of the remote device. fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType; /// Gets the alias of the remote device. fn get_remote_alias(&self, device: BluetoothDevice) -> String; /// Gets the class of the remote device. fn get_remote_class(&self, device: BluetoothDevice) -> u32; /// Gets the connection state of a single device. fn get_connection_state(&self, device: BluetoothDevice) -> u32; Loading Loading @@ -1082,6 +1094,34 @@ impl IBluetooth for Bluetooth { ) == 0 } fn get_remote_name(&self, device: BluetoothDevice) -> String { match self.get_remote_device_property(&device, &BtPropertyType::BdName) { Some(BluetoothProperty::BdName(name)) => return name.clone(), _ => return "".to_string(), } } fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType { match self.get_remote_device_property(&device, &BtPropertyType::TypeOfDevice) { Some(BluetoothProperty::TypeOfDevice(device_type)) => return device_type, _ => return BtDeviceType::Unknown, } } fn get_remote_alias(&self, device: BluetoothDevice) -> String { match self.get_remote_device_property(&device, &BtPropertyType::RemoteFriendlyName) { Some(BluetoothProperty::RemoteFriendlyName(name)) => return name.clone(), _ => "".to_string(), } } fn get_remote_class(&self, device: BluetoothDevice) -> u32 { match self.get_remote_device_property(&device, &BtPropertyType::ClassOfDevice) { Some(BluetoothProperty::ClassOfDevice(class)) => return class, _ => 0, } } fn get_connection_state(&self, device: BluetoothDevice) -> u32 { let addr = RawAddress::from_string(device.address.clone()); Loading
system/gd/rust/topshim/src/btif.rs +1 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,7 @@ pub enum BtDeviceType { Bredr, Ble, Dual, Unknown, } #[derive(Clone, Debug, Eq, Hash, FromPrimitive, ToPrimitive, PartialEq, PartialOrd)] Loading