Loading system/gd/rust/linux/client/src/callbacks.rs +3 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ use crate::dbus_iface::{ }; use crate::ClientContext; use crate::{console_yellow, print_info}; use bt_topshim::btif::{BtBondState, BtSspVariant}; use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant}; use bt_topshim::profiles::gatt::GattStatus; use btstack::bluetooth::{ BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback, Loading Loading @@ -101,6 +101,8 @@ impl BtCallback { } impl IBluetoothCallback for BtCallback { fn on_adapter_property_changed(&self, prop: BtPropertyType) {} fn on_address_changed(&self, addr: String) { print_info!("Address changed to {}", &addr); self.context.lock().unwrap().adapter_address = Some(addr); Loading system/gd/rust/linux/client/src/dbus_iface.rs +5 −1 Original line number Diff line number Diff line //! D-Bus proxy implementations of the APIs. use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtPropertyType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::profiles::gatt::GattStatus; use btstack::bluetooth::{ Loading Loading @@ -41,6 +41,7 @@ fn make_object_path(idx: i32, name: &str) -> dbus::Path { } impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtPropertyType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(GattStatus); Loading Loading @@ -123,6 +124,9 @@ impl RPCProxy for IBluetoothCallbackDBus { "org.chromium.bluetooth.BluetoothCallback" )] impl IBluetoothCallback for IBluetoothCallbackDBus { #[dbus_method("OnAdapterPropertyChanged")] fn on_adapter_property_changed(&self, prop: BtPropertyType) {} #[dbus_method("OnAddressChanged")] fn on_address_changed(&self, addr: String) {} Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +6 −1 Original line number Diff line number Diff line extern crate bt_shim; use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtPropertyType, BtSspVariant, BtTransport, Uuid128Bit}; use btstack::bluetooth::{ BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback, Loading Loading @@ -35,6 +35,10 @@ struct BluetoothCallbackDBus {} #[dbus_proxy_obj(BluetoothCallback, "org.chromium.bluetooth.BluetoothCallback")] impl IBluetoothCallback for BluetoothCallbackDBus { #[dbus_method("OnAdapterPropertyChanged")] fn on_adapter_property_changed(&self, prop: BtPropertyType) { dbus_generated!() } #[dbus_method("OnAddressChanged")] fn on_address_changed(&self, addr: String) { dbus_generated!() Loading Loading @@ -76,6 +80,7 @@ impl IBluetoothCallback for BluetoothCallbackDBus { } impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtPropertyType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(Profile); Loading system/gd/rust/linux/stack/src/bluetooth.rs +7 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,9 @@ impl BluetoothDeviceContext { /// The interface for adapter callbacks registered through `IBluetooth::register_callback`. pub trait IBluetoothCallback: RPCProxy { /// When any adapter property changes. fn on_adapter_property_changed(&self, prop: BtPropertyType); /// When any of the adapter local address is changed. fn on_address_changed(&self, addr: String); Loading Loading @@ -680,6 +683,10 @@ impl BtifBluetoothCallbacks for Bluetooth { } self.properties.insert(prop.get_type(), prop); self.for_all_callbacks(|callback| { callback.on_adapter_property_changed(prop.get_type()); }); } } Loading Loading
system/gd/rust/linux/client/src/callbacks.rs +3 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ use crate::dbus_iface::{ }; use crate::ClientContext; use crate::{console_yellow, print_info}; use bt_topshim::btif::{BtBondState, BtSspVariant}; use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant}; use bt_topshim::profiles::gatt::GattStatus; use btstack::bluetooth::{ BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback, Loading Loading @@ -101,6 +101,8 @@ impl BtCallback { } impl IBluetoothCallback for BtCallback { fn on_adapter_property_changed(&self, prop: BtPropertyType) {} fn on_address_changed(&self, addr: String) { print_info!("Address changed to {}", &addr); self.context.lock().unwrap().adapter_address = Some(addr); Loading
system/gd/rust/linux/client/src/dbus_iface.rs +5 −1 Original line number Diff line number Diff line //! D-Bus proxy implementations of the APIs. use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtPropertyType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::profiles::gatt::GattStatus; use btstack::bluetooth::{ Loading Loading @@ -41,6 +41,7 @@ fn make_object_path(idx: i32, name: &str) -> dbus::Path { } impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtPropertyType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(GattStatus); Loading Loading @@ -123,6 +124,9 @@ impl RPCProxy for IBluetoothCallbackDBus { "org.chromium.bluetooth.BluetoothCallback" )] impl IBluetoothCallback for IBluetoothCallbackDBus { #[dbus_method("OnAdapterPropertyChanged")] fn on_adapter_property_changed(&self, prop: BtPropertyType) {} #[dbus_method("OnAddressChanged")] fn on_address_changed(&self, addr: String) {} Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +6 −1 Original line number Diff line number Diff line extern crate bt_shim; use bt_topshim::btif::{BtDeviceType, BtSspVariant, BtTransport, Uuid128Bit}; use bt_topshim::btif::{BtDeviceType, BtPropertyType, BtSspVariant, BtTransport, Uuid128Bit}; use btstack::bluetooth::{ BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback, Loading Loading @@ -35,6 +35,10 @@ struct BluetoothCallbackDBus {} #[dbus_proxy_obj(BluetoothCallback, "org.chromium.bluetooth.BluetoothCallback")] impl IBluetoothCallback for BluetoothCallbackDBus { #[dbus_method("OnAdapterPropertyChanged")] fn on_adapter_property_changed(&self, prop: BtPropertyType) { dbus_generated!() } #[dbus_method("OnAddressChanged")] fn on_address_changed(&self, addr: String) { dbus_generated!() Loading Loading @@ -76,6 +80,7 @@ impl IBluetoothCallback for BluetoothCallbackDBus { } impl_dbus_arg_enum!(BtDeviceType); impl_dbus_arg_enum!(BtPropertyType); impl_dbus_arg_enum!(BtSspVariant); impl_dbus_arg_enum!(BtTransport); impl_dbus_arg_enum!(Profile); Loading
system/gd/rust/linux/stack/src/bluetooth.rs +7 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,9 @@ impl BluetoothDeviceContext { /// The interface for adapter callbacks registered through `IBluetooth::register_callback`. pub trait IBluetoothCallback: RPCProxy { /// When any adapter property changes. fn on_adapter_property_changed(&self, prop: BtPropertyType); /// When any of the adapter local address is changed. fn on_address_changed(&self, addr: String); Loading Loading @@ -680,6 +683,10 @@ impl BtifBluetoothCallbacks for Bluetooth { } self.properties.insert(prop.get_type(), prop); self.for_all_callbacks(|callback| { callback.on_adapter_property_changed(prop.get_type()); }); } } Loading