Loading system/gd/rust/common/src/init_flags.rs +4 −2 Original line number Diff line number Diff line Loading @@ -344,11 +344,11 @@ init_flags!( pass_phy_update_callback = true, pbap_pse_dynamic_version_upgrade = true, periodic_advertising_adi = true, private_gatt, private_gatt = true, queue_l2cap_coc_while_encrypting = true, read_encryption_key_size = true, redact_log = true, rust_event_loop, rust_event_loop = true, sdp_serialization = true, sdp_skip_rnr_if_known = true, bluetooth_quality_report_callback = true, Loading @@ -375,6 +375,8 @@ init_flags!( "--hci" => parse_hci_adapter(_, _), } dependencies: { always_use_private_gatt_for_debugging => private_gatt, private_gatt => rust_event_loop, gd_core => gd_security } ); Loading system/gd/rust/linux/client/src/dbus_iface.rs +21 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ use btstack::bluetooth_gatt::{ ScanFilterPattern, ScanResult, ScanSettings, ScanType, }; use btstack::bluetooth_media::IBluetoothTelephony; use btstack::bluetooth_qa::IBluetoothQA; use btstack::socket_manager::{ BluetoothServerSocket, BluetoothSocket, CallbackId, IBluetoothSocketManager, IBluetoothSocketManagerCallbacks, SocketId, SocketResult, Loading Loading @@ -2226,3 +2227,23 @@ impl IBluetoothTelephony for BluetoothTelephonyDBus { dbus_generated!() } } pub(crate) struct BluetoothQADBus { _client_proxy: ClientDBusProxy, } impl BluetoothQADBus { pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothQADBus { BluetoothQADBus { _client_proxy: ClientDBusProxy::new( conn.clone(), String::from("org.chromium.bluetooth"), make_object_path(index, "qa"), String::from("org.chromium.bluetooth.BluetoothQA"), ), } } } #[generate_dbus_interface_client] impl IBluetoothQA for BluetoothQADBus {} system/gd/rust/linux/client/src/main.rs +6 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use crate::callbacks::{ }; use crate::command_handler::{CommandHandler, SocketSchedule}; use crate::dbus_iface::{ BluetoothAdminDBus, BluetoothDBus, BluetoothGattDBus, BluetoothManagerDBus, BluetoothAdminDBus, BluetoothDBus, BluetoothGattDBus, BluetoothManagerDBus, BluetoothQADBus, BluetoothQALegacyDBus, BluetoothSocketManagerDBus, BluetoothTelephonyDBus, SuspendDBus, }; use crate::editor::AsyncEditor; Loading Loading @@ -77,6 +77,9 @@ pub(crate) struct ClientContext { /// Proxy for adapter QA Legacy interface. Only exists when the default adapter is enabled. pub(crate) qa_legacy_dbus: Option<BluetoothQALegacyDBus>, /// Proxy for adapter QA interface. pub(crate) qa_dbus: Option<BluetoothQADBus>, /// Proxy for GATT interface. pub(crate) gatt_dbus: Option<BluetoothGattDBus>, Loading Loading @@ -156,6 +159,7 @@ impl ClientContext { manager_dbus, adapter_dbus: None, qa_legacy_dbus: None, qa_dbus: None, gatt_dbus: None, admin_dbus: None, suspend_dbus: None, Loading Loading @@ -205,6 +209,7 @@ impl ClientContext { let dbus = BluetoothDBus::new(conn.clone(), idx); self.adapter_dbus = Some(dbus); self.qa_legacy_dbus = Some(BluetoothQALegacyDBus::new(conn.clone(), idx)); self.qa_dbus = Some(BluetoothQADBus::new(conn.clone(), idx)); let gatt_dbus = BluetoothGattDBus::new(conn.clone(), idx); self.gatt_dbus = Some(gatt_dbus); Loading system/gd/rust/linux/service/src/iface_bluetooth_qa.rs 0 → 100644 +8 −0 Original line number Diff line number Diff line use btstack::bluetooth_qa::IBluetoothQA; use dbus_macros::generate_dbus_exporter; struct IBluetoothQADBus {} #[generate_dbus_exporter(export_bluetooth_qa_dbus_intf, "org.chromium.bluetooth.BluetoothQA")] impl IBluetoothQA for IBluetoothQADBus {} system/gd/rust/linux/service/src/main.rs +10 −0 Original line number Diff line number Diff line use btstack::bluetooth_qa::BluetoothQA; use clap::{App, AppSettings, Arg}; use dbus::{channel::MatchingReceiver, message::MatchRule}; use dbus_crossroads::Crossroads; Loading Loading @@ -38,6 +39,7 @@ mod iface_bluetooth; mod iface_bluetooth_admin; mod iface_bluetooth_gatt; mod iface_bluetooth_media; mod iface_bluetooth_qa; mod iface_bluetooth_telephony; mod iface_logging; Loading Loading @@ -174,6 +176,7 @@ fn main() -> Result<(), Box<dyn Error>> { )))); let logging = Arc::new(Mutex::new(Box::new(BluetoothLogging::new(is_debug, log_output)))); let bt_sock_mgr = Arc::new(Mutex::new(Box::new(BluetoothSocketManager::new(tx.clone())))); let qa = Arc::new(Mutex::new(Box::new(BluetoothQA::new(tx.clone())))); topstack::get_runtime().block_on(async { // Connect to D-Bus system bus. Loading Loading @@ -240,6 +243,11 @@ fn main() -> Result<(), Box<dyn Error>> { &mut cr.lock().unwrap(), disconnect_watcher.clone(), ); let qa_iface = iface_bluetooth_qa::export_bluetooth_qa_dbus_intf( conn.clone(), &mut cr.lock().unwrap(), disconnect_watcher.clone(), ); let qa_legacy_iface = iface_bluetooth::export_bluetooth_qa_legacy_dbus_intf( conn.clone(), &mut cr.lock().unwrap(), Loading Loading @@ -355,6 +363,8 @@ fn main() -> Result<(), Box<dyn Error>> { logging.clone(), ); cr.lock().unwrap().insert(make_object_name(adapter_index, "qa"), &[qa_iface], qa.clone()); // Hold locks and initialize all interfaces. This must be done AFTER DBus is // initialized so DBus can properly enforce user policies. { Loading Loading
system/gd/rust/common/src/init_flags.rs +4 −2 Original line number Diff line number Diff line Loading @@ -344,11 +344,11 @@ init_flags!( pass_phy_update_callback = true, pbap_pse_dynamic_version_upgrade = true, periodic_advertising_adi = true, private_gatt, private_gatt = true, queue_l2cap_coc_while_encrypting = true, read_encryption_key_size = true, redact_log = true, rust_event_loop, rust_event_loop = true, sdp_serialization = true, sdp_skip_rnr_if_known = true, bluetooth_quality_report_callback = true, Loading @@ -375,6 +375,8 @@ init_flags!( "--hci" => parse_hci_adapter(_, _), } dependencies: { always_use_private_gatt_for_debugging => private_gatt, private_gatt => rust_event_loop, gd_core => gd_security } ); Loading
system/gd/rust/linux/client/src/dbus_iface.rs +21 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ use btstack::bluetooth_gatt::{ ScanFilterPattern, ScanResult, ScanSettings, ScanType, }; use btstack::bluetooth_media::IBluetoothTelephony; use btstack::bluetooth_qa::IBluetoothQA; use btstack::socket_manager::{ BluetoothServerSocket, BluetoothSocket, CallbackId, IBluetoothSocketManager, IBluetoothSocketManagerCallbacks, SocketId, SocketResult, Loading Loading @@ -2226,3 +2227,23 @@ impl IBluetoothTelephony for BluetoothTelephonyDBus { dbus_generated!() } } pub(crate) struct BluetoothQADBus { _client_proxy: ClientDBusProxy, } impl BluetoothQADBus { pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothQADBus { BluetoothQADBus { _client_proxy: ClientDBusProxy::new( conn.clone(), String::from("org.chromium.bluetooth"), make_object_path(index, "qa"), String::from("org.chromium.bluetooth.BluetoothQA"), ), } } } #[generate_dbus_interface_client] impl IBluetoothQA for BluetoothQADBus {}
system/gd/rust/linux/client/src/main.rs +6 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ use crate::callbacks::{ }; use crate::command_handler::{CommandHandler, SocketSchedule}; use crate::dbus_iface::{ BluetoothAdminDBus, BluetoothDBus, BluetoothGattDBus, BluetoothManagerDBus, BluetoothAdminDBus, BluetoothDBus, BluetoothGattDBus, BluetoothManagerDBus, BluetoothQADBus, BluetoothQALegacyDBus, BluetoothSocketManagerDBus, BluetoothTelephonyDBus, SuspendDBus, }; use crate::editor::AsyncEditor; Loading Loading @@ -77,6 +77,9 @@ pub(crate) struct ClientContext { /// Proxy for adapter QA Legacy interface. Only exists when the default adapter is enabled. pub(crate) qa_legacy_dbus: Option<BluetoothQALegacyDBus>, /// Proxy for adapter QA interface. pub(crate) qa_dbus: Option<BluetoothQADBus>, /// Proxy for GATT interface. pub(crate) gatt_dbus: Option<BluetoothGattDBus>, Loading Loading @@ -156,6 +159,7 @@ impl ClientContext { manager_dbus, adapter_dbus: None, qa_legacy_dbus: None, qa_dbus: None, gatt_dbus: None, admin_dbus: None, suspend_dbus: None, Loading Loading @@ -205,6 +209,7 @@ impl ClientContext { let dbus = BluetoothDBus::new(conn.clone(), idx); self.adapter_dbus = Some(dbus); self.qa_legacy_dbus = Some(BluetoothQALegacyDBus::new(conn.clone(), idx)); self.qa_dbus = Some(BluetoothQADBus::new(conn.clone(), idx)); let gatt_dbus = BluetoothGattDBus::new(conn.clone(), idx); self.gatt_dbus = Some(gatt_dbus); Loading
system/gd/rust/linux/service/src/iface_bluetooth_qa.rs 0 → 100644 +8 −0 Original line number Diff line number Diff line use btstack::bluetooth_qa::IBluetoothQA; use dbus_macros::generate_dbus_exporter; struct IBluetoothQADBus {} #[generate_dbus_exporter(export_bluetooth_qa_dbus_intf, "org.chromium.bluetooth.BluetoothQA")] impl IBluetoothQA for IBluetoothQADBus {}
system/gd/rust/linux/service/src/main.rs +10 −0 Original line number Diff line number Diff line use btstack::bluetooth_qa::BluetoothQA; use clap::{App, AppSettings, Arg}; use dbus::{channel::MatchingReceiver, message::MatchRule}; use dbus_crossroads::Crossroads; Loading Loading @@ -38,6 +39,7 @@ mod iface_bluetooth; mod iface_bluetooth_admin; mod iface_bluetooth_gatt; mod iface_bluetooth_media; mod iface_bluetooth_qa; mod iface_bluetooth_telephony; mod iface_logging; Loading Loading @@ -174,6 +176,7 @@ fn main() -> Result<(), Box<dyn Error>> { )))); let logging = Arc::new(Mutex::new(Box::new(BluetoothLogging::new(is_debug, log_output)))); let bt_sock_mgr = Arc::new(Mutex::new(Box::new(BluetoothSocketManager::new(tx.clone())))); let qa = Arc::new(Mutex::new(Box::new(BluetoothQA::new(tx.clone())))); topstack::get_runtime().block_on(async { // Connect to D-Bus system bus. Loading Loading @@ -240,6 +243,11 @@ fn main() -> Result<(), Box<dyn Error>> { &mut cr.lock().unwrap(), disconnect_watcher.clone(), ); let qa_iface = iface_bluetooth_qa::export_bluetooth_qa_dbus_intf( conn.clone(), &mut cr.lock().unwrap(), disconnect_watcher.clone(), ); let qa_legacy_iface = iface_bluetooth::export_bluetooth_qa_legacy_dbus_intf( conn.clone(), &mut cr.lock().unwrap(), Loading Loading @@ -355,6 +363,8 @@ fn main() -> Result<(), Box<dyn Error>> { logging.clone(), ); cr.lock().unwrap().insert(make_object_name(adapter_index, "qa"), &[qa_iface], qa.clone()); // Hold locks and initialize all interfaces. This must be done AFTER DBus is // initialized so DBus can properly enforce user policies. { Loading