Loading system/gd/rust/linux/client/src/callbacks.rs +12 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,18 @@ impl IBluetoothCallback for BtCallback { } } fn on_pin_request(&self, remote_device: BluetoothDevice, _cod: u32, min_16_digit: bool) { print_info!( "Device [{}: {}] would like to pair, enter pin code {}", &remote_device.address, &remote_device.name, match min_16_digit { true => "with at least 16 digits", false => "", } ); } fn on_bond_state_changed(&self, status: u32, address: String, state: u32) { print_info!("Bonding state changed: [{}] state: {}, Status = {}", address, state, status); Loading system/gd/rust/linux/client/src/dbus_iface.rs +3 −0 Original line number Diff line number Diff line Loading @@ -511,6 +511,9 @@ impl IBluetoothCallback for IBluetoothCallbackDBus { ) { } #[dbus_method("OnPinRequest")] fn on_pin_request(&self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool) {} #[dbus_method("OnBondStateChanged")] fn on_bond_state_changed(&self, status: u32, address: String, state: u32) {} Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +4 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,10 @@ impl IBluetoothCallback for BluetoothCallbackDBus { ) { dbus_generated!() } #[dbus_method("OnPinRequest")] fn on_pin_request(&self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool) { dbus_generated!() } #[dbus_method("OnBondStateChanged")] fn on_bond_state_changed(&self, status: u32, address: String, state: u32) { dbus_generated!() Loading system/gd/rust/linux/stack/src/bluetooth.rs +32 −1 Original line number Diff line number Diff line Loading @@ -383,6 +383,9 @@ pub trait IBluetoothCallback: RPCProxy { passkey: u32, ); /// When there is a pin request to display the event to client. fn on_pin_request(&self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool); /// When a bonding attempt has completed. fn on_bond_state_changed(&self, status: u32, device_address: String, state: u32); Loading Loading @@ -934,6 +937,16 @@ pub(crate) trait BtifBluetoothCallbacks { #[btif_callback(LeRandCallback)] fn le_rand_cb(&mut self, random: u64) {} #[btif_callback(PinRequest)] fn pin_request( &mut self, remote_addr: RawAddress, remote_name: String, cod: u32, min_16_digit: bool, ) { } } #[btif_callbacks_dispatcher(dispatch_hid_host_callbacks, HHCallbacks)] Loading Loading @@ -1155,7 +1168,7 @@ impl BtifBluetoothCallbacks for Bluetooth { passkey: u32, ) { // Currently this supports many agent because we accept many callbacks. // TODO: We need a way to select the default agent. // TODO(b/274706838): We need a way to select the default agent. self.callbacks.for_all_callbacks(|callback| { callback.on_ssp_request( BluetoothDevice::new(remote_addr.to_string(), remote_name.clone()), Loading @@ -1166,6 +1179,24 @@ impl BtifBluetoothCallbacks for Bluetooth { }); } fn pin_request( &mut self, remote_addr: RawAddress, remote_name: String, cod: u32, min_16_digit: bool, ) { // Currently this supports many agent because we accept many callbacks. // TODO(b/274706838): We need a way to select the default agent. self.callbacks.for_all_callbacks(|callback| { callback.on_pin_request( BluetoothDevice::new(remote_addr.to_string(), remote_name.clone()), cod, min_16_digit, ); }); } fn bond_state( &mut self, status: BtStatus, Loading Loading
system/gd/rust/linux/client/src/callbacks.rs +12 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,18 @@ impl IBluetoothCallback for BtCallback { } } fn on_pin_request(&self, remote_device: BluetoothDevice, _cod: u32, min_16_digit: bool) { print_info!( "Device [{}: {}] would like to pair, enter pin code {}", &remote_device.address, &remote_device.name, match min_16_digit { true => "with at least 16 digits", false => "", } ); } fn on_bond_state_changed(&self, status: u32, address: String, state: u32) { print_info!("Bonding state changed: [{}] state: {}, Status = {}", address, state, status); Loading
system/gd/rust/linux/client/src/dbus_iface.rs +3 −0 Original line number Diff line number Diff line Loading @@ -511,6 +511,9 @@ impl IBluetoothCallback for IBluetoothCallbackDBus { ) { } #[dbus_method("OnPinRequest")] fn on_pin_request(&self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool) {} #[dbus_method("OnBondStateChanged")] fn on_bond_state_changed(&self, status: u32, address: String, state: u32) {} Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +4 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,10 @@ impl IBluetoothCallback for BluetoothCallbackDBus { ) { dbus_generated!() } #[dbus_method("OnPinRequest")] fn on_pin_request(&self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool) { dbus_generated!() } #[dbus_method("OnBondStateChanged")] fn on_bond_state_changed(&self, status: u32, address: String, state: u32) { dbus_generated!() Loading
system/gd/rust/linux/stack/src/bluetooth.rs +32 −1 Original line number Diff line number Diff line Loading @@ -383,6 +383,9 @@ pub trait IBluetoothCallback: RPCProxy { passkey: u32, ); /// When there is a pin request to display the event to client. fn on_pin_request(&self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool); /// When a bonding attempt has completed. fn on_bond_state_changed(&self, status: u32, device_address: String, state: u32); Loading Loading @@ -934,6 +937,16 @@ pub(crate) trait BtifBluetoothCallbacks { #[btif_callback(LeRandCallback)] fn le_rand_cb(&mut self, random: u64) {} #[btif_callback(PinRequest)] fn pin_request( &mut self, remote_addr: RawAddress, remote_name: String, cod: u32, min_16_digit: bool, ) { } } #[btif_callbacks_dispatcher(dispatch_hid_host_callbacks, HHCallbacks)] Loading Loading @@ -1155,7 +1168,7 @@ impl BtifBluetoothCallbacks for Bluetooth { passkey: u32, ) { // Currently this supports many agent because we accept many callbacks. // TODO: We need a way to select the default agent. // TODO(b/274706838): We need a way to select the default agent. self.callbacks.for_all_callbacks(|callback| { callback.on_ssp_request( BluetoothDevice::new(remote_addr.to_string(), remote_name.clone()), Loading @@ -1166,6 +1179,24 @@ impl BtifBluetoothCallbacks for Bluetooth { }); } fn pin_request( &mut self, remote_addr: RawAddress, remote_name: String, cod: u32, min_16_digit: bool, ) { // Currently this supports many agent because we accept many callbacks. // TODO(b/274706838): We need a way to select the default agent. self.callbacks.for_all_callbacks(|callback| { callback.on_pin_request( BluetoothDevice::new(remote_addr.to_string(), remote_name.clone()), cod, min_16_digit, ); }); } fn bond_state( &mut self, status: BtStatus, Loading