Loading system/gd/rust/linux/dbus_projection/src/lib.rs +11 −0 Original line number Diff line number Diff line Loading @@ -187,3 +187,14 @@ macro_rules! impl_dbus_arg_enum { } }; } /// Marks a function to be implemented by dbus_projection macros. #[macro_export] macro_rules! dbus_generated { () => { // The implementation is not used but replaced by generated code. // This uses panic! so that the compiler can accept it for any function // return type. panic!("To be implemented by dbus_projection macros"); }; } system/gd/rust/linux/service/src/iface_bluetooth.rs +51 −36 Original line number Diff line number Diff line Loading @@ -14,8 +14,8 @@ use dbus::strings::Path; use dbus_macros::{dbus_method, dbus_propmap, dbus_proxy_obj, generate_dbus_exporter}; use dbus_projection::impl_dbus_arg_enum; use dbus_projection::DisconnectWatcher; use dbus_projection::{dbus_generated, impl_dbus_arg_enum}; use num_traits::cast::{FromPrimitive, ToPrimitive}; Loading @@ -35,11 +35,17 @@ struct BluetoothCallbackDBus {} #[dbus_proxy_obj(BluetoothCallback, "org.chromium.bluetooth.BluetoothCallback")] impl IBluetoothCallback for BluetoothCallbackDBus { #[dbus_method("OnAddressChanged")] fn on_address_changed(&self, addr: String) {} fn on_address_changed(&self, addr: String) { dbus_generated!() } #[dbus_method("OnDeviceFound")] fn on_device_found(&self, remote_device: BluetoothDevice) {} fn on_device_found(&self, remote_device: BluetoothDevice) { dbus_generated!() } #[dbus_method("OnDiscoveringChanged")] fn on_discovering_changed(&self, discovering: bool) {} fn on_discovering_changed(&self, discovering: bool) { dbus_generated!() } #[dbus_method("OnSspRequest")] fn on_ssp_request( &self, Loading @@ -48,9 +54,12 @@ impl IBluetoothCallback for BluetoothCallbackDBus { variant: BtSspVariant, passkey: u32, ) { dbus_generated!() } #[dbus_method("OnBondStateChanged")] fn on_bond_state_changed(&self, status: u32, address: String, state: u32) {} fn on_bond_state_changed(&self, status: u32, address: String, state: u32) { dbus_generated!() } } impl_dbus_arg_enum!(BtTransport); Loading @@ -62,10 +71,14 @@ struct BluetoothConnectionCallbackDBus {} #[dbus_proxy_obj(BluetoothConnectionCallback, "org.chromium.bluetooth.BluetoothConnectionCallback")] impl IBluetoothConnectionCallback for BluetoothConnectionCallbackDBus { #[dbus_method("OnDeviceConnected")] fn on_device_connected(&self, remote_device: BluetoothDevice) {} fn on_device_connected(&self, remote_device: BluetoothDevice) { dbus_generated!() } #[dbus_method("OnDeviceDisconnected")] fn on_device_disconnected(&self, remote_device: BluetoothDevice) {} fn on_device_disconnected(&self, remote_device: BluetoothDevice) { dbus_generated!() } } #[allow(dead_code)] Loading @@ -74,60 +87,62 @@ struct IBluetoothDBus {} #[generate_dbus_exporter(export_bluetooth_dbus_obj, "org.chromium.bluetooth.Bluetooth")] impl IBluetooth for IBluetoothDBus { #[dbus_method("RegisterCallback")] fn register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) {} fn register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) { dbus_generated!() } #[dbus_method("RegisterConnectionCallback")] fn register_connection_callback( &mut self, callback: Box<dyn IBluetoothConnectionCallback + Send>, ) -> u32 { 0 dbus_generated!() } #[dbus_method("UnregisterConnectionCallback")] fn unregister_connection_callback(&mut self, id: u32) -> bool { false dbus_generated!() } // Not exposed over D-Bus. The stack is automatically enabled when the daemon starts. fn enable(&mut self) -> bool { false 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 { false dbus_generated!() } #[dbus_method("GetAddress")] fn get_address(&self) -> String { String::from("") dbus_generated!() } #[dbus_method("GetUuids")] fn get_uuids(&self) -> Vec<Uuid128Bit> { vec![] dbus_generated!() } #[dbus_method("GetName")] fn get_name(&self) -> String { String::new() dbus_generated!() } #[dbus_method("SetName")] fn set_name(&self, name: String) -> bool { true dbus_generated!() } #[dbus_method("GetBluetoothClass")] fn get_bluetooth_class(&self) -> u32 { 0 dbus_generated!() } #[dbus_method("SetBluetoothClass")] fn set_bluetooth_class(&self, cod: u32) -> bool { true dbus_generated!() } #[dbus_method("GetDiscoverable")] Loading @@ -152,91 +167,91 @@ impl IBluetooth for IBluetoothDBus { #[dbus_method("StartDiscovery")] fn start_discovery(&self) -> bool { true dbus_generated!() } #[dbus_method("CancelDiscovery")] fn cancel_discovery(&self) -> bool { true dbus_generated!() } #[dbus_method("IsDiscovering")] fn is_discovering(&self) -> bool { true dbus_generated!() } #[dbus_method("GetDiscoveryEndMillis")] fn get_discovery_end_millis(&self) -> u64 { 0 dbus_generated!() } #[dbus_method("CreateBond")] fn create_bond(&self, _device: BluetoothDevice, _transport: BtTransport) -> bool { true dbus_generated!() } #[dbus_method("CancelBondProcess")] fn cancel_bond_process(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("RemoveBond")] fn remove_bond(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("GetBondedDevices")] fn get_bonded_devices(&self) -> Vec<BluetoothDevice> { vec![] dbus_generated!() } #[dbus_method("GetBondState")] fn get_bond_state(&self, _device: BluetoothDevice) -> u32 { 0 dbus_generated!() } #[dbus_method("SetPin")] fn set_pin(&self, _device: BluetoothDevice, _accept: bool, _pin_code: Vec<u8>) -> bool { false dbus_generated!() } #[dbus_method("SetPasskey")] fn set_passkey(&self, _device: BluetoothDevice, _accept: bool, _passkey: Vec<u8>) -> bool { false dbus_generated!() } #[dbus_method("SetPairingConfirmation")] fn set_pairing_confirmation(&self, _device: BluetoothDevice, _accept: bool) -> bool { false dbus_generated!() } #[dbus_method("GetConnectionState")] fn get_connection_state(&self, _device: BluetoothDevice) -> u32 { 0 dbus_generated!() } #[dbus_method("GetRemoteUuids")] fn get_remote_uuids(&self, _device: BluetoothDevice) -> Vec<Uuid128Bit> { vec![] dbus_generated!() } #[dbus_method("FetchRemoteUuids")] fn fetch_remote_uuids(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("SdpSearch")] fn sdp_search(&self, _device: BluetoothDevice, _uuid: Uuid128Bit) -> bool { true dbus_generated!() } #[dbus_method("ConnectAllEnabledProfiles")] fn connect_all_enabled_profiles(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("DisconnectAllEnabledProfiles")] fn disconnect_all_enabled_profiles(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } } system/gd/rust/linux/service/src/iface_bluetooth_gatt.rs +103 −33 Original line number Diff line number Diff line Loading @@ -14,8 +14,8 @@ use dbus::strings::Path; use dbus_macros::{dbus_method, dbus_propmap, dbus_proxy_obj, generate_dbus_exporter}; use dbus_projection::impl_dbus_arg_enum; use dbus_projection::DisconnectWatcher; use dbus_projection::{dbus_generated, impl_dbus_arg_enum}; use num_traits::cast::{FromPrimitive, ToPrimitive}; Loading @@ -30,7 +30,9 @@ struct BluetoothGattCallbackDBus {} #[dbus_proxy_obj(BluetoothGattCallback, "org.chromium.bluetooth.BluetoothGattCallback")] impl IBluetoothGattCallback for BluetoothGattCallbackDBus { #[dbus_method("OnClientRegistered")] fn on_client_registered(&self, _status: i32, _scanner_id: i32) {} fn on_client_registered(&self, _status: i32, _scanner_id: i32) { dbus_generated!() } #[dbus_method("OnClientConnectionState")] fn on_client_connection_state( Loading @@ -40,40 +42,63 @@ impl IBluetoothGattCallback for BluetoothGattCallbackDBus { connected: bool, addr: String, ) { dbus_generated!() } #[dbus_method("OnPhyUpdate")] fn on_phy_update(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) {} fn on_phy_update(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) { dbus_generated!() } #[dbus_method("OnPhyRead")] fn on_phy_read(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) {} fn on_phy_read(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) { dbus_generated!() } #[dbus_method("OnSearchComplete")] fn on_search_complete(&self, addr: String, services: Vec<BluetoothGattService>, status: i32) {} fn on_search_complete(&self, addr: String, services: Vec<BluetoothGattService>, status: i32) { dbus_generated!() } #[dbus_method("OnCharacteristicRead")] fn on_characteristic_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) {} fn on_characteristic_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) { dbus_generated!() } #[dbus_method("OnCharacteristicWrite")] fn on_characteristic_write(&self, addr: String, status: i32, handle: i32) {} fn on_characteristic_write(&self, addr: String, status: i32, handle: i32) { dbus_generated!() } #[dbus_method("OnExecuteWrite")] fn on_execute_write(&self, addr: String, status: i32) {} fn on_execute_write(&self, addr: String, status: i32) { dbus_generated!() } #[dbus_method("OnDescriptorRead")] fn on_descriptor_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) {} fn on_descriptor_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) { dbus_generated!() } #[dbus_method("OnDescriptorWrite")] fn on_descriptor_write(&self, addr: String, status: i32, handle: i32) {} fn on_descriptor_write(&self, addr: String, status: i32, handle: i32) { dbus_generated!() } #[dbus_method("OnNotify")] fn on_notify(&self, addr: String, handle: i32, value: Vec<u8>) {} fn on_notify(&self, addr: String, handle: i32, value: Vec<u8>) { dbus_generated!() } #[dbus_method("OnReadRemoteRssi")] fn on_read_remote_rssi(&self, addr: String, rssi: i32, status: i32) {} fn on_read_remote_rssi(&self, addr: String, rssi: i32, status: i32) { dbus_generated!() } #[dbus_method("OnConfigureMtu")] fn on_configure_mtu(&self, addr: String, mtu: i32, status: i32) {} fn on_configure_mtu(&self, addr: String, mtu: i32, status: i32) { dbus_generated!() } #[dbus_method("OnConnectionUpdated")] fn on_connection_updated( Loading @@ -84,10 +109,13 @@ impl IBluetoothGattCallback for BluetoothGattCallbackDBus { timeout: i32, status: i32, ) { dbus_generated!() } #[dbus_method("OnServiceChanged")] fn on_service_changed(&self, addr: String) {} fn on_service_changed(&self, addr: String) { dbus_generated!() } } // Represents Uuid128Bit as an array in D-Bus. Loading @@ -114,7 +142,9 @@ struct ScannerCallbackDBus {} #[dbus_proxy_obj(ScannerCallback, "org.chromium.bluetooth.ScannerCallback")] impl IScannerCallback for ScannerCallbackDBus { #[dbus_method("OnScannerRegistered")] fn on_scanner_registered(&self, _status: i32, _scanner_id: i32) {} fn on_scanner_registered(&self, _status: i32, _scanner_id: i32) { dbus_generated!() } } #[dbus_propmap(BluetoothGattDescriptor)] Loading Loading @@ -173,16 +203,24 @@ struct IBluetoothGattDBus {} #[generate_dbus_exporter(export_bluetooth_gatt_dbus_obj, "org.chromium.bluetooth.BluetoothGatt")] impl IBluetoothGatt for IBluetoothGattDBus { #[dbus_method("RegisterScanner")] fn register_scanner(&self, callback: Box<dyn IScannerCallback + Send>) {} fn register_scanner(&self, callback: Box<dyn IScannerCallback + Send>) { dbus_generated!() } #[dbus_method("UnregisterScanner")] fn unregister_scanner(&self, scanner_id: i32) {} fn unregister_scanner(&self, scanner_id: i32) { dbus_generated!() } #[dbus_method("StartScan")] fn start_scan(&self, scanner_id: i32, settings: ScanSettings, filters: Vec<ScanFilter>) {} fn start_scan(&self, scanner_id: i32, settings: ScanSettings, filters: Vec<ScanFilter>) { dbus_generated!() } #[dbus_method("StopScan")] fn stop_scan(&self, scanner_id: i32) {} fn stop_scan(&self, scanner_id: i32) { dbus_generated!() } #[dbus_method("RegisterClient")] fn register_client( Loading @@ -191,10 +229,13 @@ impl IBluetoothGatt for IBluetoothGattDBus { callback: Box<dyn IBluetoothGattCallback + Send>, eatt_support: bool, ) { dbus_generated!() } #[dbus_method("UnregisterClient")] fn unregister_client(&mut self, client_id: i32) {} fn unregister_client(&mut self, client_id: i32) { dbus_generated!() } #[dbus_method("ClientConnect")] fn client_connect( Loading @@ -206,10 +247,13 @@ impl IBluetoothGatt for IBluetoothGattDBus { opportunistic: bool, phy: i32, ) { dbus_generated!() } #[dbus_method("ClientDisconnect")] fn client_disconnect(&self, client_id: i32, addr: String) {} fn client_disconnect(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("ClientSetPreferredPhy")] fn client_set_preferred_phy( Loading @@ -220,22 +264,33 @@ impl IBluetoothGatt for IBluetoothGattDBus { rx_phy: LePhy, phy_options: i32, ) { dbus_generated!() } #[dbus_method("ClientReadPhy")] fn client_read_phy(&mut self, client_id: i32, addr: String) {} fn client_read_phy(&mut self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("RefreshDevice")] fn refresh_device(&self, client_id: i32, addr: String) {} fn refresh_device(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("DiscoverServices")] fn discover_services(&self, client_id: i32, addr: String) {} fn discover_services(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("DiscoverServiceByUuid")] fn discover_service_by_uuid(&self, client_id: i32, addr: String, uuid: String) {} fn discover_service_by_uuid(&self, client_id: i32, addr: String, uuid: String) { dbus_generated!() } #[dbus_method("ReadCharacteristic")] fn read_characteristic(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) {} fn read_characteristic(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) { dbus_generated!() } #[dbus_method("ReadUsingCharacteristicUuid")] fn read_using_characteristic_uuid( Loading @@ -247,6 +302,7 @@ impl IBluetoothGatt for IBluetoothGattDBus { end_handle: i32, auth_req: i32, ) { dbus_generated!() } #[dbus_method("WriteCharacteristic")] Loading @@ -259,11 +315,13 @@ impl IBluetoothGatt for IBluetoothGattDBus { auth_req: i32, value: Vec<u8>, ) -> GattWriteRequestStatus { GattWriteRequestStatus::Success dbus_generated!() } #[dbus_method("ReadDescriptor")] fn read_descriptor(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) {} fn read_descriptor(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) { dbus_generated!() } #[dbus_method("WriteDescriptor")] fn write_descriptor( Loading @@ -274,22 +332,33 @@ impl IBluetoothGatt for IBluetoothGattDBus { auth_req: i32, value: Vec<u8>, ) { dbus_generated!() } #[dbus_method("RegisterForNotification")] fn register_for_notification(&self, client_id: i32, addr: String, handle: i32, enable: bool) {} fn register_for_notification(&self, client_id: i32, addr: String, handle: i32, enable: bool) { dbus_generated!() } #[dbus_method("BeginReliableWrite")] fn begin_reliable_write(&mut self, client_id: i32, addr: String) {} fn begin_reliable_write(&mut self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("EndReliableWrite")] fn end_reliable_write(&mut self, client_id: i32, addr: String, execute: bool) {} fn end_reliable_write(&mut self, client_id: i32, addr: String, execute: bool) { dbus_generated!() } #[dbus_method("ReadRemoteRssi")] fn read_remote_rssi(&self, client_id: i32, addr: String) {} fn read_remote_rssi(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("ConfigureMtu")] fn configure_mtu(&self, client_id: i32, addr: String, mtu: i32) {} fn configure_mtu(&self, client_id: i32, addr: String, mtu: i32) { dbus_generated!() } #[dbus_method("ConnectionParameterUpdate")] fn connection_parameter_update( Loading @@ -303,5 +372,6 @@ impl IBluetoothGatt for IBluetoothGattDBus { min_ce_len: u16, max_ce_len: u16, ) { dbus_generated!() } } system/gd/rust/linux/service/src/iface_bluetooth_media.rs +40 −21 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use dbus::strings::Path; use dbus_macros::{dbus_method, dbus_propmap, dbus_proxy_obj, generate_dbus_exporter}; use dbus_projection::dbus_generated; use dbus_projection::DisconnectWatcher; use crate::dbus_arg::{DBusArg, DBusArgError, RefArgToRust}; Loading @@ -25,16 +26,23 @@ impl IBluetoothMediaCallback for BluetoothMediaCallbackDBus { channel_mode: i32, hfp_cap: i32, ) { dbus_generated!() } #[dbus_method("OnBluetoothAudioDeviceRemoved")] fn on_bluetooth_audio_device_removed(&self, addr: String) {} fn on_bluetooth_audio_device_removed(&self, addr: String) { dbus_generated!() } #[dbus_method("OnAbsoluteVolumeSupportedChanged")] fn on_absolute_volume_supported_changed(&self, supported: bool) {} fn on_absolute_volume_supported_changed(&self, supported: bool) { dbus_generated!() } #[dbus_method("OnAbsoluteVolumeChanged")] fn on_absolute_volume_changed(&self, volume: i32) {} fn on_absolute_volume_changed(&self, volume: i32) { dbus_generated!() } } #[allow(dead_code)] Loading @@ -52,27 +60,33 @@ pub struct PresentationPositionDBus { impl IBluetoothMedia for IBluetoothMediaDBus { #[dbus_method("RegisterCallback")] fn register_callback(&mut self, callback: Box<dyn IBluetoothMediaCallback + Send>) -> bool { true dbus_generated!() } #[dbus_method("Initialize")] fn initialize(&mut self) -> bool { true dbus_generated!() } #[dbus_method("Cleanup")] fn cleanup(&mut self) -> bool { true dbus_generated!() } #[dbus_method("Connect")] fn connect(&mut self, device: String) {} fn connect(&mut self, device: String) { dbus_generated!() } #[dbus_method("SetActiveDevice")] fn set_active_device(&mut self, device: String) {} fn set_active_device(&mut self, device: String) { dbus_generated!() } #[dbus_method("Disconnect")] fn disconnect(&mut self, device: String) {} fn disconnect(&mut self, device: String) { dbus_generated!() } #[dbus_method("SetAudioConfig")] fn set_audio_config( Loading @@ -81,31 +95,36 @@ impl IBluetoothMedia for IBluetoothMediaDBus { bits_per_sample: i32, channel_mode: i32, ) -> bool { true dbus_generated!() } #[dbus_method("SetVolume")] fn set_volume(&mut self, volume: i32) {} fn set_volume(&mut self, volume: i32) { dbus_generated!() } #[dbus_method("StartAudioRequest")] fn start_audio_request(&mut self) {} fn start_audio_request(&mut self) { dbus_generated!() } #[dbus_method("StopAudioRequest")] fn stop_audio_request(&mut self) {} fn stop_audio_request(&mut self) { dbus_generated!() } #[dbus_method("StartScoCall")] fn start_sco_call(&mut self, device: String) {} fn start_sco_call(&mut self, device: String) { dbus_generated!() } #[dbus_method("StopScoCall")] fn stop_sco_call(&mut self, device: String) {} fn stop_sco_call(&mut self, device: String) { dbus_generated!() } #[dbus_method("GetPresentationPosition")] fn get_presentation_position(&mut self) -> PresentationPosition { PresentationPosition { remote_delay_report_ns: 0, total_bytes_read: 0, data_position_sec: 0, data_position_nsec: 0, } dbus_generated!() } } Loading
system/gd/rust/linux/dbus_projection/src/lib.rs +11 −0 Original line number Diff line number Diff line Loading @@ -187,3 +187,14 @@ macro_rules! impl_dbus_arg_enum { } }; } /// Marks a function to be implemented by dbus_projection macros. #[macro_export] macro_rules! dbus_generated { () => { // The implementation is not used but replaced by generated code. // This uses panic! so that the compiler can accept it for any function // return type. panic!("To be implemented by dbus_projection macros"); }; }
system/gd/rust/linux/service/src/iface_bluetooth.rs +51 −36 Original line number Diff line number Diff line Loading @@ -14,8 +14,8 @@ use dbus::strings::Path; use dbus_macros::{dbus_method, dbus_propmap, dbus_proxy_obj, generate_dbus_exporter}; use dbus_projection::impl_dbus_arg_enum; use dbus_projection::DisconnectWatcher; use dbus_projection::{dbus_generated, impl_dbus_arg_enum}; use num_traits::cast::{FromPrimitive, ToPrimitive}; Loading @@ -35,11 +35,17 @@ struct BluetoothCallbackDBus {} #[dbus_proxy_obj(BluetoothCallback, "org.chromium.bluetooth.BluetoothCallback")] impl IBluetoothCallback for BluetoothCallbackDBus { #[dbus_method("OnAddressChanged")] fn on_address_changed(&self, addr: String) {} fn on_address_changed(&self, addr: String) { dbus_generated!() } #[dbus_method("OnDeviceFound")] fn on_device_found(&self, remote_device: BluetoothDevice) {} fn on_device_found(&self, remote_device: BluetoothDevice) { dbus_generated!() } #[dbus_method("OnDiscoveringChanged")] fn on_discovering_changed(&self, discovering: bool) {} fn on_discovering_changed(&self, discovering: bool) { dbus_generated!() } #[dbus_method("OnSspRequest")] fn on_ssp_request( &self, Loading @@ -48,9 +54,12 @@ impl IBluetoothCallback for BluetoothCallbackDBus { variant: BtSspVariant, passkey: u32, ) { dbus_generated!() } #[dbus_method("OnBondStateChanged")] fn on_bond_state_changed(&self, status: u32, address: String, state: u32) {} fn on_bond_state_changed(&self, status: u32, address: String, state: u32) { dbus_generated!() } } impl_dbus_arg_enum!(BtTransport); Loading @@ -62,10 +71,14 @@ struct BluetoothConnectionCallbackDBus {} #[dbus_proxy_obj(BluetoothConnectionCallback, "org.chromium.bluetooth.BluetoothConnectionCallback")] impl IBluetoothConnectionCallback for BluetoothConnectionCallbackDBus { #[dbus_method("OnDeviceConnected")] fn on_device_connected(&self, remote_device: BluetoothDevice) {} fn on_device_connected(&self, remote_device: BluetoothDevice) { dbus_generated!() } #[dbus_method("OnDeviceDisconnected")] fn on_device_disconnected(&self, remote_device: BluetoothDevice) {} fn on_device_disconnected(&self, remote_device: BluetoothDevice) { dbus_generated!() } } #[allow(dead_code)] Loading @@ -74,60 +87,62 @@ struct IBluetoothDBus {} #[generate_dbus_exporter(export_bluetooth_dbus_obj, "org.chromium.bluetooth.Bluetooth")] impl IBluetooth for IBluetoothDBus { #[dbus_method("RegisterCallback")] fn register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) {} fn register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) { dbus_generated!() } #[dbus_method("RegisterConnectionCallback")] fn register_connection_callback( &mut self, callback: Box<dyn IBluetoothConnectionCallback + Send>, ) -> u32 { 0 dbus_generated!() } #[dbus_method("UnregisterConnectionCallback")] fn unregister_connection_callback(&mut self, id: u32) -> bool { false dbus_generated!() } // Not exposed over D-Bus. The stack is automatically enabled when the daemon starts. fn enable(&mut self) -> bool { false 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 { false dbus_generated!() } #[dbus_method("GetAddress")] fn get_address(&self) -> String { String::from("") dbus_generated!() } #[dbus_method("GetUuids")] fn get_uuids(&self) -> Vec<Uuid128Bit> { vec![] dbus_generated!() } #[dbus_method("GetName")] fn get_name(&self) -> String { String::new() dbus_generated!() } #[dbus_method("SetName")] fn set_name(&self, name: String) -> bool { true dbus_generated!() } #[dbus_method("GetBluetoothClass")] fn get_bluetooth_class(&self) -> u32 { 0 dbus_generated!() } #[dbus_method("SetBluetoothClass")] fn set_bluetooth_class(&self, cod: u32) -> bool { true dbus_generated!() } #[dbus_method("GetDiscoverable")] Loading @@ -152,91 +167,91 @@ impl IBluetooth for IBluetoothDBus { #[dbus_method("StartDiscovery")] fn start_discovery(&self) -> bool { true dbus_generated!() } #[dbus_method("CancelDiscovery")] fn cancel_discovery(&self) -> bool { true dbus_generated!() } #[dbus_method("IsDiscovering")] fn is_discovering(&self) -> bool { true dbus_generated!() } #[dbus_method("GetDiscoveryEndMillis")] fn get_discovery_end_millis(&self) -> u64 { 0 dbus_generated!() } #[dbus_method("CreateBond")] fn create_bond(&self, _device: BluetoothDevice, _transport: BtTransport) -> bool { true dbus_generated!() } #[dbus_method("CancelBondProcess")] fn cancel_bond_process(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("RemoveBond")] fn remove_bond(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("GetBondedDevices")] fn get_bonded_devices(&self) -> Vec<BluetoothDevice> { vec![] dbus_generated!() } #[dbus_method("GetBondState")] fn get_bond_state(&self, _device: BluetoothDevice) -> u32 { 0 dbus_generated!() } #[dbus_method("SetPin")] fn set_pin(&self, _device: BluetoothDevice, _accept: bool, _pin_code: Vec<u8>) -> bool { false dbus_generated!() } #[dbus_method("SetPasskey")] fn set_passkey(&self, _device: BluetoothDevice, _accept: bool, _passkey: Vec<u8>) -> bool { false dbus_generated!() } #[dbus_method("SetPairingConfirmation")] fn set_pairing_confirmation(&self, _device: BluetoothDevice, _accept: bool) -> bool { false dbus_generated!() } #[dbus_method("GetConnectionState")] fn get_connection_state(&self, _device: BluetoothDevice) -> u32 { 0 dbus_generated!() } #[dbus_method("GetRemoteUuids")] fn get_remote_uuids(&self, _device: BluetoothDevice) -> Vec<Uuid128Bit> { vec![] dbus_generated!() } #[dbus_method("FetchRemoteUuids")] fn fetch_remote_uuids(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("SdpSearch")] fn sdp_search(&self, _device: BluetoothDevice, _uuid: Uuid128Bit) -> bool { true dbus_generated!() } #[dbus_method("ConnectAllEnabledProfiles")] fn connect_all_enabled_profiles(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } #[dbus_method("DisconnectAllEnabledProfiles")] fn disconnect_all_enabled_profiles(&self, _device: BluetoothDevice) -> bool { true dbus_generated!() } }
system/gd/rust/linux/service/src/iface_bluetooth_gatt.rs +103 −33 Original line number Diff line number Diff line Loading @@ -14,8 +14,8 @@ use dbus::strings::Path; use dbus_macros::{dbus_method, dbus_propmap, dbus_proxy_obj, generate_dbus_exporter}; use dbus_projection::impl_dbus_arg_enum; use dbus_projection::DisconnectWatcher; use dbus_projection::{dbus_generated, impl_dbus_arg_enum}; use num_traits::cast::{FromPrimitive, ToPrimitive}; Loading @@ -30,7 +30,9 @@ struct BluetoothGattCallbackDBus {} #[dbus_proxy_obj(BluetoothGattCallback, "org.chromium.bluetooth.BluetoothGattCallback")] impl IBluetoothGattCallback for BluetoothGattCallbackDBus { #[dbus_method("OnClientRegistered")] fn on_client_registered(&self, _status: i32, _scanner_id: i32) {} fn on_client_registered(&self, _status: i32, _scanner_id: i32) { dbus_generated!() } #[dbus_method("OnClientConnectionState")] fn on_client_connection_state( Loading @@ -40,40 +42,63 @@ impl IBluetoothGattCallback for BluetoothGattCallbackDBus { connected: bool, addr: String, ) { dbus_generated!() } #[dbus_method("OnPhyUpdate")] fn on_phy_update(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) {} fn on_phy_update(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) { dbus_generated!() } #[dbus_method("OnPhyRead")] fn on_phy_read(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) {} fn on_phy_read(&self, addr: String, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) { dbus_generated!() } #[dbus_method("OnSearchComplete")] fn on_search_complete(&self, addr: String, services: Vec<BluetoothGattService>, status: i32) {} fn on_search_complete(&self, addr: String, services: Vec<BluetoothGattService>, status: i32) { dbus_generated!() } #[dbus_method("OnCharacteristicRead")] fn on_characteristic_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) {} fn on_characteristic_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) { dbus_generated!() } #[dbus_method("OnCharacteristicWrite")] fn on_characteristic_write(&self, addr: String, status: i32, handle: i32) {} fn on_characteristic_write(&self, addr: String, status: i32, handle: i32) { dbus_generated!() } #[dbus_method("OnExecuteWrite")] fn on_execute_write(&self, addr: String, status: i32) {} fn on_execute_write(&self, addr: String, status: i32) { dbus_generated!() } #[dbus_method("OnDescriptorRead")] fn on_descriptor_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) {} fn on_descriptor_read(&self, addr: String, status: i32, handle: i32, value: Vec<u8>) { dbus_generated!() } #[dbus_method("OnDescriptorWrite")] fn on_descriptor_write(&self, addr: String, status: i32, handle: i32) {} fn on_descriptor_write(&self, addr: String, status: i32, handle: i32) { dbus_generated!() } #[dbus_method("OnNotify")] fn on_notify(&self, addr: String, handle: i32, value: Vec<u8>) {} fn on_notify(&self, addr: String, handle: i32, value: Vec<u8>) { dbus_generated!() } #[dbus_method("OnReadRemoteRssi")] fn on_read_remote_rssi(&self, addr: String, rssi: i32, status: i32) {} fn on_read_remote_rssi(&self, addr: String, rssi: i32, status: i32) { dbus_generated!() } #[dbus_method("OnConfigureMtu")] fn on_configure_mtu(&self, addr: String, mtu: i32, status: i32) {} fn on_configure_mtu(&self, addr: String, mtu: i32, status: i32) { dbus_generated!() } #[dbus_method("OnConnectionUpdated")] fn on_connection_updated( Loading @@ -84,10 +109,13 @@ impl IBluetoothGattCallback for BluetoothGattCallbackDBus { timeout: i32, status: i32, ) { dbus_generated!() } #[dbus_method("OnServiceChanged")] fn on_service_changed(&self, addr: String) {} fn on_service_changed(&self, addr: String) { dbus_generated!() } } // Represents Uuid128Bit as an array in D-Bus. Loading @@ -114,7 +142,9 @@ struct ScannerCallbackDBus {} #[dbus_proxy_obj(ScannerCallback, "org.chromium.bluetooth.ScannerCallback")] impl IScannerCallback for ScannerCallbackDBus { #[dbus_method("OnScannerRegistered")] fn on_scanner_registered(&self, _status: i32, _scanner_id: i32) {} fn on_scanner_registered(&self, _status: i32, _scanner_id: i32) { dbus_generated!() } } #[dbus_propmap(BluetoothGattDescriptor)] Loading Loading @@ -173,16 +203,24 @@ struct IBluetoothGattDBus {} #[generate_dbus_exporter(export_bluetooth_gatt_dbus_obj, "org.chromium.bluetooth.BluetoothGatt")] impl IBluetoothGatt for IBluetoothGattDBus { #[dbus_method("RegisterScanner")] fn register_scanner(&self, callback: Box<dyn IScannerCallback + Send>) {} fn register_scanner(&self, callback: Box<dyn IScannerCallback + Send>) { dbus_generated!() } #[dbus_method("UnregisterScanner")] fn unregister_scanner(&self, scanner_id: i32) {} fn unregister_scanner(&self, scanner_id: i32) { dbus_generated!() } #[dbus_method("StartScan")] fn start_scan(&self, scanner_id: i32, settings: ScanSettings, filters: Vec<ScanFilter>) {} fn start_scan(&self, scanner_id: i32, settings: ScanSettings, filters: Vec<ScanFilter>) { dbus_generated!() } #[dbus_method("StopScan")] fn stop_scan(&self, scanner_id: i32) {} fn stop_scan(&self, scanner_id: i32) { dbus_generated!() } #[dbus_method("RegisterClient")] fn register_client( Loading @@ -191,10 +229,13 @@ impl IBluetoothGatt for IBluetoothGattDBus { callback: Box<dyn IBluetoothGattCallback + Send>, eatt_support: bool, ) { dbus_generated!() } #[dbus_method("UnregisterClient")] fn unregister_client(&mut self, client_id: i32) {} fn unregister_client(&mut self, client_id: i32) { dbus_generated!() } #[dbus_method("ClientConnect")] fn client_connect( Loading @@ -206,10 +247,13 @@ impl IBluetoothGatt for IBluetoothGattDBus { opportunistic: bool, phy: i32, ) { dbus_generated!() } #[dbus_method("ClientDisconnect")] fn client_disconnect(&self, client_id: i32, addr: String) {} fn client_disconnect(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("ClientSetPreferredPhy")] fn client_set_preferred_phy( Loading @@ -220,22 +264,33 @@ impl IBluetoothGatt for IBluetoothGattDBus { rx_phy: LePhy, phy_options: i32, ) { dbus_generated!() } #[dbus_method("ClientReadPhy")] fn client_read_phy(&mut self, client_id: i32, addr: String) {} fn client_read_phy(&mut self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("RefreshDevice")] fn refresh_device(&self, client_id: i32, addr: String) {} fn refresh_device(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("DiscoverServices")] fn discover_services(&self, client_id: i32, addr: String) {} fn discover_services(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("DiscoverServiceByUuid")] fn discover_service_by_uuid(&self, client_id: i32, addr: String, uuid: String) {} fn discover_service_by_uuid(&self, client_id: i32, addr: String, uuid: String) { dbus_generated!() } #[dbus_method("ReadCharacteristic")] fn read_characteristic(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) {} fn read_characteristic(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) { dbus_generated!() } #[dbus_method("ReadUsingCharacteristicUuid")] fn read_using_characteristic_uuid( Loading @@ -247,6 +302,7 @@ impl IBluetoothGatt for IBluetoothGattDBus { end_handle: i32, auth_req: i32, ) { dbus_generated!() } #[dbus_method("WriteCharacteristic")] Loading @@ -259,11 +315,13 @@ impl IBluetoothGatt for IBluetoothGattDBus { auth_req: i32, value: Vec<u8>, ) -> GattWriteRequestStatus { GattWriteRequestStatus::Success dbus_generated!() } #[dbus_method("ReadDescriptor")] fn read_descriptor(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) {} fn read_descriptor(&self, client_id: i32, addr: String, handle: i32, auth_req: i32) { dbus_generated!() } #[dbus_method("WriteDescriptor")] fn write_descriptor( Loading @@ -274,22 +332,33 @@ impl IBluetoothGatt for IBluetoothGattDBus { auth_req: i32, value: Vec<u8>, ) { dbus_generated!() } #[dbus_method("RegisterForNotification")] fn register_for_notification(&self, client_id: i32, addr: String, handle: i32, enable: bool) {} fn register_for_notification(&self, client_id: i32, addr: String, handle: i32, enable: bool) { dbus_generated!() } #[dbus_method("BeginReliableWrite")] fn begin_reliable_write(&mut self, client_id: i32, addr: String) {} fn begin_reliable_write(&mut self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("EndReliableWrite")] fn end_reliable_write(&mut self, client_id: i32, addr: String, execute: bool) {} fn end_reliable_write(&mut self, client_id: i32, addr: String, execute: bool) { dbus_generated!() } #[dbus_method("ReadRemoteRssi")] fn read_remote_rssi(&self, client_id: i32, addr: String) {} fn read_remote_rssi(&self, client_id: i32, addr: String) { dbus_generated!() } #[dbus_method("ConfigureMtu")] fn configure_mtu(&self, client_id: i32, addr: String, mtu: i32) {} fn configure_mtu(&self, client_id: i32, addr: String, mtu: i32) { dbus_generated!() } #[dbus_method("ConnectionParameterUpdate")] fn connection_parameter_update( Loading @@ -303,5 +372,6 @@ impl IBluetoothGatt for IBluetoothGattDBus { min_ce_len: u16, max_ce_len: u16, ) { dbus_generated!() } }
system/gd/rust/linux/service/src/iface_bluetooth_media.rs +40 −21 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use dbus::strings::Path; use dbus_macros::{dbus_method, dbus_propmap, dbus_proxy_obj, generate_dbus_exporter}; use dbus_projection::dbus_generated; use dbus_projection::DisconnectWatcher; use crate::dbus_arg::{DBusArg, DBusArgError, RefArgToRust}; Loading @@ -25,16 +26,23 @@ impl IBluetoothMediaCallback for BluetoothMediaCallbackDBus { channel_mode: i32, hfp_cap: i32, ) { dbus_generated!() } #[dbus_method("OnBluetoothAudioDeviceRemoved")] fn on_bluetooth_audio_device_removed(&self, addr: String) {} fn on_bluetooth_audio_device_removed(&self, addr: String) { dbus_generated!() } #[dbus_method("OnAbsoluteVolumeSupportedChanged")] fn on_absolute_volume_supported_changed(&self, supported: bool) {} fn on_absolute_volume_supported_changed(&self, supported: bool) { dbus_generated!() } #[dbus_method("OnAbsoluteVolumeChanged")] fn on_absolute_volume_changed(&self, volume: i32) {} fn on_absolute_volume_changed(&self, volume: i32) { dbus_generated!() } } #[allow(dead_code)] Loading @@ -52,27 +60,33 @@ pub struct PresentationPositionDBus { impl IBluetoothMedia for IBluetoothMediaDBus { #[dbus_method("RegisterCallback")] fn register_callback(&mut self, callback: Box<dyn IBluetoothMediaCallback + Send>) -> bool { true dbus_generated!() } #[dbus_method("Initialize")] fn initialize(&mut self) -> bool { true dbus_generated!() } #[dbus_method("Cleanup")] fn cleanup(&mut self) -> bool { true dbus_generated!() } #[dbus_method("Connect")] fn connect(&mut self, device: String) {} fn connect(&mut self, device: String) { dbus_generated!() } #[dbus_method("SetActiveDevice")] fn set_active_device(&mut self, device: String) {} fn set_active_device(&mut self, device: String) { dbus_generated!() } #[dbus_method("Disconnect")] fn disconnect(&mut self, device: String) {} fn disconnect(&mut self, device: String) { dbus_generated!() } #[dbus_method("SetAudioConfig")] fn set_audio_config( Loading @@ -81,31 +95,36 @@ impl IBluetoothMedia for IBluetoothMediaDBus { bits_per_sample: i32, channel_mode: i32, ) -> bool { true dbus_generated!() } #[dbus_method("SetVolume")] fn set_volume(&mut self, volume: i32) {} fn set_volume(&mut self, volume: i32) { dbus_generated!() } #[dbus_method("StartAudioRequest")] fn start_audio_request(&mut self) {} fn start_audio_request(&mut self) { dbus_generated!() } #[dbus_method("StopAudioRequest")] fn stop_audio_request(&mut self) {} fn stop_audio_request(&mut self) { dbus_generated!() } #[dbus_method("StartScoCall")] fn start_sco_call(&mut self, device: String) {} fn start_sco_call(&mut self, device: String) { dbus_generated!() } #[dbus_method("StopScoCall")] fn stop_sco_call(&mut self, device: String) {} fn stop_sco_call(&mut self, device: String) { dbus_generated!() } #[dbus_method("GetPresentationPosition")] fn get_presentation_position(&mut self) -> PresentationPosition { PresentationPosition { remote_delay_report_ns: 0, total_bytes_read: 0, data_position_sec: 0, data_position_nsec: 0, } dbus_generated!() } }