Loading system/gd/rust/linux/client/src/dbus_iface.rs +9 −0 Original line number Diff line number Diff line Loading @@ -723,6 +723,11 @@ impl IBluetooth for BluetoothDBus { dbus_generated!() } fn init(&mut self, init_flags: Vec<String>) -> bool { // Not implemented by server true } fn enable(&mut self) -> bool { // Not implemented by server true Loading @@ -733,6 +738,10 @@ impl IBluetooth for BluetoothDBus { true } fn cleanup(&mut self) { // Not implemented by server } #[dbus_method("GetAddress")] fn get_address(&self) -> String { dbus_generated!() Loading system/gd/rust/linux/service/src/iface_bluetooth.rs +10 −1 Original line number Diff line number Diff line Loading @@ -440,17 +440,26 @@ impl IBluetooth for IBluetoothDBus { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically initialized when the daemon starts. fn init(&mut self, init_flags: Vec<String>) -> bool { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically enabled when the daemon starts. fn enable(&mut self) -> bool { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically disabled when the daemon exits. // TODO(b/189495858): Handle shutdown properly when SIGTERM is received. fn disable(&mut self) -> bool { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically cleaned up when the daemon exits. fn cleanup(&mut self) { dbus_generated!() } #[dbus_method("GetAddress")] fn get_address(&self) -> String { dbus_generated!() Loading system/gd/rust/linux/service/src/main.rs +2 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ use btstack::{ battery_manager::BatteryManager, battery_provider_manager::BatteryProviderManager, battery_service::BatteryService, bluetooth::{get_bt_dispatcher, Bluetooth, IBluetooth}, bluetooth::{Bluetooth, IBluetooth}, bluetooth_admin::BluetoothAdmin, bluetooth_gatt::BluetoothGatt, bluetooth_logging::BluetoothLogging, Loading Loading @@ -382,13 +382,12 @@ fn main() -> Result<(), Box<dyn Error>> { // Hold locks and initialize all interfaces. This must be done AFTER DBus is // initialized so DBus can properly enforce user policies. { intf.lock().unwrap().initialize(get_bt_dispatcher(tx.clone()), init_flags); let adapter = bluetooth.clone(); bluetooth_media.lock().unwrap().set_adapter(adapter.clone()); bluetooth_admin.lock().unwrap().set_adapter(adapter.clone()); let mut bluetooth = bluetooth.lock().unwrap(); bluetooth.init(init_flags); bluetooth.init_profiles(); bluetooth.enable(); Loading system/gd/rust/linux/stack/src/bluetooth.rs +14 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ pub trait IBluetooth { /// Removes registered callback. fn unregister_connection_callback(&mut self, callback_id: u32) -> bool; /// Inits the bluetooth interface. Should always be called before enable. fn init(&mut self, init_flags: Vec<String>) -> bool; /// Enables the adapter. /// /// Returns true if the request is accepted. Loading @@ -89,6 +92,9 @@ pub trait IBluetooth { /// Returns true if the request is accepted. fn disable(&mut self) -> bool; /// Cleans up the bluetooth interface. Should always be called after disable. fn cleanup(&mut self); /// Returns the Bluetooth address of the local adapter. fn get_address(&self) -> String; Loading Loading @@ -1788,6 +1794,10 @@ impl IBluetooth for Bluetooth { self.connection_callbacks.remove_callback(callback_id) } fn init(&mut self, init_flags: Vec<String>) -> bool { self.intf.lock().unwrap().initialize(get_bt_dispatcher(self.tx.clone()), init_flags) } fn enable(&mut self) -> bool { self.intf.lock().unwrap().enable() == 0 } Loading @@ -1796,6 +1806,10 @@ impl IBluetooth for Bluetooth { self.intf.lock().unwrap().disable() == 0 } fn cleanup(&mut self) { self.intf.lock().unwrap().cleanup(); } fn get_address(&self) -> String { match self.local_address { None => String::from(""), Loading system/gd/rust/linux/stack/src/lib.rs +1 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ impl Stack { match m.unwrap() { Message::Shutdown => { bluetooth.lock().unwrap().disable(); bluetooth.lock().unwrap().cleanup(); } Message::AdapterReady => { Loading Loading
system/gd/rust/linux/client/src/dbus_iface.rs +9 −0 Original line number Diff line number Diff line Loading @@ -723,6 +723,11 @@ impl IBluetooth for BluetoothDBus { dbus_generated!() } fn init(&mut self, init_flags: Vec<String>) -> bool { // Not implemented by server true } fn enable(&mut self) -> bool { // Not implemented by server true Loading @@ -733,6 +738,10 @@ impl IBluetooth for BluetoothDBus { true } fn cleanup(&mut self) { // Not implemented by server } #[dbus_method("GetAddress")] fn get_address(&self) -> String { dbus_generated!() Loading
system/gd/rust/linux/service/src/iface_bluetooth.rs +10 −1 Original line number Diff line number Diff line Loading @@ -440,17 +440,26 @@ impl IBluetooth for IBluetoothDBus { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically initialized when the daemon starts. fn init(&mut self, init_flags: Vec<String>) -> bool { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically enabled when the daemon starts. fn enable(&mut self) -> bool { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically disabled when the daemon exits. // TODO(b/189495858): Handle shutdown properly when SIGTERM is received. fn disable(&mut self) -> bool { dbus_generated!() } // Not exposed over D-Bus. The stack is automatically cleaned up when the daemon exits. fn cleanup(&mut self) { dbus_generated!() } #[dbus_method("GetAddress")] fn get_address(&self) -> String { dbus_generated!() Loading
system/gd/rust/linux/service/src/main.rs +2 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ use btstack::{ battery_manager::BatteryManager, battery_provider_manager::BatteryProviderManager, battery_service::BatteryService, bluetooth::{get_bt_dispatcher, Bluetooth, IBluetooth}, bluetooth::{Bluetooth, IBluetooth}, bluetooth_admin::BluetoothAdmin, bluetooth_gatt::BluetoothGatt, bluetooth_logging::BluetoothLogging, Loading Loading @@ -382,13 +382,12 @@ fn main() -> Result<(), Box<dyn Error>> { // Hold locks and initialize all interfaces. This must be done AFTER DBus is // initialized so DBus can properly enforce user policies. { intf.lock().unwrap().initialize(get_bt_dispatcher(tx.clone()), init_flags); let adapter = bluetooth.clone(); bluetooth_media.lock().unwrap().set_adapter(adapter.clone()); bluetooth_admin.lock().unwrap().set_adapter(adapter.clone()); let mut bluetooth = bluetooth.lock().unwrap(); bluetooth.init(init_flags); bluetooth.init_profiles(); bluetooth.enable(); Loading
system/gd/rust/linux/stack/src/bluetooth.rs +14 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ pub trait IBluetooth { /// Removes registered callback. fn unregister_connection_callback(&mut self, callback_id: u32) -> bool; /// Inits the bluetooth interface. Should always be called before enable. fn init(&mut self, init_flags: Vec<String>) -> bool; /// Enables the adapter. /// /// Returns true if the request is accepted. Loading @@ -89,6 +92,9 @@ pub trait IBluetooth { /// Returns true if the request is accepted. fn disable(&mut self) -> bool; /// Cleans up the bluetooth interface. Should always be called after disable. fn cleanup(&mut self); /// Returns the Bluetooth address of the local adapter. fn get_address(&self) -> String; Loading Loading @@ -1788,6 +1794,10 @@ impl IBluetooth for Bluetooth { self.connection_callbacks.remove_callback(callback_id) } fn init(&mut self, init_flags: Vec<String>) -> bool { self.intf.lock().unwrap().initialize(get_bt_dispatcher(self.tx.clone()), init_flags) } fn enable(&mut self) -> bool { self.intf.lock().unwrap().enable() == 0 } Loading @@ -1796,6 +1806,10 @@ impl IBluetooth for Bluetooth { self.intf.lock().unwrap().disable() == 0 } fn cleanup(&mut self) { self.intf.lock().unwrap().cleanup(); } fn get_address(&self) -> String { match self.local_address { None => String::from(""), Loading
system/gd/rust/linux/stack/src/lib.rs +1 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ impl Stack { match m.unwrap() { Message::Shutdown => { bluetooth.lock().unwrap().disable(); bluetooth.lock().unwrap().cleanup(); } Message::AdapterReady => { Loading