• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! D-Bus proxy implementations of the APIs.
2 
3 use bt_topshim::btif::{
4     BtAddrType, BtBondState, BtConnectionState, BtDeviceType, BtDiscMode, BtPropertyType,
5     BtSspVariant, BtStatus, BtTransport, BtVendorProductInfo, DisplayAddress, RawAddress, Uuid,
6 };
7 use bt_topshim::profiles::a2dp::{
8     A2dpCodecBitsPerSample, A2dpCodecChannelMode, A2dpCodecConfig, A2dpCodecIndex,
9     A2dpCodecSampleRate, PresentationPosition,
10 };
11 use bt_topshim::profiles::avrcp::PlayerMetadata;
12 use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LeDiscMode, LePhy};
13 use bt_topshim::profiles::hfp::{EscoCodingFormat, HfpCodecBitId, HfpCodecFormat};
14 use bt_topshim::profiles::hid_host::BthhReportType;
15 use bt_topshim::profiles::le_audio::{
16     BtLeAudioContentType, BtLeAudioDirection, BtLeAudioGroupNodeStatus, BtLeAudioGroupStatus,
17     BtLeAudioGroupStreamStatus, BtLeAudioSource, BtLeAudioUnicastMonitorModeStatus, BtLeAudioUsage,
18     BtLePcmConfig, BtLeStreamStartedStatus,
19 };
20 use bt_topshim::profiles::sdp::{
21     BtSdpDipRecord, BtSdpHeaderOverlay, BtSdpMasRecord, BtSdpMnsRecord, BtSdpMpsRecord,
22     BtSdpOpsRecord, BtSdpPceRecord, BtSdpPseRecord, BtSdpRecord, BtSdpSapRecord, BtSdpType,
23     SupportedDependencies, SupportedFormatsList, SupportedScenarios,
24 };
25 use bt_topshim::profiles::socket::SocketType;
26 use bt_topshim::profiles::ProfileConnectionState;
27 
28 use btstack::battery_manager::{Battery, BatterySet, IBatteryManager, IBatteryManagerCallback};
29 use btstack::bluetooth::{
30     BluetoothDevice, BtAdapterRole, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback,
31     IBluetoothQALegacy,
32 };
33 use btstack::bluetooth_admin::{IBluetoothAdmin, IBluetoothAdminPolicyCallback, PolicyEffect};
34 use btstack::bluetooth_adv::{
35     AdvertiseData, AdvertisingSetParameters, IAdvertisingSetCallback, ManfId,
36     PeriodicAdvertisingParameters,
37 };
38 use btstack::bluetooth_gatt::{
39     BluetoothGattCharacteristic, BluetoothGattDescriptor, BluetoothGattService,
40     GattWriteRequestStatus, GattWriteType, IBluetoothGatt, IBluetoothGattCallback,
41     IBluetoothGattServerCallback, IScannerCallback, ScanFilter, ScanFilterCondition,
42     ScanFilterPattern, ScanResult, ScanSettings, ScanType,
43 };
44 use btstack::bluetooth_media::{
45     BluetoothAudioDevice, IBluetoothMedia, IBluetoothMediaCallback, IBluetoothTelephony,
46     IBluetoothTelephonyCallback,
47 };
48 use btstack::bluetooth_qa::IBluetoothQA;
49 use btstack::socket_manager::{
50     BluetoothServerSocket, BluetoothSocket, CallbackId, IBluetoothSocketManager,
51     IBluetoothSocketManagerCallbacks, SocketId, SocketResult,
52 };
53 use btstack::{RPCProxy, SuspendMode};
54 
55 use btstack::suspend::{ISuspend, ISuspendCallback, SuspendType};
56 
57 use dbus::arg::RefArg;
58 use dbus::nonblock::SyncConnection;
59 
60 use dbus_projection::prelude::*;
61 
62 use dbus_macros::{
63     dbus_method, dbus_propmap, generate_dbus_exporter, generate_dbus_interface_client,
64 };
65 
66 use manager_service::iface_bluetooth_manager::{
67     AdapterWithEnabled, IBluetoothManager, IBluetoothManagerCallback,
68 };
69 
70 use num_traits::{FromPrimitive, ToPrimitive};
71 
72 use std::collections::HashMap;
73 use std::convert::{TryFrom, TryInto};
74 use std::sync::Arc;
75 
76 use btstack::bluetooth_qa::IBluetoothQACallback;
77 
78 use crate::dbus_arg::{DBusArg, DBusArgError, DirectDBus, RefArgToRust};
79 
make_object_path(idx: i32, name: &str) -> dbus::Path80 fn make_object_path(idx: i32, name: &str) -> dbus::Path {
81     dbus::Path::new(format!("/org/chromium/bluetooth/hci{}/{}", idx, name)).unwrap()
82 }
83 
84 impl_dbus_arg_enum!(AdvertisingStatus);
85 impl_dbus_arg_enum!(BtBondState);
86 impl_dbus_arg_enum!(BtConnectionState);
87 impl_dbus_arg_enum!(BtDeviceType);
88 impl_dbus_arg_enum!(BtAddrType);
89 impl_dbus_arg_enum!(BtPropertyType);
90 impl_dbus_arg_enum!(BtSspVariant);
91 impl_dbus_arg_enum!(BtStatus);
92 impl_dbus_arg_enum!(BtTransport);
93 impl_dbus_arg_from_into!(BtLeAudioUsage, i32);
94 impl_dbus_arg_from_into!(BtLeAudioContentType, i32);
95 impl_dbus_arg_from_into!(BtLeAudioSource, i32);
96 impl_dbus_arg_from_into!(BtLeAudioGroupStatus, i32);
97 impl_dbus_arg_from_into!(BtLeAudioGroupNodeStatus, i32);
98 impl_dbus_arg_from_into!(BtLeAudioUnicastMonitorModeStatus, i32);
99 impl_dbus_arg_from_into!(BtLeAudioDirection, i32);
100 impl_dbus_arg_from_into!(BtLeAudioGroupStreamStatus, i32);
101 impl_dbus_arg_from_into!(BtLeStreamStartedStatus, i32);
102 impl_dbus_arg_enum!(GattStatus);
103 impl_dbus_arg_enum!(GattWriteRequestStatus);
104 impl_dbus_arg_enum!(GattWriteType);
105 impl_dbus_arg_enum!(LeDiscMode);
106 impl_dbus_arg_enum!(LePhy);
107 impl_dbus_arg_enum!(ProfileConnectionState);
108 impl_dbus_arg_enum!(ScanType);
109 impl_dbus_arg_enum!(SocketType);
110 impl_dbus_arg_enum!(SuspendMode);
111 impl_dbus_arg_enum!(SuspendType);
112 impl_dbus_arg_from_into!(Uuid, Vec<u8>);
113 impl_dbus_arg_enum!(BthhReportType);
114 impl_dbus_arg_enum!(BtAdapterRole);
115 
116 impl_dbus_arg_enum!(BtSdpType);
117 
118 #[dbus_propmap(BtSdpHeaderOverlay)]
119 struct BtSdpHeaderOverlayDBus {
120     sdp_type: BtSdpType,
121     uuid: Uuid,
122     service_name_length: u32,
123     service_name: String,
124     rfcomm_channel_number: i32,
125     l2cap_psm: i32,
126     profile_version: i32,
127 
128     user1_len: i32,
129     user1_data: Vec<u8>,
130     user2_len: i32,
131     user2_data: Vec<u8>,
132 }
133 
134 #[dbus_propmap(BtSdpMasRecord)]
135 struct BtSdpMasRecordDBus {
136     hdr: BtSdpHeaderOverlay,
137     mas_instance_id: u32,
138     supported_features: u32,
139     supported_message_types: u32,
140 }
141 
142 #[dbus_propmap(BtSdpMnsRecord)]
143 struct BtSdpMnsRecordDBus {
144     hdr: BtSdpHeaderOverlay,
145     supported_features: u32,
146 }
147 
148 #[dbus_propmap(BtSdpPseRecord)]
149 struct BtSdpPseRecordDBus {
150     hdr: BtSdpHeaderOverlay,
151     supported_features: u32,
152     supported_repositories: u32,
153 }
154 
155 #[dbus_propmap(BtSdpPceRecord)]
156 struct BtSdpPceRecordDBus {
157     hdr: BtSdpHeaderOverlay,
158 }
159 
160 impl_dbus_arg_from_into!(SupportedFormatsList, Vec<u8>);
161 
162 #[dbus_propmap(BtSdpOpsRecord)]
163 struct BtSdpOpsRecordDBus {
164     hdr: BtSdpHeaderOverlay,
165     supported_formats_list_len: i32,
166     supported_formats_list: SupportedFormatsList,
167 }
168 
169 #[dbus_propmap(BtSdpSapRecord)]
170 struct BtSdpSapRecordDBus {
171     hdr: BtSdpHeaderOverlay,
172 }
173 
174 #[dbus_propmap(BtSdpDipRecord)]
175 struct BtSdpDipRecordDBus {
176     hdr: BtSdpHeaderOverlay,
177     spec_id: u16,
178     vendor: u16,
179     vendor_id_source: u16,
180     product: u16,
181     version: u16,
182     primary_record: bool,
183 }
184 
185 impl_dbus_arg_from_into!(SupportedScenarios, Vec<u8>);
186 impl_dbus_arg_from_into!(SupportedDependencies, Vec<u8>);
187 
188 #[dbus_propmap(BtSdpMpsRecord)]
189 pub struct BtSdpMpsRecordDBus {
190     hdr: BtSdpHeaderOverlay,
191     supported_scenarios_mpsd: SupportedScenarios,
192     supported_scenarios_mpmd: SupportedScenarios,
193     supported_dependencies: SupportedDependencies,
194 }
195 
196 #[dbus_propmap(BtVendorProductInfo)]
197 pub struct BtVendorProductInfoDBus {
198     vendor_id_src: u8,
199     vendor_id: u16,
200     product_id: u16,
201     version: u16,
202 }
203 
read_propmap_value<T: 'static + DirectDBus>( propmap: &dbus::arg::PropMap, key: &str, ) -> Result<T, Box<dyn std::error::Error>>204 fn read_propmap_value<T: 'static + DirectDBus>(
205     propmap: &dbus::arg::PropMap,
206     key: &str,
207 ) -> Result<T, Box<dyn std::error::Error>> {
208     let output = propmap
209         .get(key)
210         .ok_or(Box::new(DBusArgError::new(format!("Key {} does not exist", key,))))?;
211     let output = <T as RefArgToRust>::ref_arg_to_rust(
212         output.as_static_inner(0).ok_or(Box::new(DBusArgError::new(format!(
213             "Unable to convert propmap[\"{}\"] to {}",
214             key,
215             stringify!(T),
216         ))))?,
217         String::from(stringify!(T)),
218     )?;
219     Ok(output)
220 }
221 
parse_propmap_value<T: DBusArg>( propmap: &dbus::arg::PropMap, key: &str, ) -> Result<T, Box<dyn std::error::Error>> where <T as DBusArg>::DBusType: RefArgToRust<RustType = <T as DBusArg>::DBusType>,222 fn parse_propmap_value<T: DBusArg>(
223     propmap: &dbus::arg::PropMap,
224     key: &str,
225 ) -> Result<T, Box<dyn std::error::Error>>
226 where
227     <T as DBusArg>::DBusType: RefArgToRust<RustType = <T as DBusArg>::DBusType>,
228 {
229     let output = propmap
230         .get(key)
231         .ok_or(Box::new(DBusArgError::new(format!("Key {} does not exist", key,))))?;
232     let output = <<T as DBusArg>::DBusType as RefArgToRust>::ref_arg_to_rust(
233         output.as_static_inner(0).ok_or(Box::new(DBusArgError::new(format!(
234             "Unable to convert propmap[\"{}\"] to {}",
235             key,
236             stringify!(T),
237         ))))?,
238         format!("{}", stringify!(T)),
239     )?;
240     let output = T::from_dbus(output, None, None, None)?;
241     Ok(output)
242 }
243 
write_propmap_value<T: DBusArg>( propmap: &mut dbus::arg::PropMap, value: T, key: &str, ) -> Result<(), Box<dyn std::error::Error>> where T::DBusType: 'static + dbus::arg::RefArg,244 fn write_propmap_value<T: DBusArg>(
245     propmap: &mut dbus::arg::PropMap,
246     value: T,
247     key: &str,
248 ) -> Result<(), Box<dyn std::error::Error>>
249 where
250     T::DBusType: 'static + dbus::arg::RefArg,
251 {
252     propmap.insert(String::from(key), dbus::arg::Variant(Box::new(DBusArg::to_dbus(value)?)));
253     Ok(())
254 }
255 
256 impl DBusArg for BtSdpRecord {
257     type DBusType = dbus::arg::PropMap;
from_dbus( data: dbus::arg::PropMap, _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>, _remote: Option<dbus::strings::BusName<'static>>, _disconnect_watcher: Option< std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>, >, ) -> Result<BtSdpRecord, Box<dyn std::error::Error>>258     fn from_dbus(
259         data: dbus::arg::PropMap,
260         _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>,
261         _remote: Option<dbus::strings::BusName<'static>>,
262         _disconnect_watcher: Option<
263             std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>,
264         >,
265     ) -> Result<BtSdpRecord, Box<dyn std::error::Error>> {
266         let sdp_type = read_propmap_value::<u32>(&data, &String::from("type"))?;
267         let sdp_type = BtSdpType::from(sdp_type);
268         let record = match sdp_type {
269             BtSdpType::Raw => {
270                 let arg_0 = parse_propmap_value::<BtSdpHeaderOverlay>(&data, "0")?;
271                 BtSdpRecord::HeaderOverlay(arg_0)
272             }
273             BtSdpType::MapMas => {
274                 let arg_0 = parse_propmap_value::<BtSdpMasRecord>(&data, "0")?;
275                 BtSdpRecord::MapMas(arg_0)
276             }
277             BtSdpType::MapMns => {
278                 let arg_0 = parse_propmap_value::<BtSdpMnsRecord>(&data, "0")?;
279                 BtSdpRecord::MapMns(arg_0)
280             }
281             BtSdpType::PbapPse => {
282                 let arg_0 = parse_propmap_value::<BtSdpPseRecord>(&data, "0")?;
283                 BtSdpRecord::PbapPse(arg_0)
284             }
285             BtSdpType::PbapPce => {
286                 let arg_0 = parse_propmap_value::<BtSdpPceRecord>(&data, "0")?;
287                 BtSdpRecord::PbapPce(arg_0)
288             }
289             BtSdpType::OppServer => {
290                 let arg_0 = parse_propmap_value::<BtSdpOpsRecord>(&data, "0")?;
291                 BtSdpRecord::OppServer(arg_0)
292             }
293             BtSdpType::SapServer => {
294                 let arg_0 = parse_propmap_value::<BtSdpSapRecord>(&data, "0")?;
295                 BtSdpRecord::SapServer(arg_0)
296             }
297             BtSdpType::Dip => {
298                 let arg_0 = parse_propmap_value::<BtSdpDipRecord>(&data, "0")?;
299                 BtSdpRecord::Dip(arg_0)
300             }
301             BtSdpType::Mps => {
302                 let arg_0 = parse_propmap_value::<BtSdpMpsRecord>(&data, "0")?;
303                 BtSdpRecord::Mps(arg_0)
304             }
305         };
306         Ok(record)
307     }
308 
to_dbus(record: BtSdpRecord) -> Result<dbus::arg::PropMap, Box<dyn std::error::Error>>309     fn to_dbus(record: BtSdpRecord) -> Result<dbus::arg::PropMap, Box<dyn std::error::Error>> {
310         let mut map: dbus::arg::PropMap = std::collections::HashMap::new();
311         write_propmap_value::<u32>(
312             &mut map,
313             BtSdpType::from(&record) as u32,
314             &String::from("type"),
315         )?;
316         match record {
317             BtSdpRecord::HeaderOverlay(header) => {
318                 write_propmap_value::<BtSdpHeaderOverlay>(&mut map, header, &String::from("0"))?
319             }
320             BtSdpRecord::MapMas(mas_record) => {
321                 write_propmap_value::<BtSdpMasRecord>(&mut map, mas_record, &String::from("0"))?
322             }
323             BtSdpRecord::MapMns(mns_record) => {
324                 write_propmap_value::<BtSdpMnsRecord>(&mut map, mns_record, &String::from("0"))?
325             }
326             BtSdpRecord::PbapPse(pse_record) => {
327                 write_propmap_value::<BtSdpPseRecord>(&mut map, pse_record, &String::from("0"))?
328             }
329             BtSdpRecord::PbapPce(pce_record) => {
330                 write_propmap_value::<BtSdpPceRecord>(&mut map, pce_record, &String::from("0"))?
331             }
332             BtSdpRecord::OppServer(ops_record) => {
333                 write_propmap_value::<BtSdpOpsRecord>(&mut map, ops_record, &String::from("0"))?
334             }
335             BtSdpRecord::SapServer(sap_record) => {
336                 write_propmap_value::<BtSdpSapRecord>(&mut map, sap_record, &String::from("0"))?
337             }
338             BtSdpRecord::Dip(dip_record) => {
339                 write_propmap_value::<BtSdpDipRecord>(&mut map, dip_record, &String::from("0"))?
340             }
341             BtSdpRecord::Mps(mps_record) => {
342                 write_propmap_value::<BtSdpMpsRecord>(&mut map, mps_record, &String::from("0"))?
343             }
344         }
345         Ok(map)
346     }
347 
348     // We don't log in btclient.
log(_data: &BtSdpRecord) -> String349     fn log(_data: &BtSdpRecord) -> String {
350         String::new()
351     }
352 }
353 
354 impl DBusArg for RawAddress {
355     type DBusType = String;
from_dbus( data: String, _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>, _remote: Option<dbus::strings::BusName<'static>>, _disconnect_watcher: Option< std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>, >, ) -> Result<RawAddress, Box<dyn std::error::Error>>356     fn from_dbus(
357         data: String,
358         _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>,
359         _remote: Option<dbus::strings::BusName<'static>>,
360         _disconnect_watcher: Option<
361             std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>,
362         >,
363     ) -> Result<RawAddress, Box<dyn std::error::Error>> {
364         Ok(RawAddress::from_string(data.clone()).ok_or_else(|| {
365             format!(
366                 "Invalid Address: last 6 chars=\"{}\"",
367                 data.chars().rev().take(6).collect::<String>().chars().rev().collect::<String>()
368             )
369         })?)
370     }
371 
to_dbus(addr: RawAddress) -> Result<String, Box<dyn std::error::Error>>372     fn to_dbus(addr: RawAddress) -> Result<String, Box<dyn std::error::Error>> {
373         Ok(addr.to_string())
374     }
375 
log(addr: &RawAddress) -> String376     fn log(addr: &RawAddress) -> String {
377         format!("{}", DisplayAddress(addr))
378     }
379 }
380 
381 #[dbus_propmap(BluetoothGattDescriptor)]
382 pub struct BluetoothGattDescriptorDBus {
383     uuid: Uuid,
384     instance_id: i32,
385     permissions: i32,
386 }
387 
388 #[dbus_propmap(BluetoothGattCharacteristic)]
389 pub struct BluetoothGattCharacteristicDBus {
390     uuid: Uuid,
391     instance_id: i32,
392     properties: i32,
393     permissions: i32,
394     key_size: i32,
395     write_type: GattWriteType,
396     descriptors: Vec<BluetoothGattDescriptor>,
397 }
398 
399 #[dbus_propmap(BluetoothGattService)]
400 pub struct BluetoothGattServiceDBus {
401     pub uuid: Uuid,
402     pub instance_id: i32,
403     pub service_type: i32,
404     pub characteristics: Vec<BluetoothGattCharacteristic>,
405     pub included_services: Vec<BluetoothGattService>,
406 }
407 
408 #[dbus_propmap(BluetoothDevice)]
409 pub struct BluetoothDeviceDBus {
410     address: RawAddress,
411     name: String,
412 }
413 
414 #[dbus_propmap(ScanSettings)]
415 struct ScanSettingsDBus {
416     interval: i32,
417     window: i32,
418     scan_type: ScanType,
419 }
420 
421 #[dbus_propmap(ScanFilterPattern)]
422 struct ScanFilterPatternDBus {
423     start_position: u8,
424     ad_type: u8,
425     content: Vec<u8>,
426 }
427 
428 #[dbus_propmap(A2dpCodecConfig)]
429 pub struct A2dpCodecConfigDBus {
430     codec_type: i32,
431     codec_priority: i32,
432     sample_rate: i32,
433     bits_per_sample: i32,
434     channel_mode: i32,
435     codec_specific_1: i64,
436     codec_specific_2: i64,
437     codec_specific_3: i64,
438     codec_specific_4: i64,
439 }
440 
441 impl_dbus_arg_enum!(A2dpCodecIndex);
442 impl_dbus_arg_from_into!(A2dpCodecSampleRate, i32);
443 impl_dbus_arg_from_into!(A2dpCodecBitsPerSample, i32);
444 impl_dbus_arg_from_into!(A2dpCodecChannelMode, i32);
445 
446 impl_dbus_arg_from_into!(EscoCodingFormat, u8);
447 impl_dbus_arg_from_into!(HfpCodecBitId, i32);
448 impl_dbus_arg_from_into!(HfpCodecFormat, i32);
449 
450 #[dbus_propmap(BluetoothAudioDevice)]
451 pub struct BluetoothAudioDeviceDBus {
452     address: RawAddress,
453     name: String,
454     a2dp_caps: Vec<A2dpCodecConfig>,
455     hfp_cap: HfpCodecFormat,
456     absolute_volume: bool,
457 }
458 
459 // Manually converts enum variant from/into D-Bus.
460 //
461 // The ScanFilterCondition enum variant is represented as a D-Bus dictionary with one and only one
462 // member which key determines which variant it refers to and the value determines the data.
463 //
464 // For example, ScanFilterCondition::Patterns(data: Vec<u8>) is represented as:
465 //     array [
466 //        dict entry(
467 //           string "patterns"
468 //           variant array [ ... ]
469 //        )
470 //     ]
471 //
472 // And ScanFilterCondition::All is represented as:
473 //     array [
474 //        dict entry(
475 //           string "all"
476 //           variant string "unit"
477 //        )
478 //     ]
479 //
480 // If enum variant is used many times, we should find a way to avoid boilerplate.
481 impl DBusArg for ScanFilterCondition {
482     type DBusType = dbus::arg::PropMap;
from_dbus( data: dbus::arg::PropMap, _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>, _remote: Option<dbus::strings::BusName<'static>>, _disconnect_watcher: Option< std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>, >, ) -> Result<ScanFilterCondition, Box<dyn std::error::Error>>483     fn from_dbus(
484         data: dbus::arg::PropMap,
485         _conn: Option<std::sync::Arc<dbus::nonblock::SyncConnection>>,
486         _remote: Option<dbus::strings::BusName<'static>>,
487         _disconnect_watcher: Option<
488             std::sync::Arc<std::sync::Mutex<dbus_projection::DisconnectWatcher>>,
489         >,
490     ) -> Result<ScanFilterCondition, Box<dyn std::error::Error>> {
491         let variant = match data.get("patterns") {
492             Some(variant) => variant,
493             None => {
494                 return Err(Box::new(DBusArgError::new(String::from(
495                     "ScanFilterCondition does not contain any enum variant",
496                 ))));
497             }
498         };
499 
500         match variant.arg_type() {
501             dbus::arg::ArgType::Variant => {}
502             _ => {
503                 return Err(Box::new(DBusArgError::new(String::from(
504                     "ScanFilterCondition::Patterns must be a variant",
505                 ))));
506             }
507         };
508 
509         let patterns =
510             <<Vec<ScanFilterPattern> as DBusArg>::DBusType as RefArgToRust>::ref_arg_to_rust(
511                 variant.as_static_inner(0).unwrap(),
512                 format!("ScanFilterCondition::Patterns"),
513             )?;
514 
515         let patterns = Vec::<ScanFilterPattern>::from_dbus(patterns, None, None, None)?;
516         return Ok(ScanFilterCondition::Patterns(patterns));
517     }
518 
to_dbus( condition: ScanFilterCondition, ) -> Result<dbus::arg::PropMap, Box<dyn std::error::Error>>519     fn to_dbus(
520         condition: ScanFilterCondition,
521     ) -> Result<dbus::arg::PropMap, Box<dyn std::error::Error>> {
522         let mut map: dbus::arg::PropMap = std::collections::HashMap::new();
523         match condition {
524             ScanFilterCondition::Patterns(patterns) => {
525                 map.insert(
526                     String::from("patterns"),
527                     dbus::arg::Variant(Box::new(DBusArg::to_dbus(patterns)?)),
528                 );
529             }
530             _ => {}
531         }
532         return Ok(map);
533     }
534 
535     // We don't log in btclient.
log(_data: &ScanFilterCondition) -> String536     fn log(_data: &ScanFilterCondition) -> String {
537         String::new()
538     }
539 }
540 
541 #[dbus_propmap(ScanFilter)]
542 struct ScanFilterDBus {
543     rssi_high_threshold: u8,
544     rssi_low_threshold: u8,
545     rssi_low_timeout: u8,
546     rssi_sampling_period: u8,
547     condition: ScanFilterCondition,
548 }
549 
550 #[dbus_propmap(ScanResult)]
551 struct ScanResultDBus {
552     name: String,
553     address: RawAddress,
554     addr_type: u8,
555     event_type: u16,
556     primary_phy: u8,
557     secondary_phy: u8,
558     advertising_sid: u8,
559     tx_power: i8,
560     rssi: i8,
561     periodic_adv_int: u16,
562     flags: u8,
563     service_uuids: Vec<Uuid>,
564     service_data: HashMap<String, Vec<u8>>,
565     manufacturer_data: HashMap<u16, Vec<u8>>,
566     adv_data: Vec<u8>,
567 }
568 
569 #[dbus_propmap(PresentationPosition)]
570 struct PresentationPositionDBus {
571     remote_delay_report_ns: u64,
572     total_bytes_read: u64,
573     data_position_sec: i64,
574     data_position_nsec: i32,
575 }
576 
577 #[dbus_propmap(PlayerMetadata)]
578 struct PlayerMetadataDBus {
579     title: String,
580     artist: String,
581     album: String,
582     length_us: i64,
583 }
584 
585 #[dbus_propmap(BtLePcmConfig)]
586 pub struct BtLePcmConfigDBus {
587     data_interval_us: u32,
588     sample_rate: u32,
589     bits_per_sample: u8,
590     channels_count: u8,
591 }
592 
593 struct IBluetoothCallbackDBus {}
594 
595 impl RPCProxy for IBluetoothCallbackDBus {}
596 
597 #[generate_dbus_exporter(
598     export_bluetooth_callback_dbus_intf,
599     "org.chromium.bluetooth.BluetoothCallback"
600 )]
601 impl IBluetoothCallback for IBluetoothCallbackDBus {
602     #[dbus_method("OnAdapterPropertyChanged", DBusLog::Disable)]
on_adapter_property_changed(&mut self, prop: BtPropertyType)603     fn on_adapter_property_changed(&mut self, prop: BtPropertyType) {}
604 
605     #[dbus_method("OnDevicePropertiesChanged", DBusLog::Disable)]
on_device_properties_changed( &mut self, remote_device: BluetoothDevice, props: Vec<BtPropertyType>, )606     fn on_device_properties_changed(
607         &mut self,
608         remote_device: BluetoothDevice,
609         props: Vec<BtPropertyType>,
610     ) {
611     }
612 
613     #[dbus_method("OnAddressChanged", DBusLog::Disable)]
on_address_changed(&mut self, addr: RawAddress)614     fn on_address_changed(&mut self, addr: RawAddress) {}
615 
616     #[dbus_method("OnNameChanged", DBusLog::Disable)]
on_name_changed(&mut self, name: String)617     fn on_name_changed(&mut self, name: String) {}
618 
619     #[dbus_method("OnDiscoverableChanged", DBusLog::Disable)]
on_discoverable_changed(&mut self, discoverable: bool)620     fn on_discoverable_changed(&mut self, discoverable: bool) {}
621 
622     #[dbus_method("OnDeviceFound", DBusLog::Disable)]
on_device_found(&mut self, remote_device: BluetoothDevice)623     fn on_device_found(&mut self, remote_device: BluetoothDevice) {}
624 
625     #[dbus_method("OnDeviceCleared", DBusLog::Disable)]
on_device_cleared(&mut self, remote_device: BluetoothDevice)626     fn on_device_cleared(&mut self, remote_device: BluetoothDevice) {}
627 
628     #[dbus_method("OnDiscoveringChanged", DBusLog::Disable)]
on_discovering_changed(&mut self, discovering: bool)629     fn on_discovering_changed(&mut self, discovering: bool) {}
630 
631     #[dbus_method("OnSspRequest", DBusLog::Disable)]
on_ssp_request( &mut self, remote_device: BluetoothDevice, cod: u32, variant: BtSspVariant, passkey: u32, )632     fn on_ssp_request(
633         &mut self,
634         remote_device: BluetoothDevice,
635         cod: u32,
636         variant: BtSspVariant,
637         passkey: u32,
638     ) {
639     }
640 
641     #[dbus_method("OnPinRequest", DBusLog::Disable)]
on_pin_request(&mut self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool)642     fn on_pin_request(&mut self, remote_device: BluetoothDevice, cod: u32, min_16_digit: bool) {}
643 
644     #[dbus_method("OnPinDisplay", DBusLog::Disable)]
on_pin_display(&mut self, remote_device: BluetoothDevice, pincode: String)645     fn on_pin_display(&mut self, remote_device: BluetoothDevice, pincode: String) {}
646 
647     #[dbus_method("OnBondStateChanged", DBusLog::Disable)]
on_bond_state_changed(&mut self, status: u32, address: RawAddress, state: u32)648     fn on_bond_state_changed(&mut self, status: u32, address: RawAddress, state: u32) {}
649 
650     #[dbus_method("OnSdpSearchComplete", DBusLog::Disable)]
on_sdp_search_complete( &mut self, remote_device: BluetoothDevice, searched_uuid: Uuid, sdp_records: Vec<BtSdpRecord>, )651     fn on_sdp_search_complete(
652         &mut self,
653         remote_device: BluetoothDevice,
654         searched_uuid: Uuid,
655         sdp_records: Vec<BtSdpRecord>,
656     ) {
657     }
658 
659     #[dbus_method("OnSdpRecordCreated", DBusLog::Disable)]
on_sdp_record_created(&mut self, record: BtSdpRecord, handle: i32)660     fn on_sdp_record_created(&mut self, record: BtSdpRecord, handle: i32) {}
661 }
662 
663 struct IBluetoothConnectionCallbackDBus {}
664 
665 impl RPCProxy for IBluetoothConnectionCallbackDBus {}
666 
667 #[generate_dbus_exporter(
668     export_bluetooth_connection_callback_dbus_intf,
669     "org.chromium.bluetooth.BluetoothConnectionCallback"
670 )]
671 impl IBluetoothConnectionCallback for IBluetoothConnectionCallbackDBus {
672     #[dbus_method("OnDeviceConnected", DBusLog::Disable)]
on_device_connected(&mut self, remote_device: BluetoothDevice)673     fn on_device_connected(&mut self, remote_device: BluetoothDevice) {}
674 
675     #[dbus_method("OnDeviceDisconnected", DBusLog::Disable)]
on_device_disconnected(&mut self, remote_device: BluetoothDevice)676     fn on_device_disconnected(&mut self, remote_device: BluetoothDevice) {}
677 }
678 
679 struct IScannerCallbackDBus {}
680 
681 impl RPCProxy for IScannerCallbackDBus {}
682 
683 #[generate_dbus_exporter(
684     export_scanner_callback_dbus_intf,
685     "org.chromium.bluetooth.ScannerCallback"
686 )]
687 impl IScannerCallback for IScannerCallbackDBus {
688     #[dbus_method("OnScannerRegistered", DBusLog::Disable)]
on_scanner_registered(&mut self, uuid: Uuid, scanner_id: u8, status: GattStatus)689     fn on_scanner_registered(&mut self, uuid: Uuid, scanner_id: u8, status: GattStatus) {
690         dbus_generated!()
691     }
692 
693     #[dbus_method("OnScanResult", DBusLog::Disable)]
on_scan_result(&mut self, scan_result: ScanResult)694     fn on_scan_result(&mut self, scan_result: ScanResult) {
695         dbus_generated!()
696     }
697 
698     #[dbus_method("OnAdvertisementFound", DBusLog::Disable)]
on_advertisement_found(&mut self, scanner_id: u8, scan_result: ScanResult)699     fn on_advertisement_found(&mut self, scanner_id: u8, scan_result: ScanResult) {
700         dbus_generated!()
701     }
702 
703     #[dbus_method("OnAdvertisementLost", DBusLog::Disable)]
on_advertisement_lost(&mut self, scanner_id: u8, scan_result: ScanResult)704     fn on_advertisement_lost(&mut self, scanner_id: u8, scan_result: ScanResult) {
705         dbus_generated!()
706     }
707 
708     #[dbus_method("OnSuspendModeChange", DBusLog::Disable)]
on_suspend_mode_change(&mut self, suspend_mode: SuspendMode)709     fn on_suspend_mode_change(&mut self, suspend_mode: SuspendMode) {
710         dbus_generated!()
711     }
712 }
713 
714 impl_dbus_arg_enum!(BtDiscMode);
715 
716 // Implements RPC-friendly wrapper methods for calling IBluetooth, generated by
717 // `generate_dbus_interface_client` below.
718 pub(crate) struct BluetoothDBusRPC {
719     client_proxy: ClientDBusProxy,
720 }
721 
722 pub(crate) struct BluetoothDBus {
723     client_proxy: ClientDBusProxy,
724     pub rpc: BluetoothDBusRPC,
725 }
726 
727 impl BluetoothDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy728     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
729         ClientDBusProxy::new(
730             conn.clone(),
731             String::from("org.chromium.bluetooth"),
732             make_object_path(index, "adapter"),
733             String::from("org.chromium.bluetooth.Bluetooth"),
734         )
735     }
736 
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothDBus737     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothDBus {
738         BluetoothDBus {
739             client_proxy: Self::make_client_proxy(conn.clone(), index),
740             rpc: BluetoothDBusRPC { client_proxy: Self::make_client_proxy(conn.clone(), index) },
741         }
742     }
743 }
744 
745 #[generate_dbus_interface_client(BluetoothDBusRPC)]
746 impl IBluetooth for BluetoothDBus {
747     #[dbus_method("RegisterCallback")]
register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) -> u32748     fn register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) -> u32 {
749         dbus_generated!()
750     }
751 
752     #[dbus_method("UnregisterCallback")]
unregister_callback(&mut self, id: u32) -> bool753     fn unregister_callback(&mut self, id: u32) -> bool {
754         dbus_generated!()
755     }
756 
757     #[dbus_method("RegisterConnectionCallback")]
register_connection_callback( &mut self, callback: Box<dyn IBluetoothConnectionCallback + Send>, ) -> u32758     fn register_connection_callback(
759         &mut self,
760         callback: Box<dyn IBluetoothConnectionCallback + Send>,
761     ) -> u32 {
762         dbus_generated!()
763     }
764 
765     #[dbus_method("UnregisterConnectionCallback")]
unregister_connection_callback(&mut self, id: u32) -> bool766     fn unregister_connection_callback(&mut self, id: u32) -> bool {
767         dbus_generated!()
768     }
769 
init(&mut self, _init_flags: Vec<String>) -> bool770     fn init(&mut self, _init_flags: Vec<String>) -> bool {
771         // Not implemented by server
772         true
773     }
774 
enable(&mut self) -> bool775     fn enable(&mut self) -> bool {
776         // Not implemented by server
777         true
778     }
779 
disable(&mut self) -> bool780     fn disable(&mut self) -> bool {
781         // Not implemented by server
782         true
783     }
784 
cleanup(&mut self)785     fn cleanup(&mut self) {
786         // Not implemented by server
787     }
788 
789     #[dbus_method("GetAddress")]
get_address(&self) -> RawAddress790     fn get_address(&self) -> RawAddress {
791         dbus_generated!()
792     }
793 
794     #[dbus_method("GetUuids")]
get_uuids(&self) -> Vec<Uuid>795     fn get_uuids(&self) -> Vec<Uuid> {
796         dbus_generated!()
797     }
798 
799     #[dbus_method("GetName")]
get_name(&self) -> String800     fn get_name(&self) -> String {
801         dbus_generated!()
802     }
803 
804     #[dbus_method("SetName")]
set_name(&self, name: String) -> bool805     fn set_name(&self, name: String) -> bool {
806         dbus_generated!()
807     }
808 
809     #[dbus_method("GetBluetoothClass")]
get_bluetooth_class(&self) -> u32810     fn get_bluetooth_class(&self) -> u32 {
811         dbus_generated!()
812     }
813 
814     #[dbus_method("SetBluetoothClass")]
set_bluetooth_class(&self, cod: u32) -> bool815     fn set_bluetooth_class(&self, cod: u32) -> bool {
816         dbus_generated!()
817     }
818 
819     #[dbus_method("GetDiscoverable")]
get_discoverable(&self) -> bool820     fn get_discoverable(&self) -> bool {
821         dbus_generated!()
822     }
823 
824     #[dbus_method("GetDiscoverableTimeout")]
get_discoverable_timeout(&self) -> u32825     fn get_discoverable_timeout(&self) -> u32 {
826         dbus_generated!()
827     }
828 
829     #[dbus_method("SetDiscoverable")]
set_discoverable(&mut self, mode: BtDiscMode, duration: u32) -> bool830     fn set_discoverable(&mut self, mode: BtDiscMode, duration: u32) -> bool {
831         dbus_generated!()
832     }
833 
834     #[dbus_method("IsMultiAdvertisementSupported")]
is_multi_advertisement_supported(&self) -> bool835     fn is_multi_advertisement_supported(&self) -> bool {
836         dbus_generated!()
837     }
838 
839     #[dbus_method("IsLeExtendedAdvertisingSupported")]
is_le_extended_advertising_supported(&self) -> bool840     fn is_le_extended_advertising_supported(&self) -> bool {
841         dbus_generated!()
842     }
843 
844     #[dbus_method("StartDiscovery")]
start_discovery(&mut self) -> bool845     fn start_discovery(&mut self) -> bool {
846         dbus_generated!()
847     }
848 
849     #[dbus_method("CancelDiscovery")]
cancel_discovery(&mut self) -> bool850     fn cancel_discovery(&mut self) -> bool {
851         dbus_generated!()
852     }
853 
854     #[dbus_method("IsDiscovering")]
is_discovering(&self) -> bool855     fn is_discovering(&self) -> bool {
856         dbus_generated!()
857     }
858 
859     #[dbus_method("GetDiscoveryEndMillis")]
get_discovery_end_millis(&self) -> u64860     fn get_discovery_end_millis(&self) -> u64 {
861         dbus_generated!()
862     }
863 
864     #[dbus_method("CreateBond")]
create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> BtStatus865     fn create_bond(&mut self, device: BluetoothDevice, transport: BtTransport) -> BtStatus {
866         dbus_generated!()
867     }
868 
869     #[dbus_method("CancelBondProcess")]
cancel_bond_process(&mut self, device: BluetoothDevice) -> bool870     fn cancel_bond_process(&mut self, device: BluetoothDevice) -> bool {
871         dbus_generated!()
872     }
873 
874     #[dbus_method("RemoveBond")]
remove_bond(&mut self, device: BluetoothDevice) -> bool875     fn remove_bond(&mut self, device: BluetoothDevice) -> bool {
876         dbus_generated!()
877     }
878 
879     #[dbus_method("GetBondedDevices")]
get_bonded_devices(&self) -> Vec<BluetoothDevice>880     fn get_bonded_devices(&self) -> Vec<BluetoothDevice> {
881         dbus_generated!()
882     }
883 
884     #[dbus_method("GetBondState")]
get_bond_state(&self, device: BluetoothDevice) -> BtBondState885     fn get_bond_state(&self, device: BluetoothDevice) -> BtBondState {
886         dbus_generated!()
887     }
888 
889     #[dbus_method("SetPin")]
set_pin(&self, device: BluetoothDevice, accept: bool, pin_code: Vec<u8>) -> bool890     fn set_pin(&self, device: BluetoothDevice, accept: bool, pin_code: Vec<u8>) -> bool {
891         dbus_generated!()
892     }
893 
894     #[dbus_method("SetPasskey")]
set_passkey(&self, device: BluetoothDevice, accept: bool, passkey: Vec<u8>) -> bool895     fn set_passkey(&self, device: BluetoothDevice, accept: bool, passkey: Vec<u8>) -> bool {
896         dbus_generated!()
897     }
898 
899     #[dbus_method("SetPairingConfirmation")]
set_pairing_confirmation(&self, device: BluetoothDevice, accept: bool) -> bool900     fn set_pairing_confirmation(&self, device: BluetoothDevice, accept: bool) -> bool {
901         dbus_generated!()
902     }
903 
904     #[dbus_method("GetRemoteName")]
get_remote_name(&self, device: BluetoothDevice) -> String905     fn get_remote_name(&self, device: BluetoothDevice) -> String {
906         dbus_generated!()
907     }
908 
909     #[dbus_method("GetRemoteType")]
get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType910     fn get_remote_type(&self, device: BluetoothDevice) -> BtDeviceType {
911         dbus_generated!()
912     }
913 
914     #[dbus_method("GetRemoteAlias")]
get_remote_alias(&self, device: BluetoothDevice) -> String915     fn get_remote_alias(&self, device: BluetoothDevice) -> String {
916         dbus_generated!()
917     }
918 
919     #[dbus_method("SetRemoteAlias")]
set_remote_alias(&mut self, device: BluetoothDevice, new_alias: String)920     fn set_remote_alias(&mut self, device: BluetoothDevice, new_alias: String) {
921         dbus_generated!()
922     }
923 
924     #[dbus_method("GetRemoteClass")]
get_remote_class(&self, device: BluetoothDevice) -> u32925     fn get_remote_class(&self, device: BluetoothDevice) -> u32 {
926         dbus_generated!()
927     }
928 
929     #[dbus_method("GetRemoteAppearance")]
get_remote_appearance(&self, device: BluetoothDevice) -> u16930     fn get_remote_appearance(&self, device: BluetoothDevice) -> u16 {
931         dbus_generated!()
932     }
933 
934     #[dbus_method("GetRemoteConnected")]
get_remote_connected(&self, device: BluetoothDevice) -> bool935     fn get_remote_connected(&self, device: BluetoothDevice) -> bool {
936         dbus_generated!()
937     }
938 
939     #[dbus_method("GetRemoteWakeAllowed")]
get_remote_wake_allowed(&self, _device: BluetoothDevice) -> bool940     fn get_remote_wake_allowed(&self, _device: BluetoothDevice) -> bool {
941         dbus_generated!()
942     }
943 
944     #[dbus_method("GetRemoteVendorProductInfo")]
get_remote_vendor_product_info(&self, _device: BluetoothDevice) -> BtVendorProductInfo945     fn get_remote_vendor_product_info(&self, _device: BluetoothDevice) -> BtVendorProductInfo {
946         dbus_generated!()
947     }
948 
949     #[dbus_method("GetRemoteAddressType")]
get_remote_address_type(&self, device: BluetoothDevice) -> BtAddrType950     fn get_remote_address_type(&self, device: BluetoothDevice) -> BtAddrType {
951         dbus_generated!()
952     }
953 
954     #[dbus_method("GetRemoteRSSI")]
get_remote_rssi(&self, device: BluetoothDevice) -> i8955     fn get_remote_rssi(&self, device: BluetoothDevice) -> i8 {
956         dbus_generated!()
957     }
958 
959     #[dbus_method("GetConnectedDevices")]
get_connected_devices(&self) -> Vec<BluetoothDevice>960     fn get_connected_devices(&self) -> Vec<BluetoothDevice> {
961         dbus_generated!()
962     }
963 
964     #[dbus_method("GetConnectionState")]
get_connection_state(&self, device: BluetoothDevice) -> BtConnectionState965     fn get_connection_state(&self, device: BluetoothDevice) -> BtConnectionState {
966         dbus_generated!()
967     }
968 
969     #[dbus_method("GetProfileConnectionState")]
get_profile_connection_state(&self, profile: Uuid) -> ProfileConnectionState970     fn get_profile_connection_state(&self, profile: Uuid) -> ProfileConnectionState {
971         dbus_generated!()
972     }
973 
974     #[dbus_method("GetRemoteUuids")]
get_remote_uuids(&self, device: BluetoothDevice) -> Vec<Uuid>975     fn get_remote_uuids(&self, device: BluetoothDevice) -> Vec<Uuid> {
976         dbus_generated!()
977     }
978 
979     #[dbus_method("FetchRemoteUuids")]
fetch_remote_uuids(&self, device: BluetoothDevice) -> bool980     fn fetch_remote_uuids(&self, device: BluetoothDevice) -> bool {
981         dbus_generated!()
982     }
983 
984     #[dbus_method("SdpSearch")]
sdp_search(&self, device: BluetoothDevice, uuid: Uuid) -> bool985     fn sdp_search(&self, device: BluetoothDevice, uuid: Uuid) -> bool {
986         dbus_generated!()
987     }
988 
989     #[dbus_method("CreateSdpRecord")]
create_sdp_record(&mut self, sdp_record: BtSdpRecord) -> bool990     fn create_sdp_record(&mut self, sdp_record: BtSdpRecord) -> bool {
991         dbus_generated!()
992     }
993 
994     #[dbus_method("RemoveSdpRecord")]
remove_sdp_record(&self, handle: i32) -> bool995     fn remove_sdp_record(&self, handle: i32) -> bool {
996         dbus_generated!()
997     }
998 
999     #[dbus_method("ConnectAllEnabledProfiles")]
connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> BtStatus1000     fn connect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> BtStatus {
1001         dbus_generated!()
1002     }
1003 
1004     #[dbus_method("DisconnectAllEnabledProfiles")]
disconnect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool1005     fn disconnect_all_enabled_profiles(&mut self, device: BluetoothDevice) -> bool {
1006         dbus_generated!()
1007     }
1008 
1009     #[dbus_method("IsWbsSupported")]
is_wbs_supported(&self) -> bool1010     fn is_wbs_supported(&self) -> bool {
1011         dbus_generated!()
1012     }
1013 
1014     #[dbus_method("IsSwbSupported")]
is_swb_supported(&self) -> bool1015     fn is_swb_supported(&self) -> bool {
1016         dbus_generated!()
1017     }
1018 
1019     #[dbus_method("GetSupportedRoles")]
get_supported_roles(&self) -> Vec<BtAdapterRole>1020     fn get_supported_roles(&self) -> Vec<BtAdapterRole> {
1021         dbus_generated!()
1022     }
1023 
1024     #[dbus_method("IsCodingFormatSupported")]
is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool1025     fn is_coding_format_supported(&self, coding_format: EscoCodingFormat) -> bool {
1026         dbus_generated!()
1027     }
1028 
1029     #[dbus_method("IsLEAudioSupported")]
is_le_audio_supported(&self) -> bool1030     fn is_le_audio_supported(&self) -> bool {
1031         dbus_generated!()
1032     }
1033 
1034     #[dbus_method("IsDualModeAudioSinkDevice")]
is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool1035     fn is_dual_mode_audio_sink_device(&self, device: BluetoothDevice) -> bool {
1036         dbus_generated!()
1037     }
1038 
1039     #[dbus_method("GetDumpsys")]
get_dumpsys(&self) -> String1040     fn get_dumpsys(&self) -> String {
1041         dbus_generated!()
1042     }
1043 }
1044 
1045 pub(crate) struct BluetoothQALegacyDBus {
1046     client_proxy: ClientDBusProxy,
1047 }
1048 
1049 impl BluetoothQALegacyDBus {
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothQALegacyDBus1050     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothQALegacyDBus {
1051         BluetoothQALegacyDBus {
1052             client_proxy: ClientDBusProxy::new(
1053                 conn.clone(),
1054                 String::from("org.chromium.bluetooth"),
1055                 make_object_path(index, "adapter"),
1056                 String::from("org.chromium.bluetooth.BluetoothQALegacy"),
1057             ),
1058         }
1059     }
1060 }
1061 
1062 #[generate_dbus_interface_client]
1063 impl IBluetoothQALegacy for BluetoothQALegacyDBus {
1064     #[dbus_method("GetConnectable")]
get_connectable(&self) -> bool1065     fn get_connectable(&self) -> bool {
1066         dbus_generated!()
1067     }
1068 
1069     #[dbus_method("SetConnectable")]
set_connectable(&mut self, mode: bool) -> bool1070     fn set_connectable(&mut self, mode: bool) -> bool {
1071         dbus_generated!()
1072     }
1073 
1074     #[dbus_method("GetAlias")]
get_alias(&self) -> String1075     fn get_alias(&self) -> String {
1076         dbus_generated!()
1077     }
1078 
1079     #[dbus_method("GetModalias")]
get_modalias(&self) -> String1080     fn get_modalias(&self) -> String {
1081         dbus_generated!()
1082     }
1083 
1084     #[dbus_method("GetHIDReport")]
get_hid_report( &mut self, addr: RawAddress, report_type: BthhReportType, report_id: u8, ) -> BtStatus1085     fn get_hid_report(
1086         &mut self,
1087         addr: RawAddress,
1088         report_type: BthhReportType,
1089         report_id: u8,
1090     ) -> BtStatus {
1091         dbus_generated!()
1092     }
1093 
1094     #[dbus_method("SetHIDReport")]
set_hid_report( &mut self, addr: RawAddress, report_type: BthhReportType, report: String, ) -> BtStatus1095     fn set_hid_report(
1096         &mut self,
1097         addr: RawAddress,
1098         report_type: BthhReportType,
1099         report: String,
1100     ) -> BtStatus {
1101         dbus_generated!()
1102     }
1103 
1104     #[dbus_method("SendHIDData")]
send_hid_data(&mut self, addr: RawAddress, data: String) -> BtStatus1105     fn send_hid_data(&mut self, addr: RawAddress, data: String) -> BtStatus;
1106 }
1107 
1108 #[dbus_propmap(AdapterWithEnabled)]
1109 pub struct AdapterWithEnabledDbus {
1110     hci_interface: i32,
1111     enabled: bool,
1112 }
1113 
1114 // Implements RPC-friendly wrapper methods for calling IBluetoothManager, generated by
1115 // `generate_dbus_interface_client` below.
1116 pub(crate) struct BluetoothManagerDBusRPC {
1117     client_proxy: ClientDBusProxy,
1118 }
1119 
1120 pub(crate) struct BluetoothManagerDBus {
1121     client_proxy: ClientDBusProxy,
1122     pub rpc: BluetoothManagerDBusRPC,
1123 }
1124 
1125 impl BluetoothManagerDBus {
make_client_proxy(conn: Arc<SyncConnection>) -> ClientDBusProxy1126     fn make_client_proxy(conn: Arc<SyncConnection>) -> ClientDBusProxy {
1127         ClientDBusProxy::new(
1128             conn,
1129             String::from("org.chromium.bluetooth.Manager"),
1130             dbus::Path::new("/org/chromium/bluetooth/Manager").unwrap(),
1131             String::from("org.chromium.bluetooth.Manager"),
1132         )
1133     }
1134 
new(conn: Arc<SyncConnection>) -> BluetoothManagerDBus1135     pub(crate) fn new(conn: Arc<SyncConnection>) -> BluetoothManagerDBus {
1136         BluetoothManagerDBus {
1137             client_proxy: Self::make_client_proxy(conn.clone()),
1138             rpc: BluetoothManagerDBusRPC { client_proxy: Self::make_client_proxy(conn.clone()) },
1139         }
1140     }
1141 
is_valid(&self) -> bool1142     pub(crate) fn is_valid(&self) -> bool {
1143         let result: Result<(bool,), _> = self.client_proxy.method_withresult("GetFlossEnabled", ());
1144         return result.is_ok();
1145     }
1146 }
1147 
1148 #[generate_dbus_interface_client(BluetoothManagerDBusRPC)]
1149 impl IBluetoothManager for BluetoothManagerDBus {
1150     #[dbus_method("Start")]
start(&mut self, hci_interface: i32)1151     fn start(&mut self, hci_interface: i32) {
1152         dbus_generated!()
1153     }
1154 
1155     #[dbus_method("Stop")]
stop(&mut self, hci_interface: i32)1156     fn stop(&mut self, hci_interface: i32) {
1157         dbus_generated!()
1158     }
1159 
1160     #[dbus_method("GetAdapterEnabled")]
get_adapter_enabled(&mut self, hci_interface: i32) -> bool1161     fn get_adapter_enabled(&mut self, hci_interface: i32) -> bool {
1162         dbus_generated!()
1163     }
1164 
1165     #[dbus_method("RegisterCallback")]
register_callback(&mut self, callback: Box<dyn IBluetoothManagerCallback + Send>)1166     fn register_callback(&mut self, callback: Box<dyn IBluetoothManagerCallback + Send>) {
1167         dbus_generated!()
1168     }
1169 
1170     #[dbus_method("GetFlossEnabled")]
get_floss_enabled(&mut self) -> bool1171     fn get_floss_enabled(&mut self) -> bool {
1172         dbus_generated!()
1173     }
1174 
1175     #[dbus_method("SetFlossEnabled")]
set_floss_enabled(&mut self, enabled: bool)1176     fn set_floss_enabled(&mut self, enabled: bool) {
1177         dbus_generated!()
1178     }
1179 
1180     #[dbus_method("GetAvailableAdapters")]
get_available_adapters(&mut self) -> Vec<AdapterWithEnabled>1181     fn get_available_adapters(&mut self) -> Vec<AdapterWithEnabled> {
1182         dbus_generated!()
1183     }
1184 
1185     #[dbus_method("GetDefaultAdapter")]
get_default_adapter(&mut self) -> i321186     fn get_default_adapter(&mut self) -> i32 {
1187         dbus_generated!()
1188     }
1189 
1190     #[dbus_method("SetDesiredDefaultAdapter")]
set_desired_default_adapter(&mut self, adapter: i32)1191     fn set_desired_default_adapter(&mut self, adapter: i32) {
1192         dbus_generated!()
1193     }
1194 
1195     #[dbus_method("GetFlossApiVersion")]
get_floss_api_version(&mut self) -> u321196     fn get_floss_api_version(&mut self) -> u32 {
1197         dbus_generated!()
1198     }
1199 
1200     #[dbus_method("SetTabletMode")]
set_tablet_mode(&mut self, tablet_mode: bool)1201     fn set_tablet_mode(&mut self, tablet_mode: bool) {
1202         dbus_generated!()
1203     }
1204 }
1205 
1206 struct IBluetoothManagerCallbackDBus {}
1207 
1208 impl RPCProxy for IBluetoothManagerCallbackDBus {}
1209 
1210 #[generate_dbus_exporter(
1211     export_bluetooth_manager_callback_dbus_intf,
1212     "org.chromium.bluetooth.ManagerCallback"
1213 )]
1214 impl IBluetoothManagerCallback for IBluetoothManagerCallbackDBus {
1215     #[dbus_method("OnHciDeviceChanged", DBusLog::Disable)]
on_hci_device_changed(&mut self, hci_interface: i32, present: bool)1216     fn on_hci_device_changed(&mut self, hci_interface: i32, present: bool) {}
1217 
1218     #[dbus_method("OnHciEnabledChanged", DBusLog::Disable)]
on_hci_enabled_changed(&mut self, hci_interface: i32, enabled: bool)1219     fn on_hci_enabled_changed(&mut self, hci_interface: i32, enabled: bool) {}
1220 
1221     #[dbus_method("OnDefaultAdapterChanged", DBusLog::Disable)]
on_default_adapter_changed(&mut self, hci_interface: i32)1222     fn on_default_adapter_changed(&mut self, hci_interface: i32) {}
1223 }
1224 
1225 #[allow(dead_code)]
1226 struct IAdvertisingSetCallbackDBus {}
1227 
1228 impl RPCProxy for IAdvertisingSetCallbackDBus {}
1229 
1230 #[generate_dbus_exporter(
1231     export_advertising_set_callback_dbus_intf,
1232     "org.chromium.bluetooth.AdvertisingSetCallback"
1233 )]
1234 impl IAdvertisingSetCallback for IAdvertisingSetCallbackDBus {
1235     #[dbus_method("OnAdvertisingSetStarted", DBusLog::Disable)]
on_advertising_set_started( &mut self, reg_id: i32, advertiser_id: i32, tx_power: i32, status: AdvertisingStatus, )1236     fn on_advertising_set_started(
1237         &mut self,
1238         reg_id: i32,
1239         advertiser_id: i32,
1240         tx_power: i32,
1241         status: AdvertisingStatus,
1242     ) {
1243     }
1244 
1245     #[dbus_method("OnOwnAddressRead", DBusLog::Disable)]
on_own_address_read(&mut self, advertiser_id: i32, address_type: i32, address: RawAddress)1246     fn on_own_address_read(&mut self, advertiser_id: i32, address_type: i32, address: RawAddress) {}
1247 
1248     #[dbus_method("OnAdvertisingSetStopped", DBusLog::Disable)]
on_advertising_set_stopped(&mut self, advertiser_id: i32)1249     fn on_advertising_set_stopped(&mut self, advertiser_id: i32) {}
1250 
1251     #[dbus_method("OnAdvertisingEnabled", DBusLog::Disable)]
on_advertising_enabled( &mut self, advertiser_id: i32, enable: bool, status: AdvertisingStatus, )1252     fn on_advertising_enabled(
1253         &mut self,
1254         advertiser_id: i32,
1255         enable: bool,
1256         status: AdvertisingStatus,
1257     ) {
1258     }
1259 
1260     #[dbus_method("OnAdvertisingDataSet", DBusLog::Disable)]
on_advertising_data_set(&mut self, advertiser_id: i32, status: AdvertisingStatus)1261     fn on_advertising_data_set(&mut self, advertiser_id: i32, status: AdvertisingStatus) {}
1262 
1263     #[dbus_method("OnScanResponseDataSet", DBusLog::Disable)]
on_scan_response_data_set(&mut self, advertiser_id: i32, status: AdvertisingStatus)1264     fn on_scan_response_data_set(&mut self, advertiser_id: i32, status: AdvertisingStatus) {}
1265 
1266     #[dbus_method("OnAdvertisingParametersUpdated", DBusLog::Disable)]
on_advertising_parameters_updated( &mut self, advertiser_id: i32, tx_power: i32, status: AdvertisingStatus, )1267     fn on_advertising_parameters_updated(
1268         &mut self,
1269         advertiser_id: i32,
1270         tx_power: i32,
1271         status: AdvertisingStatus,
1272     ) {
1273     }
1274 
1275     #[dbus_method("OnPeriodicAdvertisingParametersUpdated", DBusLog::Disable)]
on_periodic_advertising_parameters_updated( &mut self, advertiser_id: i32, status: AdvertisingStatus, )1276     fn on_periodic_advertising_parameters_updated(
1277         &mut self,
1278         advertiser_id: i32,
1279         status: AdvertisingStatus,
1280     ) {
1281     }
1282 
1283     #[dbus_method("OnPeriodicAdvertisingDataSet", DBusLog::Disable)]
on_periodic_advertising_data_set(&mut self, advertiser_id: i32, status: AdvertisingStatus)1284     fn on_periodic_advertising_data_set(&mut self, advertiser_id: i32, status: AdvertisingStatus) {}
1285 
1286     #[dbus_method("OnPeriodicAdvertisingEnabled", DBusLog::Disable)]
on_periodic_advertising_enabled( &mut self, advertiser_id: i32, enable: bool, status: AdvertisingStatus, )1287     fn on_periodic_advertising_enabled(
1288         &mut self,
1289         advertiser_id: i32,
1290         enable: bool,
1291         status: AdvertisingStatus,
1292     ) {
1293     }
1294 
1295     #[dbus_method("OnSuspendModeChange", DBusLog::Disable)]
on_suspend_mode_change(&mut self, suspend_mode: SuspendMode)1296     fn on_suspend_mode_change(&mut self, suspend_mode: SuspendMode) {}
1297 }
1298 
1299 #[dbus_propmap(AdvertisingSetParameters)]
1300 struct AdvertisingSetParametersDBus {
1301     discoverable: LeDiscMode,
1302     connectable: bool,
1303     scannable: bool,
1304     is_legacy: bool,
1305     is_anonymous: bool,
1306     include_tx_power: bool,
1307     primary_phy: LePhy,
1308     secondary_phy: LePhy,
1309     interval: i32,
1310     tx_power_level: i32,
1311     own_address_type: i32,
1312 }
1313 
1314 #[dbus_propmap(AdvertiseData)]
1315 pub struct AdvertiseDataDBus {
1316     service_uuids: Vec<Uuid>,
1317     solicit_uuids: Vec<Uuid>,
1318     transport_discovery_data: Vec<Vec<u8>>,
1319     manufacturer_data: HashMap<ManfId, Vec<u8>>,
1320     service_data: HashMap<String, Vec<u8>>,
1321     include_tx_power_level: bool,
1322     include_device_name: bool,
1323 }
1324 
1325 #[dbus_propmap(PeriodicAdvertisingParameters)]
1326 pub struct PeriodicAdvertisingParametersDBus {
1327     pub include_tx_power: bool,
1328     pub interval: i32,
1329 }
1330 
1331 pub(crate) struct BluetoothAdminDBusRPC {
1332     client_proxy: ClientDBusProxy,
1333 }
1334 
1335 pub(crate) struct BluetoothAdminDBus {
1336     client_proxy: ClientDBusProxy,
1337     pub rpc: BluetoothAdminDBusRPC,
1338 }
1339 
1340 impl BluetoothAdminDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy1341     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
1342         ClientDBusProxy::new(
1343             conn,
1344             String::from("org.chromium.bluetooth"),
1345             make_object_path(index, "admin"),
1346             String::from("org.chromium.bluetooth.BluetoothAdmin"),
1347         )
1348     }
1349 
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothAdminDBus1350     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothAdminDBus {
1351         BluetoothAdminDBus {
1352             client_proxy: Self::make_client_proxy(conn.clone(), index),
1353             rpc: BluetoothAdminDBusRPC {
1354                 client_proxy: Self::make_client_proxy(conn.clone(), index),
1355             },
1356         }
1357     }
1358 }
1359 
1360 #[generate_dbus_interface_client(BluetoothAdminDBusRPC)]
1361 impl IBluetoothAdmin for BluetoothAdminDBus {
1362     #[dbus_method("IsServiceAllowed")]
is_service_allowed(&self, uuid: Uuid) -> bool1363     fn is_service_allowed(&self, uuid: Uuid) -> bool {
1364         dbus_generated!()
1365     }
1366 
1367     #[dbus_method("SetAllowedServices")]
set_allowed_services(&mut self, services: Vec<Uuid>) -> bool1368     fn set_allowed_services(&mut self, services: Vec<Uuid>) -> bool {
1369         dbus_generated!()
1370     }
1371 
1372     #[dbus_method("GetAllowedServices")]
get_allowed_services(&self) -> Vec<Uuid>1373     fn get_allowed_services(&self) -> Vec<Uuid> {
1374         dbus_generated!()
1375     }
1376 
1377     #[dbus_method("GetDevicePolicyEffect")]
get_device_policy_effect(&self, device: BluetoothDevice) -> Option<PolicyEffect>1378     fn get_device_policy_effect(&self, device: BluetoothDevice) -> Option<PolicyEffect> {
1379         dbus_generated!()
1380     }
1381 
1382     #[dbus_method("RegisterAdminPolicyCallback")]
register_admin_policy_callback( &mut self, callback: Box<dyn IBluetoothAdminPolicyCallback + Send>, ) -> u321383     fn register_admin_policy_callback(
1384         &mut self,
1385         callback: Box<dyn IBluetoothAdminPolicyCallback + Send>,
1386     ) -> u32 {
1387         dbus_generated!()
1388     }
1389 
1390     #[dbus_method("UnregisterAdminPolicyCallback")]
unregister_admin_policy_callback(&mut self, callback_id: u32) -> bool1391     fn unregister_admin_policy_callback(&mut self, callback_id: u32) -> bool {
1392         dbus_generated!()
1393     }
1394 }
1395 
1396 #[dbus_propmap(PolicyEffect)]
1397 pub struct PolicyEffectDBus {
1398     pub service_blocked: Vec<Uuid>,
1399     pub affected: bool,
1400 }
1401 
1402 struct IBluetoothAdminPolicyCallbackDBus {}
1403 
1404 impl RPCProxy for IBluetoothAdminPolicyCallbackDBus {}
1405 
1406 #[generate_dbus_exporter(
1407     export_admin_policy_callback_dbus_intf,
1408     "org.chromium.bluetooth.AdminPolicyCallback"
1409 )]
1410 impl IBluetoothAdminPolicyCallback for IBluetoothAdminPolicyCallbackDBus {
1411     #[dbus_method("OnServiceAllowlistChanged", DBusLog::Disable)]
on_service_allowlist_changed(&mut self, allowed_list: Vec<Uuid>)1412     fn on_service_allowlist_changed(&mut self, allowed_list: Vec<Uuid>) {
1413         dbus_generated!()
1414     }
1415 
1416     #[dbus_method("OnDevicePolicyEffectChanged", DBusLog::Disable)]
on_device_policy_effect_changed( &mut self, device: BluetoothDevice, new_policy_effect: Option<PolicyEffect>, )1417     fn on_device_policy_effect_changed(
1418         &mut self,
1419         device: BluetoothDevice,
1420         new_policy_effect: Option<PolicyEffect>,
1421     ) {
1422         dbus_generated!()
1423     }
1424 }
1425 
1426 pub(crate) struct BluetoothGattDBusRPC {
1427     client_proxy: ClientDBusProxy,
1428 }
1429 
1430 pub(crate) struct BluetoothGattDBus {
1431     client_proxy: ClientDBusProxy,
1432     pub rpc: BluetoothGattDBusRPC,
1433 }
1434 
1435 impl BluetoothGattDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy1436     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
1437         ClientDBusProxy::new(
1438             conn,
1439             String::from("org.chromium.bluetooth"),
1440             make_object_path(index, "gatt"),
1441             String::from("org.chromium.bluetooth.BluetoothGatt"),
1442         )
1443     }
1444 
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothGattDBus1445     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothGattDBus {
1446         BluetoothGattDBus {
1447             client_proxy: Self::make_client_proxy(conn.clone(), index),
1448             rpc: BluetoothGattDBusRPC {
1449                 client_proxy: Self::make_client_proxy(conn.clone(), index),
1450             },
1451         }
1452     }
1453 }
1454 
1455 #[generate_dbus_interface_client(BluetoothGattDBusRPC)]
1456 impl IBluetoothGatt for BluetoothGattDBus {
1457     // Scanning
1458 
1459     #[dbus_method("IsMsftSupported")]
is_msft_supported(&self) -> bool1460     fn is_msft_supported(&self) -> bool {
1461         dbus_generated!()
1462     }
1463 
1464     #[dbus_method("RegisterScannerCallback")]
register_scanner_callback(&mut self, _callback: Box<dyn IScannerCallback + Send>) -> u321465     fn register_scanner_callback(&mut self, _callback: Box<dyn IScannerCallback + Send>) -> u32 {
1466         dbus_generated!()
1467     }
1468 
1469     #[dbus_method("UnregisterScannerCallback")]
unregister_scanner_callback(&mut self, _callback_id: u32) -> bool1470     fn unregister_scanner_callback(&mut self, _callback_id: u32) -> bool {
1471         dbus_generated!()
1472     }
1473 
1474     #[dbus_method("RegisterScanner")]
register_scanner(&mut self, callback_id: u32) -> Uuid1475     fn register_scanner(&mut self, callback_id: u32) -> Uuid {
1476         dbus_generated!()
1477     }
1478 
1479     #[dbus_method("UnregisterScanner")]
unregister_scanner(&mut self, scanner_id: u8) -> bool1480     fn unregister_scanner(&mut self, scanner_id: u8) -> bool {
1481         dbus_generated!()
1482     }
1483 
1484     #[dbus_method("StartScan")]
start_scan( &mut self, _scanner_id: u8, _settings: Option<ScanSettings>, _filter: Option<ScanFilter>, ) -> BtStatus1485     fn start_scan(
1486         &mut self,
1487         _scanner_id: u8,
1488         _settings: Option<ScanSettings>,
1489         _filter: Option<ScanFilter>,
1490     ) -> BtStatus {
1491         dbus_generated!()
1492     }
1493 
1494     #[dbus_method("StopScan")]
stop_scan(&mut self, _scanner_id: u8) -> BtStatus1495     fn stop_scan(&mut self, _scanner_id: u8) -> BtStatus {
1496         dbus_generated!()
1497     }
1498 
1499     #[dbus_method("GetScanSuspendMode")]
get_scan_suspend_mode(&self) -> SuspendMode1500     fn get_scan_suspend_mode(&self) -> SuspendMode {
1501         dbus_generated!()
1502     }
1503 
1504     // Advertising
1505     #[dbus_method("RegisterAdvertiserCallback")]
register_advertiser_callback( &mut self, callback: Box<dyn IAdvertisingSetCallback + Send>, ) -> u321506     fn register_advertiser_callback(
1507         &mut self,
1508         callback: Box<dyn IAdvertisingSetCallback + Send>,
1509     ) -> u32 {
1510         dbus_generated!()
1511     }
1512 
1513     #[dbus_method("UnregisterAdvertiserCallback")]
unregister_advertiser_callback(&mut self, callback_id: u32) -> bool1514     fn unregister_advertiser_callback(&mut self, callback_id: u32) -> bool {
1515         dbus_generated!()
1516     }
1517 
1518     #[dbus_method("StartAdvertisingSet")]
start_advertising_set( &mut self, parameters: AdvertisingSetParameters, advertise_data: AdvertiseData, scan_response: Option<AdvertiseData>, periodic_parameters: Option<PeriodicAdvertisingParameters>, periodic_data: Option<AdvertiseData>, duration: i32, max_ext_adv_events: i32, callback_id: u32, ) -> i321519     fn start_advertising_set(
1520         &mut self,
1521         parameters: AdvertisingSetParameters,
1522         advertise_data: AdvertiseData,
1523         scan_response: Option<AdvertiseData>,
1524         periodic_parameters: Option<PeriodicAdvertisingParameters>,
1525         periodic_data: Option<AdvertiseData>,
1526         duration: i32,
1527         max_ext_adv_events: i32,
1528         callback_id: u32,
1529     ) -> i32 {
1530         dbus_generated!()
1531     }
1532 
1533     #[dbus_method("StopAdvertisingSet")]
stop_advertising_set(&mut self, advertiser_id: i32)1534     fn stop_advertising_set(&mut self, advertiser_id: i32) {
1535         dbus_generated!()
1536     }
1537 
1538     #[dbus_method("GetOwnAddress")]
get_own_address(&mut self, advertiser_id: i32)1539     fn get_own_address(&mut self, advertiser_id: i32) {
1540         dbus_generated!()
1541     }
1542 
1543     #[dbus_method("EnableAdvertisingSet")]
enable_advertising_set( &mut self, advertiser_id: i32, enable: bool, duration: i32, max_ext_adv_events: i32, )1544     fn enable_advertising_set(
1545         &mut self,
1546         advertiser_id: i32,
1547         enable: bool,
1548         duration: i32,
1549         max_ext_adv_events: i32,
1550     ) {
1551         dbus_generated!()
1552     }
1553 
1554     #[dbus_method("SetAdvertisingData")]
set_advertising_data(&mut self, advertiser_id: i32, data: AdvertiseData)1555     fn set_advertising_data(&mut self, advertiser_id: i32, data: AdvertiseData) {
1556         dbus_generated!()
1557     }
1558 
1559     #[dbus_method("SetRawAdvertisingData")]
set_raw_adv_data(&mut self, advertiser_id: i32, data: Vec<u8>)1560     fn set_raw_adv_data(&mut self, advertiser_id: i32, data: Vec<u8>) {
1561         dbus_generated!()
1562     }
1563 
1564     #[dbus_method("SetScanResponseData")]
set_scan_response_data(&mut self, advertiser_id: i32, data: AdvertiseData)1565     fn set_scan_response_data(&mut self, advertiser_id: i32, data: AdvertiseData) {
1566         dbus_generated!()
1567     }
1568 
1569     #[dbus_method("SetAdvertisingParameters")]
set_advertising_parameters( &mut self, advertiser_id: i32, parameters: AdvertisingSetParameters, )1570     fn set_advertising_parameters(
1571         &mut self,
1572         advertiser_id: i32,
1573         parameters: AdvertisingSetParameters,
1574     ) {
1575         dbus_generated!()
1576     }
1577 
1578     #[dbus_method("SetPeriodicAdvertisingParameters")]
set_periodic_advertising_parameters( &mut self, advertiser_id: i32, parameters: PeriodicAdvertisingParameters, )1579     fn set_periodic_advertising_parameters(
1580         &mut self,
1581         advertiser_id: i32,
1582         parameters: PeriodicAdvertisingParameters,
1583     ) {
1584         dbus_generated!()
1585     }
1586 
1587     #[dbus_method("SetPeriodicAdvertisingData")]
set_periodic_advertising_data(&mut self, advertiser_id: i32, data: AdvertiseData)1588     fn set_periodic_advertising_data(&mut self, advertiser_id: i32, data: AdvertiseData) {
1589         dbus_generated!()
1590     }
1591 
1592     /// Enable/Disable periodic advertising of the advertising set.
1593     #[dbus_method("SetPeriodicAdvertisingEnable")]
set_periodic_advertising_enable( &mut self, advertiser_id: i32, enable: bool, include_adi: bool, )1594     fn set_periodic_advertising_enable(
1595         &mut self,
1596         advertiser_id: i32,
1597         enable: bool,
1598         include_adi: bool,
1599     ) {
1600         dbus_generated!()
1601     }
1602 
1603     // GATT Client
1604 
1605     #[dbus_method("RegisterClient")]
register_client( &mut self, app_uuid: String, callback: Box<dyn IBluetoothGattCallback + Send>, eatt_support: bool, )1606     fn register_client(
1607         &mut self,
1608         app_uuid: String,
1609         callback: Box<dyn IBluetoothGattCallback + Send>,
1610         eatt_support: bool,
1611     ) {
1612         dbus_generated!()
1613     }
1614 
1615     #[dbus_method("UnregisterClient")]
unregister_client(&mut self, client_id: i32)1616     fn unregister_client(&mut self, client_id: i32) {
1617         dbus_generated!()
1618     }
1619 
1620     #[dbus_method("ClientConnect")]
client_connect( &self, client_id: i32, addr: RawAddress, is_direct: bool, transport: BtTransport, opportunistic: bool, phy: LePhy, )1621     fn client_connect(
1622         &self,
1623         client_id: i32,
1624         addr: RawAddress,
1625         is_direct: bool,
1626         transport: BtTransport,
1627         opportunistic: bool,
1628         phy: LePhy,
1629     ) {
1630         dbus_generated!()
1631     }
1632 
1633     #[dbus_method("ClientDisconnect")]
client_disconnect(&self, client_id: i32, addr: RawAddress)1634     fn client_disconnect(&self, client_id: i32, addr: RawAddress) {
1635         dbus_generated!()
1636     }
1637 
1638     #[dbus_method("ClientSetPreferredPhy")]
client_set_preferred_phy( &self, client_id: i32, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, phy_options: i32, )1639     fn client_set_preferred_phy(
1640         &self,
1641         client_id: i32,
1642         addr: RawAddress,
1643         tx_phy: LePhy,
1644         rx_phy: LePhy,
1645         phy_options: i32,
1646     ) {
1647         dbus_generated!()
1648     }
1649 
1650     #[dbus_method("ClientReadPhy")]
client_read_phy(&mut self, client_id: i32, addr: RawAddress)1651     fn client_read_phy(&mut self, client_id: i32, addr: RawAddress) {
1652         dbus_generated!()
1653     }
1654 
1655     #[dbus_method("RefreshDevice")]
refresh_device(&self, client_id: i32, addr: RawAddress)1656     fn refresh_device(&self, client_id: i32, addr: RawAddress) {
1657         dbus_generated!()
1658     }
1659 
1660     #[dbus_method("DiscoverServices")]
discover_services(&self, client_id: i32, addr: RawAddress)1661     fn discover_services(&self, client_id: i32, addr: RawAddress) {
1662         dbus_generated!()
1663     }
1664 
1665     #[dbus_method("DiscoverServiceByUuid")]
discover_service_by_uuid(&self, client_id: i32, addr: RawAddress, uuid: String)1666     fn discover_service_by_uuid(&self, client_id: i32, addr: RawAddress, uuid: String) {
1667         dbus_generated!()
1668     }
1669 
1670     #[dbus_method("BtifGattcDiscoverServiceByUuid")]
btif_gattc_discover_service_by_uuid(&self, client_id: i32, addr: RawAddress, uuid: String)1671     fn btif_gattc_discover_service_by_uuid(&self, client_id: i32, addr: RawAddress, uuid: String) {
1672         dbus_generated!()
1673     }
1674 
1675     #[dbus_method("ReadCharacteristic")]
read_characteristic(&self, client_id: i32, addr: RawAddress, handle: i32, auth_req: i32)1676     fn read_characteristic(&self, client_id: i32, addr: RawAddress, handle: i32, auth_req: i32) {
1677         dbus_generated!()
1678     }
1679 
1680     #[dbus_method("ReadUsingCharacteristicUuid")]
read_using_characteristic_uuid( &self, client_id: i32, addr: RawAddress, uuid: String, start_handle: i32, end_handle: i32, auth_req: i32, )1681     fn read_using_characteristic_uuid(
1682         &self,
1683         client_id: i32,
1684         addr: RawAddress,
1685         uuid: String,
1686         start_handle: i32,
1687         end_handle: i32,
1688         auth_req: i32,
1689     ) {
1690         dbus_generated!()
1691     }
1692 
1693     #[dbus_method("WriteCharacteristic")]
write_characteristic( &self, client_id: i32, addr: RawAddress, handle: i32, write_type: GattWriteType, auth_req: i32, value: Vec<u8>, ) -> GattWriteRequestStatus1694     fn write_characteristic(
1695         &self,
1696         client_id: i32,
1697         addr: RawAddress,
1698         handle: i32,
1699         write_type: GattWriteType,
1700         auth_req: i32,
1701         value: Vec<u8>,
1702     ) -> GattWriteRequestStatus {
1703         dbus_generated!()
1704     }
1705 
1706     #[dbus_method("ReadDescriptor")]
read_descriptor(&self, client_id: i32, addr: RawAddress, handle: i32, auth_req: i32)1707     fn read_descriptor(&self, client_id: i32, addr: RawAddress, handle: i32, auth_req: i32) {
1708         dbus_generated!()
1709     }
1710 
1711     #[dbus_method("WriteDescriptor")]
write_descriptor( &self, client_id: i32, addr: RawAddress, handle: i32, auth_req: i32, value: Vec<u8>, )1712     fn write_descriptor(
1713         &self,
1714         client_id: i32,
1715         addr: RawAddress,
1716         handle: i32,
1717         auth_req: i32,
1718         value: Vec<u8>,
1719     ) {
1720         dbus_generated!()
1721     }
1722 
1723     #[dbus_method("RegisterForNotification")]
register_for_notification( &self, client_id: i32, addr: RawAddress, handle: i32, enable: bool, )1724     fn register_for_notification(
1725         &self,
1726         client_id: i32,
1727         addr: RawAddress,
1728         handle: i32,
1729         enable: bool,
1730     ) {
1731         dbus_generated!()
1732     }
1733 
1734     #[dbus_method("BeginReliableWrite")]
begin_reliable_write(&mut self, client_id: i32, addr: RawAddress)1735     fn begin_reliable_write(&mut self, client_id: i32, addr: RawAddress) {
1736         dbus_generated!()
1737     }
1738 
1739     #[dbus_method("EndReliableWrite")]
end_reliable_write(&mut self, client_id: i32, addr: RawAddress, execute: bool)1740     fn end_reliable_write(&mut self, client_id: i32, addr: RawAddress, execute: bool) {
1741         dbus_generated!()
1742     }
1743 
1744     #[dbus_method("ReadRemoteRssi")]
read_remote_rssi(&self, client_id: i32, addr: RawAddress)1745     fn read_remote_rssi(&self, client_id: i32, addr: RawAddress) {
1746         dbus_generated!()
1747     }
1748 
1749     #[dbus_method("ConfigureMtu")]
configure_mtu(&self, client_id: i32, addr: RawAddress, mtu: i32)1750     fn configure_mtu(&self, client_id: i32, addr: RawAddress, mtu: i32) {
1751         dbus_generated!()
1752     }
1753 
1754     #[dbus_method("ConnectionParameterUpdate")]
connection_parameter_update( &self, client_id: i32, addr: RawAddress, min_interval: i32, max_interval: i32, latency: i32, timeout: i32, min_ce_len: u16, max_ce_len: u16, )1755     fn connection_parameter_update(
1756         &self,
1757         client_id: i32,
1758         addr: RawAddress,
1759         min_interval: i32,
1760         max_interval: i32,
1761         latency: i32,
1762         timeout: i32,
1763         min_ce_len: u16,
1764         max_ce_len: u16,
1765     ) {
1766         dbus_generated!()
1767     }
1768 
1769     // GATT Server
1770 
1771     #[dbus_method("RegisterServer")]
register_server( &mut self, app_uuid: String, callback: Box<dyn IBluetoothGattServerCallback + Send>, eatt_support: bool, )1772     fn register_server(
1773         &mut self,
1774         app_uuid: String,
1775         callback: Box<dyn IBluetoothGattServerCallback + Send>,
1776         eatt_support: bool,
1777     ) {
1778         dbus_generated!()
1779     }
1780 
1781     #[dbus_method("UnregisterServer")]
unregister_server(&mut self, server_id: i32)1782     fn unregister_server(&mut self, server_id: i32) {
1783         dbus_generated!()
1784     }
1785 
1786     #[dbus_method("ServerConnect")]
server_connect( &self, server_id: i32, addr: RawAddress, is_direct: bool, transport: BtTransport, ) -> bool1787     fn server_connect(
1788         &self,
1789         server_id: i32,
1790         addr: RawAddress,
1791         is_direct: bool,
1792         transport: BtTransport,
1793     ) -> bool {
1794         dbus_generated!()
1795     }
1796 
1797     #[dbus_method("ServerDisconnect")]
server_disconnect(&self, server_id: i32, addr: RawAddress) -> bool1798     fn server_disconnect(&self, server_id: i32, addr: RawAddress) -> bool {
1799         dbus_generated!()
1800     }
1801 
1802     #[dbus_method("AddService")]
add_service(&self, server_id: i32, service: BluetoothGattService)1803     fn add_service(&self, server_id: i32, service: BluetoothGattService) {
1804         dbus_generated!()
1805     }
1806 
1807     #[dbus_method("RemoveService")]
remove_service(&self, server_id: i32, handle: i32)1808     fn remove_service(&self, server_id: i32, handle: i32) {
1809         dbus_generated!()
1810     }
1811 
1812     #[dbus_method("ClearServices")]
clear_services(&self, server_id: i32)1813     fn clear_services(&self, server_id: i32) {
1814         dbus_generated!()
1815     }
1816 
1817     #[dbus_method("SendResponse")]
send_response( &self, server_id: i32, addr: RawAddress, request_id: i32, status: GattStatus, offset: i32, value: Vec<u8>, ) -> bool1818     fn send_response(
1819         &self,
1820         server_id: i32,
1821         addr: RawAddress,
1822         request_id: i32,
1823         status: GattStatus,
1824         offset: i32,
1825         value: Vec<u8>,
1826     ) -> bool {
1827         dbus_generated!()
1828     }
1829 
1830     #[dbus_method("SendNotification")]
send_notification( &self, server_id: i32, addr: RawAddress, handle: i32, confirm: bool, value: Vec<u8>, ) -> bool1831     fn send_notification(
1832         &self,
1833         server_id: i32,
1834         addr: RawAddress,
1835         handle: i32,
1836         confirm: bool,
1837         value: Vec<u8>,
1838     ) -> bool {
1839         dbus_generated!()
1840     }
1841 
1842     #[dbus_method("ServerSetPreferredPhy")]
server_set_preferred_phy( &self, server_id: i32, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, phy_options: i32, )1843     fn server_set_preferred_phy(
1844         &self,
1845         server_id: i32,
1846         addr: RawAddress,
1847         tx_phy: LePhy,
1848         rx_phy: LePhy,
1849         phy_options: i32,
1850     ) {
1851         dbus_generated!()
1852     }
1853 
1854     #[dbus_method("ServerReadPhy")]
server_read_phy(&self, server_id: i32, addr: RawAddress)1855     fn server_read_phy(&self, server_id: i32, addr: RawAddress) {
1856         dbus_generated!()
1857     }
1858 }
1859 
1860 struct IBluetoothGattCallbackDBus {}
1861 
1862 impl RPCProxy for IBluetoothGattCallbackDBus {}
1863 
1864 #[generate_dbus_exporter(
1865     export_bluetooth_gatt_callback_dbus_intf,
1866     "org.chromium.bluetooth.BluetoothGattCallback"
1867 )]
1868 impl IBluetoothGattCallback for IBluetoothGattCallbackDBus {
1869     #[dbus_method("OnClientRegistered", DBusLog::Disable)]
on_client_registered(&mut self, status: GattStatus, client_id: i32)1870     fn on_client_registered(&mut self, status: GattStatus, client_id: i32) {}
1871 
1872     #[dbus_method("OnClientConnectionState", DBusLog::Disable)]
on_client_connection_state( &mut self, status: GattStatus, client_id: i32, connected: bool, addr: RawAddress, )1873     fn on_client_connection_state(
1874         &mut self,
1875         status: GattStatus,
1876         client_id: i32,
1877         connected: bool,
1878         addr: RawAddress,
1879     ) {
1880     }
1881 
1882     #[dbus_method("OnPhyUpdate", DBusLog::Disable)]
on_phy_update( &mut self, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus, )1883     fn on_phy_update(
1884         &mut self,
1885         addr: RawAddress,
1886         tx_phy: LePhy,
1887         rx_phy: LePhy,
1888         status: GattStatus,
1889     ) {
1890     }
1891 
1892     #[dbus_method("OnPhyRead", DBusLog::Disable)]
on_phy_read(&mut self, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus)1893     fn on_phy_read(&mut self, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) {}
1894 
1895     #[dbus_method("OnSearchComplete", DBusLog::Disable)]
on_search_complete( &mut self, addr: RawAddress, services: Vec<BluetoothGattService>, status: GattStatus, )1896     fn on_search_complete(
1897         &mut self,
1898         addr: RawAddress,
1899         services: Vec<BluetoothGattService>,
1900         status: GattStatus,
1901     ) {
1902     }
1903 
1904     #[dbus_method("OnCharacteristicRead", DBusLog::Disable)]
on_characteristic_read( &mut self, addr: RawAddress, status: GattStatus, handle: i32, value: Vec<u8>, )1905     fn on_characteristic_read(
1906         &mut self,
1907         addr: RawAddress,
1908         status: GattStatus,
1909         handle: i32,
1910         value: Vec<u8>,
1911     ) {
1912     }
1913 
1914     #[dbus_method("OnCharacteristicWrite", DBusLog::Disable)]
on_characteristic_write(&mut self, addr: RawAddress, status: GattStatus, handle: i32)1915     fn on_characteristic_write(&mut self, addr: RawAddress, status: GattStatus, handle: i32) {}
1916 
1917     #[dbus_method("OnExecuteWrite", DBusLog::Disable)]
on_execute_write(&mut self, addr: RawAddress, status: GattStatus)1918     fn on_execute_write(&mut self, addr: RawAddress, status: GattStatus) {}
1919 
1920     #[dbus_method("OnDescriptorRead", DBusLog::Disable)]
on_descriptor_read( &mut self, addr: RawAddress, status: GattStatus, handle: i32, value: Vec<u8>, )1921     fn on_descriptor_read(
1922         &mut self,
1923         addr: RawAddress,
1924         status: GattStatus,
1925         handle: i32,
1926         value: Vec<u8>,
1927     ) {
1928     }
1929 
1930     #[dbus_method("OnDescriptorWrite", DBusLog::Disable)]
on_descriptor_write(&mut self, addr: RawAddress, status: GattStatus, handle: i32)1931     fn on_descriptor_write(&mut self, addr: RawAddress, status: GattStatus, handle: i32) {}
1932 
1933     #[dbus_method("OnNotify", DBusLog::Disable)]
on_notify(&mut self, addr: RawAddress, handle: i32, value: Vec<u8>)1934     fn on_notify(&mut self, addr: RawAddress, handle: i32, value: Vec<u8>) {}
1935 
1936     #[dbus_method("OnReadRemoteRssi", DBusLog::Disable)]
on_read_remote_rssi(&mut self, addr: RawAddress, rssi: i32, status: GattStatus)1937     fn on_read_remote_rssi(&mut self, addr: RawAddress, rssi: i32, status: GattStatus) {}
1938 
1939     #[dbus_method("OnConfigureMtu", DBusLog::Disable)]
on_configure_mtu(&mut self, addr: RawAddress, mtu: i32, status: GattStatus)1940     fn on_configure_mtu(&mut self, addr: RawAddress, mtu: i32, status: GattStatus) {}
1941 
1942     #[dbus_method("OnConnectionUpdated", DBusLog::Disable)]
on_connection_updated( &mut self, addr: RawAddress, interval: i32, latency: i32, timeout: i32, status: GattStatus, )1943     fn on_connection_updated(
1944         &mut self,
1945         addr: RawAddress,
1946         interval: i32,
1947         latency: i32,
1948         timeout: i32,
1949         status: GattStatus,
1950     ) {
1951     }
1952 
1953     #[dbus_method("OnServiceChanged", DBusLog::Disable)]
on_service_changed(&mut self, addr: RawAddress)1954     fn on_service_changed(&mut self, addr: RawAddress) {}
1955 }
1956 
1957 #[generate_dbus_exporter(
1958     export_gatt_server_callback_dbus_intf,
1959     "org.chromium.bluetooth.BluetoothGattServerCallback"
1960 )]
1961 impl IBluetoothGattServerCallback for IBluetoothGattCallbackDBus {
1962     #[dbus_method("OnServerRegistered", DBusLog::Disable)]
on_server_registered(&mut self, status: GattStatus, client_id: i32)1963     fn on_server_registered(&mut self, status: GattStatus, client_id: i32) {}
1964 
1965     #[dbus_method("OnServerConnectionState", DBusLog::Disable)]
on_server_connection_state(&mut self, server_id: i32, connected: bool, addr: RawAddress)1966     fn on_server_connection_state(&mut self, server_id: i32, connected: bool, addr: RawAddress) {}
1967 
1968     #[dbus_method("OnServiceAdded", DBusLog::Disable)]
on_service_added(&mut self, status: GattStatus, service: BluetoothGattService)1969     fn on_service_added(&mut self, status: GattStatus, service: BluetoothGattService) {}
1970 
1971     #[dbus_method("OnServiceRemoved", DBusLog::Disable)]
on_service_removed(&mut self, status: GattStatus, handle: i32)1972     fn on_service_removed(&mut self, status: GattStatus, handle: i32) {}
1973 
1974     #[dbus_method("OnCharacteristicReadRequest", DBusLog::Disable)]
on_characteristic_read_request( &mut self, addr: RawAddress, trans_id: i32, offset: i32, is_long: bool, handle: i32, )1975     fn on_characteristic_read_request(
1976         &mut self,
1977         addr: RawAddress,
1978         trans_id: i32,
1979         offset: i32,
1980         is_long: bool,
1981         handle: i32,
1982     ) {
1983     }
1984 
1985     #[dbus_method("OnDescriptorReadRequest", DBusLog::Disable)]
on_descriptor_read_request( &mut self, addr: RawAddress, trans_id: i32, offset: i32, is_long: bool, handle: i32, )1986     fn on_descriptor_read_request(
1987         &mut self,
1988         addr: RawAddress,
1989         trans_id: i32,
1990         offset: i32,
1991         is_long: bool,
1992         handle: i32,
1993     ) {
1994     }
1995 
1996     #[dbus_method("OnCharacteristicWriteRequest", DBusLog::Disable)]
on_characteristic_write_request( &mut self, addr: RawAddress, trans_id: i32, offset: i32, len: i32, is_prep: bool, need_rsp: bool, handle: i32, value: Vec<u8>, )1997     fn on_characteristic_write_request(
1998         &mut self,
1999         addr: RawAddress,
2000         trans_id: i32,
2001         offset: i32,
2002         len: i32,
2003         is_prep: bool,
2004         need_rsp: bool,
2005         handle: i32,
2006         value: Vec<u8>,
2007     ) {
2008     }
2009 
2010     #[dbus_method("OnDescriptorWriteRequest", DBusLog::Disable)]
on_descriptor_write_request( &mut self, addr: RawAddress, trans_id: i32, offset: i32, len: i32, is_prep: bool, need_rsp: bool, handle: i32, value: Vec<u8>, )2011     fn on_descriptor_write_request(
2012         &mut self,
2013         addr: RawAddress,
2014         trans_id: i32,
2015         offset: i32,
2016         len: i32,
2017         is_prep: bool,
2018         need_rsp: bool,
2019         handle: i32,
2020         value: Vec<u8>,
2021     ) {
2022     }
2023 
2024     #[dbus_method("OnExecuteWrite", DBusLog::Disable)]
on_execute_write(&mut self, addr: RawAddress, trans_id: i32, exec_write: bool)2025     fn on_execute_write(&mut self, addr: RawAddress, trans_id: i32, exec_write: bool) {}
2026 
2027     #[dbus_method("OnNotificationSent", DBusLog::Disable)]
on_notification_sent(&mut self, addr: RawAddress, status: GattStatus)2028     fn on_notification_sent(&mut self, addr: RawAddress, status: GattStatus) {}
2029 
2030     #[dbus_method("OnMtuChanged", DBusLog::Disable)]
on_mtu_changed(&mut self, addr: RawAddress, mtu: i32)2031     fn on_mtu_changed(&mut self, addr: RawAddress, mtu: i32) {}
2032 
2033     #[dbus_method("OnPhyUpdate", DBusLog::Disable)]
on_phy_update( &mut self, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus, )2034     fn on_phy_update(
2035         &mut self,
2036         addr: RawAddress,
2037         tx_phy: LePhy,
2038         rx_phy: LePhy,
2039         status: GattStatus,
2040     ) {
2041     }
2042 
2043     #[dbus_method("OnPhyRead", DBusLog::Disable)]
on_phy_read(&mut self, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus)2044     fn on_phy_read(&mut self, addr: RawAddress, tx_phy: LePhy, rx_phy: LePhy, status: GattStatus) {}
2045 
2046     #[dbus_method("OnConnectionUpdated", DBusLog::Disable)]
on_connection_updated( &mut self, addr: RawAddress, interval: i32, latency: i32, timeout: i32, status: GattStatus, )2047     fn on_connection_updated(
2048         &mut self,
2049         addr: RawAddress,
2050         interval: i32,
2051         latency: i32,
2052         timeout: i32,
2053         status: GattStatus,
2054     ) {
2055     }
2056 
2057     #[dbus_method("OnSubrateChange", DBusLog::Disable)]
on_subrate_change( &mut self, addr: RawAddress, subrate_factor: i32, latency: i32, cont_num: i32, timeout: i32, status: GattStatus, )2058     fn on_subrate_change(
2059         &mut self,
2060         addr: RawAddress,
2061         subrate_factor: i32,
2062         latency: i32,
2063         cont_num: i32,
2064         timeout: i32,
2065         status: GattStatus,
2066     ) {
2067     }
2068 }
2069 
2070 #[dbus_propmap(BluetoothServerSocket)]
2071 pub struct BluetoothServerSocketDBus {
2072     id: SocketId,
2073     sock_type: SocketType,
2074     flags: i32,
2075     psm: Option<i32>,
2076     channel: Option<i32>,
2077     name: Option<String>,
2078     uuid: Option<Uuid>,
2079 }
2080 
2081 #[dbus_propmap(BluetoothSocket)]
2082 pub struct BluetoothSocketDBus {
2083     id: SocketId,
2084     remote_device: BluetoothDevice,
2085     sock_type: SocketType,
2086     flags: i32,
2087     fd: Option<std::fs::File>,
2088     port: i32,
2089     uuid: Option<Uuid>,
2090     max_rx_size: i32,
2091     max_tx_size: i32,
2092 }
2093 
2094 #[dbus_propmap(SocketResult)]
2095 pub struct SocketResultDBus {
2096     status: BtStatus,
2097     id: u64,
2098 }
2099 
2100 pub(crate) struct BluetoothSocketManagerDBusRPC {
2101     client_proxy: ClientDBusProxy,
2102 }
2103 
2104 pub(crate) struct BluetoothSocketManagerDBus {
2105     client_proxy: ClientDBusProxy,
2106     pub rpc: BluetoothSocketManagerDBusRPC,
2107 }
2108 
2109 impl BluetoothSocketManagerDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy2110     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
2111         ClientDBusProxy::new(
2112             conn,
2113             String::from("org.chromium.bluetooth"),
2114             make_object_path(index, "adapter"),
2115             String::from("org.chromium.bluetooth.SocketManager"),
2116         )
2117     }
2118 
new(conn: Arc<SyncConnection>, index: i32) -> Self2119     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> Self {
2120         BluetoothSocketManagerDBus {
2121             client_proxy: Self::make_client_proxy(conn.clone(), index),
2122             rpc: BluetoothSocketManagerDBusRPC {
2123                 client_proxy: Self::make_client_proxy(conn.clone(), index),
2124             },
2125         }
2126     }
2127 }
2128 
2129 #[generate_dbus_interface_client(BluetoothSocketManagerDBusRPC)]
2130 impl IBluetoothSocketManager for BluetoothSocketManagerDBus {
2131     #[dbus_method("RegisterCallback")]
register_callback( &mut self, callback: Box<dyn IBluetoothSocketManagerCallbacks + Send>, ) -> CallbackId2132     fn register_callback(
2133         &mut self,
2134         callback: Box<dyn IBluetoothSocketManagerCallbacks + Send>,
2135     ) -> CallbackId {
2136         dbus_generated!()
2137     }
2138 
2139     #[dbus_method("UnregisterCallback")]
unregister_callback(&mut self, callback: CallbackId) -> bool2140     fn unregister_callback(&mut self, callback: CallbackId) -> bool {
2141         dbus_generated!()
2142     }
2143 
2144     #[dbus_method("ListenUsingInsecureL2capChannel")]
listen_using_insecure_l2cap_channel(&mut self, callback: CallbackId) -> SocketResult2145     fn listen_using_insecure_l2cap_channel(&mut self, callback: CallbackId) -> SocketResult {
2146         dbus_generated!()
2147     }
2148 
2149     #[dbus_method("ListenUsingInsecureL2capLeChannel")]
listen_using_insecure_l2cap_le_channel(&mut self, callback: CallbackId) -> SocketResult2150     fn listen_using_insecure_l2cap_le_channel(&mut self, callback: CallbackId) -> SocketResult {
2151         dbus_generated!()
2152     }
2153 
2154     #[dbus_method("ListenUsingL2capChannel")]
listen_using_l2cap_channel(&mut self, callback: CallbackId) -> SocketResult2155     fn listen_using_l2cap_channel(&mut self, callback: CallbackId) -> SocketResult {
2156         dbus_generated!()
2157     }
2158 
2159     #[dbus_method("ListenUsingL2capLeChannel")]
listen_using_l2cap_le_channel(&mut self, callback: CallbackId) -> SocketResult2160     fn listen_using_l2cap_le_channel(&mut self, callback: CallbackId) -> SocketResult {
2161         dbus_generated!()
2162     }
2163 
2164     #[dbus_method("ListenUsingInsecureRfcommWithServiceRecord")]
listen_using_insecure_rfcomm_with_service_record( &mut self, callback: CallbackId, name: String, uuid: Uuid, ) -> SocketResult2165     fn listen_using_insecure_rfcomm_with_service_record(
2166         &mut self,
2167         callback: CallbackId,
2168         name: String,
2169         uuid: Uuid,
2170     ) -> SocketResult {
2171         dbus_generated!()
2172     }
2173 
2174     #[dbus_method("ListenUsingRfcommWithServiceRecord")]
listen_using_rfcomm_with_service_record( &mut self, callback: CallbackId, name: String, uuid: Uuid, ) -> SocketResult2175     fn listen_using_rfcomm_with_service_record(
2176         &mut self,
2177         callback: CallbackId,
2178         name: String,
2179         uuid: Uuid,
2180     ) -> SocketResult {
2181         dbus_generated!()
2182     }
2183 
2184     #[dbus_method("ListenUsingRfcomm")]
listen_using_rfcomm( &mut self, callback: CallbackId, channel: Option<i32>, application_uuid: Option<Uuid>, name: Option<String>, flags: Option<i32>, ) -> SocketResult2185     fn listen_using_rfcomm(
2186         &mut self,
2187         callback: CallbackId,
2188         channel: Option<i32>,
2189         application_uuid: Option<Uuid>,
2190         name: Option<String>,
2191         flags: Option<i32>,
2192     ) -> SocketResult {
2193         dbus_generated!()
2194     }
2195 
2196     #[dbus_method("CreateInsecureL2capChannel")]
create_insecure_l2cap_channel( &mut self, callback: CallbackId, device: BluetoothDevice, psm: i32, ) -> SocketResult2197     fn create_insecure_l2cap_channel(
2198         &mut self,
2199         callback: CallbackId,
2200         device: BluetoothDevice,
2201         psm: i32,
2202     ) -> SocketResult {
2203         dbus_generated!()
2204     }
2205 
2206     #[dbus_method("CreateInsecureL2capLeChannel")]
create_insecure_l2cap_le_channel( &mut self, callback: CallbackId, device: BluetoothDevice, psm: i32, ) -> SocketResult2207     fn create_insecure_l2cap_le_channel(
2208         &mut self,
2209         callback: CallbackId,
2210         device: BluetoothDevice,
2211         psm: i32,
2212     ) -> SocketResult {
2213         dbus_generated!()
2214     }
2215 
2216     #[dbus_method("CreateL2capChannel")]
create_l2cap_channel( &mut self, callback: CallbackId, device: BluetoothDevice, psm: i32, ) -> SocketResult2217     fn create_l2cap_channel(
2218         &mut self,
2219         callback: CallbackId,
2220         device: BluetoothDevice,
2221         psm: i32,
2222     ) -> SocketResult {
2223         dbus_generated!()
2224     }
2225 
2226     #[dbus_method("CreateL2capLeChannel")]
create_l2cap_le_channel( &mut self, callback: CallbackId, device: BluetoothDevice, psm: i32, ) -> SocketResult2227     fn create_l2cap_le_channel(
2228         &mut self,
2229         callback: CallbackId,
2230         device: BluetoothDevice,
2231         psm: i32,
2232     ) -> SocketResult {
2233         dbus_generated!()
2234     }
2235 
2236     #[dbus_method("CreateInsecureRfcommSocketToServiceRecord")]
create_insecure_rfcomm_socket_to_service_record( &mut self, callback: CallbackId, device: BluetoothDevice, uuid: Uuid, ) -> SocketResult2237     fn create_insecure_rfcomm_socket_to_service_record(
2238         &mut self,
2239         callback: CallbackId,
2240         device: BluetoothDevice,
2241         uuid: Uuid,
2242     ) -> SocketResult {
2243         dbus_generated!()
2244     }
2245 
2246     #[dbus_method("CreateRfcommSocketToServiceRecord")]
create_rfcomm_socket_to_service_record( &mut self, callback: CallbackId, device: BluetoothDevice, uuid: Uuid, ) -> SocketResult2247     fn create_rfcomm_socket_to_service_record(
2248         &mut self,
2249         callback: CallbackId,
2250         device: BluetoothDevice,
2251         uuid: Uuid,
2252     ) -> SocketResult {
2253         dbus_generated!()
2254     }
2255 
2256     #[dbus_method("Accept")]
accept(&mut self, callback: CallbackId, id: SocketId, timeout_ms: Option<u32>) -> BtStatus2257     fn accept(&mut self, callback: CallbackId, id: SocketId, timeout_ms: Option<u32>) -> BtStatus {
2258         dbus_generated!()
2259     }
2260 
2261     #[dbus_method("Close")]
close(&mut self, callback: CallbackId, id: SocketId) -> BtStatus2262     fn close(&mut self, callback: CallbackId, id: SocketId) -> BtStatus {
2263         dbus_generated!()
2264     }
2265 }
2266 
2267 struct IBluetoothSocketManagerCallbacksDBus {}
2268 
2269 impl RPCProxy for IBluetoothSocketManagerCallbacksDBus {}
2270 
2271 #[generate_dbus_exporter(
2272     export_socket_callback_dbus_intf,
2273     "org.chromium.bluetooth.SocketManagerCallback"
2274 )]
2275 impl IBluetoothSocketManagerCallbacks for IBluetoothSocketManagerCallbacksDBus {
2276     #[dbus_method("OnIncomingSocketReady", DBusLog::Disable)]
on_incoming_socket_ready(&mut self, socket: BluetoothServerSocket, status: BtStatus)2277     fn on_incoming_socket_ready(&mut self, socket: BluetoothServerSocket, status: BtStatus) {
2278         dbus_generated!()
2279     }
2280 
2281     #[dbus_method("OnIncomingSocketClosed", DBusLog::Disable)]
on_incoming_socket_closed(&mut self, listener_id: SocketId, reason: BtStatus)2282     fn on_incoming_socket_closed(&mut self, listener_id: SocketId, reason: BtStatus) {
2283         dbus_generated!()
2284     }
2285 
2286     #[dbus_method("OnHandleIncomingConnection", DBusLog::Disable)]
on_handle_incoming_connection( &mut self, listener_id: SocketId, connection: BluetoothSocket, )2287     fn on_handle_incoming_connection(
2288         &mut self,
2289         listener_id: SocketId,
2290         connection: BluetoothSocket,
2291     ) {
2292         dbus_generated!()
2293     }
2294 
2295     #[dbus_method("OnOutgoingConnectionResult", DBusLog::Disable)]
on_outgoing_connection_result( &mut self, connecting_id: SocketId, result: BtStatus, socket: Option<BluetoothSocket>, )2296     fn on_outgoing_connection_result(
2297         &mut self,
2298         connecting_id: SocketId,
2299         result: BtStatus,
2300         socket: Option<BluetoothSocket>,
2301     ) {
2302         dbus_generated!()
2303     }
2304 }
2305 
2306 pub(crate) struct SuspendDBus {
2307     client_proxy: ClientDBusProxy,
2308 }
2309 
2310 impl SuspendDBus {
new(conn: Arc<SyncConnection>, index: i32) -> SuspendDBus2311     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> SuspendDBus {
2312         SuspendDBus {
2313             client_proxy: ClientDBusProxy::new(
2314                 conn.clone(),
2315                 String::from("org.chromium.bluetooth"),
2316                 make_object_path(index, "adapter"),
2317                 String::from("org.chromium.bluetooth.Suspend"),
2318             ),
2319         }
2320     }
2321 }
2322 
2323 #[generate_dbus_interface_client]
2324 impl ISuspend for SuspendDBus {
2325     #[dbus_method("RegisterCallback")]
register_callback(&mut self, _callback: Box<dyn ISuspendCallback + Send>) -> bool2326     fn register_callback(&mut self, _callback: Box<dyn ISuspendCallback + Send>) -> bool {
2327         dbus_generated!()
2328     }
2329 
2330     #[dbus_method("UnregisterCallback")]
unregister_callback(&mut self, _callback_id: u32) -> bool2331     fn unregister_callback(&mut self, _callback_id: u32) -> bool {
2332         dbus_generated!()
2333     }
2334 
2335     #[dbus_method("Suspend")]
suspend(&mut self, _suspend_type: SuspendType, suspend_id: i32)2336     fn suspend(&mut self, _suspend_type: SuspendType, suspend_id: i32) {
2337         dbus_generated!()
2338     }
2339 
2340     #[dbus_method("Resume")]
resume(&mut self) -> bool2341     fn resume(&mut self) -> bool {
2342         dbus_generated!()
2343     }
2344 }
2345 
2346 struct ISuspendCallbackDBus {}
2347 
2348 impl RPCProxy for ISuspendCallbackDBus {}
2349 
2350 #[generate_dbus_exporter(
2351     export_suspend_callback_dbus_intf,
2352     "org.chromium.bluetooth.SuspendCallback"
2353 )]
2354 impl ISuspendCallback for ISuspendCallbackDBus {
2355     #[dbus_method("OnCallbackRegistered", DBusLog::Disable)]
on_callback_registered(&mut self, callback_id: u32)2356     fn on_callback_registered(&mut self, callback_id: u32) {}
2357     #[dbus_method("OnSuspendReady", DBusLog::Disable)]
on_suspend_ready(&mut self, suspend_id: i32)2358     fn on_suspend_ready(&mut self, suspend_id: i32) {}
2359     #[dbus_method("OnResumed", DBusLog::Disable)]
on_resumed(&mut self, suspend_id: i32)2360     fn on_resumed(&mut self, suspend_id: i32) {}
2361 }
2362 
2363 pub(crate) struct BluetoothTelephonyDBusRPC {
2364     client_proxy: ClientDBusProxy,
2365 }
2366 
2367 pub(crate) struct BluetoothTelephonyDBus {
2368     client_proxy: ClientDBusProxy,
2369     pub rpc: BluetoothTelephonyDBusRPC,
2370 }
2371 
2372 impl BluetoothTelephonyDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy2373     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
2374         ClientDBusProxy::new(
2375             conn.clone(),
2376             String::from("org.chromium.bluetooth"),
2377             make_object_path(index, "telephony"),
2378             String::from("org.chromium.bluetooth.BluetoothTelephony"),
2379         )
2380     }
2381 
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothTelephonyDBus2382     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothTelephonyDBus {
2383         BluetoothTelephonyDBus {
2384             client_proxy: Self::make_client_proxy(conn.clone(), index),
2385             rpc: BluetoothTelephonyDBusRPC {
2386                 client_proxy: Self::make_client_proxy(conn.clone(), index),
2387             },
2388         }
2389     }
2390 }
2391 
2392 #[generate_dbus_interface_client(BluetoothTelephonyDBusRPC)]
2393 impl IBluetoothTelephony for BluetoothTelephonyDBus {
2394     #[dbus_method("RegisterTelephonyCallback")]
register_telephony_callback( &mut self, callback: Box<dyn IBluetoothTelephonyCallback + Send>, ) -> bool2395     fn register_telephony_callback(
2396         &mut self,
2397         callback: Box<dyn IBluetoothTelephonyCallback + Send>,
2398     ) -> bool {
2399         dbus_generated!()
2400     }
2401 
2402     #[dbus_method("SetNetworkAvailable")]
set_network_available(&mut self, network_available: bool)2403     fn set_network_available(&mut self, network_available: bool) {
2404         dbus_generated!()
2405     }
2406     #[dbus_method("SetRoaming")]
set_roaming(&mut self, roaming: bool)2407     fn set_roaming(&mut self, roaming: bool) {
2408         dbus_generated!()
2409     }
2410     #[dbus_method("SetSignalStrength")]
set_signal_strength(&mut self, signal_strength: i32) -> bool2411     fn set_signal_strength(&mut self, signal_strength: i32) -> bool {
2412         dbus_generated!()
2413     }
2414     #[dbus_method("SetBatteryLevel")]
set_battery_level(&mut self, battery_level: i32) -> bool2415     fn set_battery_level(&mut self, battery_level: i32) -> bool {
2416         dbus_generated!()
2417     }
2418     #[dbus_method("SetPhoneOpsEnabled")]
set_phone_ops_enabled(&mut self, enable: bool)2419     fn set_phone_ops_enabled(&mut self, enable: bool) {
2420         dbus_generated!()
2421     }
2422     #[dbus_method("SetMpsQualificationEnabled")]
set_mps_qualification_enabled(&mut self, enable: bool)2423     fn set_mps_qualification_enabled(&mut self, enable: bool) {
2424         dbus_generated!()
2425     }
2426     #[dbus_method("IncomingCall")]
incoming_call(&mut self, number: String) -> bool2427     fn incoming_call(&mut self, number: String) -> bool {
2428         dbus_generated!()
2429     }
2430     #[dbus_method("DialingCall")]
dialing_call(&mut self, number: String) -> bool2431     fn dialing_call(&mut self, number: String) -> bool {
2432         dbus_generated!()
2433     }
2434     #[dbus_method("AnswerCall")]
answer_call(&mut self) -> bool2435     fn answer_call(&mut self) -> bool {
2436         dbus_generated!()
2437     }
2438     #[dbus_method("HangupCall")]
hangup_call(&mut self) -> bool2439     fn hangup_call(&mut self) -> bool {
2440         dbus_generated!()
2441     }
2442     #[dbus_method("SetMemoryCall")]
set_memory_call(&mut self, number: Option<String>) -> bool2443     fn set_memory_call(&mut self, number: Option<String>) -> bool {
2444         dbus_generated!()
2445     }
2446     #[dbus_method("SetLastCall")]
set_last_call(&mut self, number: Option<String>) -> bool2447     fn set_last_call(&mut self, number: Option<String>) -> bool {
2448         dbus_generated!()
2449     }
2450     #[dbus_method("ReleaseHeld")]
release_held(&mut self) -> bool2451     fn release_held(&mut self) -> bool {
2452         dbus_generated!()
2453     }
2454     #[dbus_method("ReleaseActiveAcceptHeld")]
release_active_accept_held(&mut self) -> bool2455     fn release_active_accept_held(&mut self) -> bool {
2456         dbus_generated!()
2457     }
2458     #[dbus_method("HoldActiveAcceptHeld")]
hold_active_accept_held(&mut self) -> bool2459     fn hold_active_accept_held(&mut self) -> bool {
2460         dbus_generated!()
2461     }
2462     #[dbus_method("AudioConnect")]
audio_connect(&mut self, address: RawAddress) -> bool2463     fn audio_connect(&mut self, address: RawAddress) -> bool {
2464         dbus_generated!()
2465     }
2466     #[dbus_method("AudioDisconnect")]
audio_disconnect(&mut self, address: RawAddress)2467     fn audio_disconnect(&mut self, address: RawAddress) {
2468         dbus_generated!()
2469     }
2470 }
2471 
2472 struct IBluetoothTelephonyCallbackDBus {}
2473 
2474 impl RPCProxy for IBluetoothTelephonyCallbackDBus {}
2475 
2476 #[generate_dbus_exporter(
2477     export_bluetooth_telephony_callback_dbus_intf,
2478     "org.chromium.bluetooth.BluetoothTelephonyCallback"
2479 )]
2480 impl IBluetoothTelephonyCallback for IBluetoothTelephonyCallbackDBus {
2481     #[dbus_method("OnTelephonyEvent")]
on_telephony_event(&mut self, addr: RawAddress, event: u8, call_state: u8)2482     fn on_telephony_event(&mut self, addr: RawAddress, event: u8, call_state: u8) {
2483         dbus_generated!()
2484     }
2485 }
2486 
2487 pub(crate) struct BluetoothQADBusRPC {
2488     client_proxy: ClientDBusProxy,
2489 }
2490 
2491 pub(crate) struct BluetoothQADBus {
2492     client_proxy: ClientDBusProxy,
2493     pub rpc: BluetoothQADBusRPC,
2494 }
2495 
2496 impl BluetoothQADBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy2497     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
2498         ClientDBusProxy::new(
2499             conn.clone(),
2500             String::from("org.chromium.bluetooth"),
2501             make_object_path(index, "qa"),
2502             String::from("org.chromium.bluetooth.BluetoothQA"),
2503         )
2504     }
2505 
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothQADBus2506     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothQADBus {
2507         BluetoothQADBus {
2508             client_proxy: Self::make_client_proxy(conn.clone(), index),
2509             rpc: BluetoothQADBusRPC { client_proxy: Self::make_client_proxy(conn.clone(), index) },
2510         }
2511     }
2512 }
2513 
2514 #[generate_dbus_interface_client(BluetoothQADBusRPC)]
2515 impl IBluetoothQA for BluetoothQADBus {
2516     #[dbus_method("RegisterQACallback")]
register_qa_callback(&mut self, callback: Box<dyn IBluetoothQACallback + Send>) -> u322517     fn register_qa_callback(&mut self, callback: Box<dyn IBluetoothQACallback + Send>) -> u32 {
2518         dbus_generated!()
2519     }
2520     #[dbus_method("UnregisterQACallback")]
unregister_qa_callback(&mut self, callback_id: u32) -> bool2521     fn unregister_qa_callback(&mut self, callback_id: u32) -> bool {
2522         dbus_generated!()
2523     }
2524     #[dbus_method("AddMediaPlayer")]
add_media_player(&self, name: String, browsing_supported: bool)2525     fn add_media_player(&self, name: String, browsing_supported: bool) {
2526         dbus_generated!()
2527     }
2528     #[dbus_method("RfcommSendMsc")]
rfcomm_send_msc(&self, dlci: u8, addr: RawAddress)2529     fn rfcomm_send_msc(&self, dlci: u8, addr: RawAddress) {
2530         dbus_generated!()
2531     }
2532     #[dbus_method("FetchDiscoverableMode")]
fetch_discoverable_mode(&self)2533     fn fetch_discoverable_mode(&self) {
2534         dbus_generated!()
2535     }
2536     #[dbus_method("FetchConnectable")]
fetch_connectable(&self)2537     fn fetch_connectable(&self) {
2538         dbus_generated!()
2539     }
2540     #[dbus_method("SetConnectable")]
set_connectable(&self, mode: bool)2541     fn set_connectable(&self, mode: bool) {
2542         dbus_generated!()
2543     }
2544     #[dbus_method("FetchAlias")]
fetch_alias(&self)2545     fn fetch_alias(&self) {
2546         dbus_generated!()
2547     }
2548     #[dbus_method("GetModalias")]
get_modalias(&self) -> String2549     fn get_modalias(&self) -> String {
2550         dbus_generated!()
2551     }
2552     #[dbus_method("GetHIDReport")]
get_hid_report(&self, addr: RawAddress, report_type: BthhReportType, report_id: u8)2553     fn get_hid_report(&self, addr: RawAddress, report_type: BthhReportType, report_id: u8) {
2554         dbus_generated!()
2555     }
2556     #[dbus_method("SetHIDReport")]
set_hid_report(&self, addr: RawAddress, report_type: BthhReportType, report: String)2557     fn set_hid_report(&self, addr: RawAddress, report_type: BthhReportType, report: String) {
2558         dbus_generated!()
2559     }
2560     #[dbus_method("SendHIDData")]
send_hid_data(&self, addr: RawAddress, data: String)2561     fn send_hid_data(&self, addr: RawAddress, data: String) {
2562         dbus_generated!()
2563     }
2564 }
2565 
2566 struct IBluetoothQACallbackDBus {}
2567 
2568 impl RPCProxy for IBluetoothQACallbackDBus {}
2569 
2570 #[generate_dbus_exporter(
2571     export_qa_callback_dbus_intf,
2572     "org.chromium.bluetooth.QACallback",
2573     DBusLog::Disable
2574 )]
2575 impl IBluetoothQACallback for IBluetoothQACallbackDBus {
2576     #[dbus_method("OnFetchDiscoverableModeComplete", DBusLog::Disable)]
on_fetch_discoverable_mode_completed(&mut self, disc_mode: BtDiscMode)2577     fn on_fetch_discoverable_mode_completed(&mut self, disc_mode: BtDiscMode) {
2578         dbus_generated!()
2579     }
2580     #[dbus_method("OnFetchConnectableComplete", DBusLog::Disable)]
on_fetch_connectable_completed(&mut self, connectable: bool)2581     fn on_fetch_connectable_completed(&mut self, connectable: bool) {
2582         dbus_generated!()
2583     }
2584     #[dbus_method("OnSetConnectableComplete", DBusLog::Disable)]
on_set_connectable_completed(&mut self, succeed: bool)2585     fn on_set_connectable_completed(&mut self, succeed: bool) {
2586         dbus_generated!()
2587     }
2588     #[dbus_method("OnFetchAliasComplete", DBusLog::Disable)]
on_fetch_alias_completed(&mut self, alias: String)2589     fn on_fetch_alias_completed(&mut self, alias: String) {
2590         dbus_generated!()
2591     }
2592     #[dbus_method("OnGetHIDReportComplete", DBusLog::Disable)]
on_get_hid_report_completed(&mut self, status: BtStatus)2593     fn on_get_hid_report_completed(&mut self, status: BtStatus) {
2594         dbus_generated!()
2595     }
2596     #[dbus_method("OnSetHIDReportComplete", DBusLog::Disable)]
on_set_hid_report_completed(&mut self, status: BtStatus)2597     fn on_set_hid_report_completed(&mut self, status: BtStatus) {
2598         dbus_generated!()
2599     }
2600     #[dbus_method("OnSendHIDDataComplete", DBusLog::Disable)]
on_send_hid_data_completed(&mut self, status: BtStatus)2601     fn on_send_hid_data_completed(&mut self, status: BtStatus) {
2602         dbus_generated!()
2603     }
2604 }
2605 
2606 pub(crate) struct BluetoothMediaDBusRPC {
2607     client_proxy: ClientDBusProxy,
2608 }
2609 
2610 pub(crate) struct BluetoothMediaDBus {
2611     client_proxy: ClientDBusProxy,
2612     pub rpc: BluetoothMediaDBusRPC,
2613 }
2614 
2615 impl BluetoothMediaDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy2616     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
2617         ClientDBusProxy::new(
2618             conn.clone(),
2619             String::from("org.chromium.bluetooth"),
2620             make_object_path(index, "media"),
2621             String::from("org.chromium.bluetooth.BluetoothMedia"),
2622         )
2623     }
2624 
new(conn: Arc<SyncConnection>, index: i32) -> BluetoothMediaDBus2625     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BluetoothMediaDBus {
2626         BluetoothMediaDBus {
2627             client_proxy: Self::make_client_proxy(conn.clone(), index),
2628             rpc: BluetoothMediaDBusRPC {
2629                 client_proxy: Self::make_client_proxy(conn.clone(), index),
2630             },
2631         }
2632     }
2633 }
2634 
2635 #[generate_dbus_interface_client(BluetoothMediaDBusRPC)]
2636 impl IBluetoothMedia for BluetoothMediaDBus {
2637     #[dbus_method("RegisterCallback")]
register_callback(&mut self, callback: Box<dyn IBluetoothMediaCallback + Send>) -> bool2638     fn register_callback(&mut self, callback: Box<dyn IBluetoothMediaCallback + Send>) -> bool {
2639         dbus_generated!()
2640     }
2641 
2642     #[dbus_method("Initialize")]
initialize(&mut self) -> bool2643     fn initialize(&mut self) -> bool {
2644         dbus_generated!()
2645     }
2646 
2647     #[dbus_method("Cleanup")]
cleanup(&mut self) -> bool2648     fn cleanup(&mut self) -> bool {
2649         dbus_generated!()
2650     }
2651 
2652     #[dbus_method("Connect")]
connect(&mut self, address: RawAddress)2653     fn connect(&mut self, address: RawAddress) {
2654         dbus_generated!()
2655     }
2656 
2657     #[dbus_method("Disconnect")]
disconnect(&mut self, address: RawAddress)2658     fn disconnect(&mut self, address: RawAddress) {
2659         dbus_generated!()
2660     }
2661 
2662     #[dbus_method("ConnectLeaGroupByMemberAddress")]
connect_lea_group_by_member_address(&mut self, address: RawAddress)2663     fn connect_lea_group_by_member_address(&mut self, address: RawAddress) {
2664         dbus_generated!()
2665     }
2666 
2667     #[dbus_method("DisconnectLeaGroupByMemberAddress")]
disconnect_lea_group_by_member_address(&mut self, address: RawAddress)2668     fn disconnect_lea_group_by_member_address(&mut self, address: RawAddress) {
2669         dbus_generated!()
2670     }
2671 
2672     #[dbus_method("ConnectLea")]
connect_lea(&mut self, address: RawAddress)2673     fn connect_lea(&mut self, address: RawAddress) {
2674         dbus_generated!()
2675     }
2676 
2677     #[dbus_method("DisconnectLea")]
disconnect_lea(&mut self, address: RawAddress)2678     fn disconnect_lea(&mut self, address: RawAddress) {
2679         dbus_generated!()
2680     }
2681 
2682     #[dbus_method("ConnectVc")]
connect_vc(&mut self, address: RawAddress)2683     fn connect_vc(&mut self, address: RawAddress) {
2684         dbus_generated!()
2685     }
2686 
2687     #[dbus_method("DisconnectVc")]
disconnect_vc(&mut self, address: RawAddress)2688     fn disconnect_vc(&mut self, address: RawAddress) {
2689         dbus_generated!()
2690     }
2691 
2692     #[dbus_method("ConnectCsis")]
connect_csis(&mut self, address: RawAddress)2693     fn connect_csis(&mut self, address: RawAddress) {
2694         dbus_generated!()
2695     }
2696 
2697     #[dbus_method("DisconnectCsis")]
disconnect_csis(&mut self, address: RawAddress)2698     fn disconnect_csis(&mut self, address: RawAddress) {
2699         dbus_generated!()
2700     }
2701 
2702     #[dbus_method("SetActiveDevice")]
set_active_device(&mut self, address: RawAddress)2703     fn set_active_device(&mut self, address: RawAddress) {
2704         dbus_generated!()
2705     }
2706 
2707     #[dbus_method("ResetActiveDevice")]
reset_active_device(&mut self)2708     fn reset_active_device(&mut self) {
2709         dbus_generated!()
2710     }
2711 
2712     #[dbus_method("SetHfpActiveDevice")]
set_hfp_active_device(&mut self, address: RawAddress)2713     fn set_hfp_active_device(&mut self, address: RawAddress) {
2714         dbus_generated!()
2715     }
2716 
2717     #[dbus_method("SetAudioConfig")]
set_audio_config( &mut self, address: RawAddress, codec_type: A2dpCodecIndex, sample_rate: A2dpCodecSampleRate, bits_per_sample: A2dpCodecBitsPerSample, channel_mode: A2dpCodecChannelMode, ) -> bool2718     fn set_audio_config(
2719         &mut self,
2720         address: RawAddress,
2721         codec_type: A2dpCodecIndex,
2722         sample_rate: A2dpCodecSampleRate,
2723         bits_per_sample: A2dpCodecBitsPerSample,
2724         channel_mode: A2dpCodecChannelMode,
2725     ) -> bool {
2726         dbus_generated!()
2727     }
2728 
2729     #[dbus_method("SetVolume")]
set_volume(&mut self, volume: u8)2730     fn set_volume(&mut self, volume: u8) {
2731         dbus_generated!()
2732     }
2733 
2734     #[dbus_method("SetHfpVolume")]
set_hfp_volume(&mut self, volume: u8, address: RawAddress)2735     fn set_hfp_volume(&mut self, volume: u8, address: RawAddress) {
2736         dbus_generated!()
2737     }
2738 
2739     #[dbus_method("StartAudioRequest")]
start_audio_request(&mut self) -> bool2740     fn start_audio_request(&mut self) -> bool {
2741         dbus_generated!()
2742     }
2743 
2744     #[dbus_method("GetA2dpAudioStarted")]
get_a2dp_audio_started(&mut self, address: RawAddress) -> bool2745     fn get_a2dp_audio_started(&mut self, address: RawAddress) -> bool {
2746         dbus_generated!()
2747     }
2748 
2749     #[dbus_method("StopAudioRequest")]
stop_audio_request(&mut self)2750     fn stop_audio_request(&mut self) {
2751         dbus_generated!()
2752     }
2753 
2754     #[dbus_method("StartScoCall")]
start_sco_call( &mut self, address: RawAddress, sco_offload: bool, disabled_codecs: HfpCodecBitId, ) -> bool2755     fn start_sco_call(
2756         &mut self,
2757         address: RawAddress,
2758         sco_offload: bool,
2759         disabled_codecs: HfpCodecBitId,
2760     ) -> bool {
2761         dbus_generated!()
2762     }
2763 
2764     #[dbus_method("GetHfpAudioFinalCodecs")]
get_hfp_audio_final_codecs(&mut self, address: RawAddress) -> u82765     fn get_hfp_audio_final_codecs(&mut self, address: RawAddress) -> u8 {
2766         dbus_generated!()
2767     }
2768 
2769     #[dbus_method("StopScoCall")]
stop_sco_call(&mut self, address: RawAddress)2770     fn stop_sco_call(&mut self, address: RawAddress) {
2771         dbus_generated!()
2772     }
2773 
2774     #[dbus_method("GetPresentationPosition")]
get_presentation_position(&mut self) -> PresentationPosition2775     fn get_presentation_position(&mut self) -> PresentationPosition {
2776         dbus_generated!()
2777     }
2778 
2779     // Temporary AVRCP-related meida DBUS APIs. The following APIs intercept between Chrome CRAS
2780     // and cras_server as an expedited solution for AVRCP implementation. The APIs are subject to
2781     // change when retiring Chrome CRAS.
2782     #[dbus_method("SetPlayerPlaybackStatus")]
set_player_playback_status(&mut self, status: String)2783     fn set_player_playback_status(&mut self, status: String) {
2784         dbus_generated!()
2785     }
2786 
2787     #[dbus_method("SetPlayerPosition")]
set_player_position(&mut self, position_us: i64)2788     fn set_player_position(&mut self, position_us: i64) {
2789         dbus_generated!()
2790     }
2791 
2792     #[dbus_method("SetPlayerMetadata")]
set_player_metadata(&mut self, metadata: PlayerMetadata)2793     fn set_player_metadata(&mut self, metadata: PlayerMetadata) {
2794         dbus_generated!()
2795     }
2796 
2797     #[dbus_method("TriggerDebugDump")]
trigger_debug_dump(&mut self)2798     fn trigger_debug_dump(&mut self) {
2799         dbus_generated!()
2800     }
2801 
2802     #[dbus_method("GroupSetActive")]
group_set_active(&mut self, group_id: i32)2803     fn group_set_active(&mut self, group_id: i32) {
2804         dbus_generated!()
2805     }
2806 
2807     #[dbus_method("HostStartAudioRequest")]
host_start_audio_request(&mut self) -> bool2808     fn host_start_audio_request(&mut self) -> bool {
2809         dbus_generated!()
2810     }
2811 
2812     #[dbus_method("HostStopAudioRequest")]
host_stop_audio_request(&mut self)2813     fn host_stop_audio_request(&mut self) {
2814         dbus_generated!()
2815     }
2816 
2817     #[dbus_method("PeerStartAudioRequest")]
peer_start_audio_request(&mut self) -> bool2818     fn peer_start_audio_request(&mut self) -> bool {
2819         dbus_generated!()
2820     }
2821 
2822     #[dbus_method("PeerStopAudioRequest")]
peer_stop_audio_request(&mut self)2823     fn peer_stop_audio_request(&mut self) {
2824         dbus_generated!()
2825     }
2826 
2827     #[dbus_method("GetHostPcmConfig")]
get_host_pcm_config(&mut self) -> BtLePcmConfig2828     fn get_host_pcm_config(&mut self) -> BtLePcmConfig {
2829         dbus_generated!()
2830     }
2831 
2832     #[dbus_method("GetPeerPcmConfig")]
get_peer_pcm_config(&mut self) -> BtLePcmConfig2833     fn get_peer_pcm_config(&mut self) -> BtLePcmConfig {
2834         dbus_generated!()
2835     }
2836 
2837     #[dbus_method("GetHostStreamStarted")]
get_host_stream_started(&mut self) -> BtLeStreamStartedStatus2838     fn get_host_stream_started(&mut self) -> BtLeStreamStartedStatus {
2839         dbus_generated!()
2840     }
2841 
2842     #[dbus_method("GetPeerStreamStarted")]
get_peer_stream_started(&mut self) -> BtLeStreamStartedStatus2843     fn get_peer_stream_started(&mut self) -> BtLeStreamStartedStatus {
2844         dbus_generated!()
2845     }
2846 
2847     #[dbus_method("SourceMetadataChanged")]
source_metadata_changed( &mut self, usage: BtLeAudioUsage, content_type: BtLeAudioContentType, gain: f64, ) -> bool2848     fn source_metadata_changed(
2849         &mut self,
2850         usage: BtLeAudioUsage,
2851         content_type: BtLeAudioContentType,
2852         gain: f64,
2853     ) -> bool {
2854         dbus_generated!()
2855     }
2856 
2857     #[dbus_method("SinkMetadataChanged")]
sink_metadata_changed(&mut self, source: BtLeAudioSource, gain: f64) -> bool2858     fn sink_metadata_changed(&mut self, source: BtLeAudioSource, gain: f64) -> bool {
2859         dbus_generated!()
2860     }
2861 
2862     #[dbus_method("GetUnicastMonitorModeStatus")]
get_unicast_monitor_mode_status( &mut self, direction: BtLeAudioDirection, ) -> BtLeAudioUnicastMonitorModeStatus2863     fn get_unicast_monitor_mode_status(
2864         &mut self,
2865         direction: BtLeAudioDirection,
2866     ) -> BtLeAudioUnicastMonitorModeStatus {
2867         dbus_generated!()
2868     }
2869 
2870     #[dbus_method("GetGroupStreamStatus")]
get_group_stream_status(&mut self, group_id: i32) -> BtLeAudioGroupStreamStatus2871     fn get_group_stream_status(&mut self, group_id: i32) -> BtLeAudioGroupStreamStatus {
2872         dbus_generated!()
2873     }
2874 
2875     #[dbus_method("GetGroupStatus")]
get_group_status(&mut self, group_id: i32) -> BtLeAudioGroupStatus2876     fn get_group_status(&mut self, group_id: i32) -> BtLeAudioGroupStatus {
2877         dbus_generated!()
2878     }
2879 
2880     #[dbus_method("SetGroupVolume")]
set_group_volume(&mut self, group_id: i32, volume: u8)2881     fn set_group_volume(&mut self, group_id: i32, volume: u8) {
2882         dbus_generated!()
2883     }
2884 }
2885 
2886 struct IBluetoothMediaCallbackDBus {}
2887 
2888 impl RPCProxy for IBluetoothMediaCallbackDBus {}
2889 
2890 #[generate_dbus_exporter(
2891     export_bluetooth_media_callback_dbus_intf,
2892     "org.chromium.bluetooth.BluetoothMediaCallback"
2893 )]
2894 impl IBluetoothMediaCallback for IBluetoothMediaCallbackDBus {
2895     #[dbus_method("OnBluetoothAudioDeviceAdded", DBusLog::Disable)]
on_bluetooth_audio_device_added(&mut self, device: BluetoothAudioDevice)2896     fn on_bluetooth_audio_device_added(&mut self, device: BluetoothAudioDevice) {}
2897 
2898     #[dbus_method("OnBluetoothAudioDeviceRemoved", DBusLog::Disable)]
on_bluetooth_audio_device_removed(&mut self, addr: RawAddress)2899     fn on_bluetooth_audio_device_removed(&mut self, addr: RawAddress) {}
2900 
2901     #[dbus_method("OnAbsoluteVolumeSupportedChanged", DBusLog::Disable)]
on_absolute_volume_supported_changed(&mut self, supported: bool)2902     fn on_absolute_volume_supported_changed(&mut self, supported: bool) {}
2903 
2904     #[dbus_method("OnAbsoluteVolumeChanged", DBusLog::Disable)]
on_absolute_volume_changed(&mut self, volume: u8)2905     fn on_absolute_volume_changed(&mut self, volume: u8) {}
2906 
2907     #[dbus_method("OnHfpVolumeChanged", DBusLog::Disable)]
on_hfp_volume_changed(&mut self, volume: u8, addr: RawAddress)2908     fn on_hfp_volume_changed(&mut self, volume: u8, addr: RawAddress) {}
2909 
2910     #[dbus_method("OnHfpAudioDisconnected", DBusLog::Disable)]
on_hfp_audio_disconnected(&mut self, addr: RawAddress)2911     fn on_hfp_audio_disconnected(&mut self, addr: RawAddress) {}
2912 
2913     #[dbus_method("OnHfpDebugDump", DBusLog::Disable)]
on_hfp_debug_dump( &mut self, active: bool, codec_id: u16, total_num_decoded_frames: i32, pkt_loss_ratio: f64, begin_ts: u64, end_ts: u64, pkt_status_in_hex: String, pkt_status_in_binary: String, )2914     fn on_hfp_debug_dump(
2915         &mut self,
2916         active: bool,
2917         codec_id: u16,
2918         total_num_decoded_frames: i32,
2919         pkt_loss_ratio: f64,
2920         begin_ts: u64,
2921         end_ts: u64,
2922         pkt_status_in_hex: String,
2923         pkt_status_in_binary: String,
2924     ) {
2925     }
2926 
2927     #[dbus_method("OnLeaGroupConnected")]
on_lea_group_connected(&mut self, group_id: i32, name: String)2928     fn on_lea_group_connected(&mut self, group_id: i32, name: String) {}
2929 
2930     #[dbus_method("OnLeaGroupDisconnected")]
on_lea_group_disconnected(&mut self, group_id: i32)2931     fn on_lea_group_disconnected(&mut self, group_id: i32) {}
2932 
2933     #[dbus_method("OnLeaGroupStatus")]
on_lea_group_status(&mut self, group_id: i32, status: BtLeAudioGroupStatus)2934     fn on_lea_group_status(&mut self, group_id: i32, status: BtLeAudioGroupStatus) {}
2935 
2936     #[dbus_method("OnLeaGroupNodeStatus")]
on_lea_group_node_status( &mut self, addr: RawAddress, group_id: i32, status: BtLeAudioGroupNodeStatus, )2937     fn on_lea_group_node_status(
2938         &mut self,
2939         addr: RawAddress,
2940         group_id: i32,
2941         status: BtLeAudioGroupNodeStatus,
2942     ) {
2943     }
2944 
2945     #[dbus_method("OnLeaAudioConf")]
on_lea_audio_conf( &mut self, direction: u8, group_id: i32, snk_audio_location: u32, src_audio_location: u32, avail_cont: u16, )2946     fn on_lea_audio_conf(
2947         &mut self,
2948         direction: u8,
2949         group_id: i32,
2950         snk_audio_location: u32,
2951         src_audio_location: u32,
2952         avail_cont: u16,
2953     ) {
2954     }
2955 
2956     #[dbus_method("OnLeaUnicastMonitorModeStatus")]
on_lea_unicast_monitor_mode_status( &mut self, direction: BtLeAudioDirection, status: BtLeAudioUnicastMonitorModeStatus, )2957     fn on_lea_unicast_monitor_mode_status(
2958         &mut self,
2959         direction: BtLeAudioDirection,
2960         status: BtLeAudioUnicastMonitorModeStatus,
2961     ) {
2962     }
2963 
2964     #[dbus_method("OnLeaGroupStreamStatus")]
on_lea_group_stream_status(&mut self, group_id: i32, status: BtLeAudioGroupStreamStatus)2965     fn on_lea_group_stream_status(&mut self, group_id: i32, status: BtLeAudioGroupStreamStatus) {}
2966 
2967     #[dbus_method("OnLeaVcConnected")]
on_lea_vc_connected(&mut self, addr: RawAddress, group_id: i32)2968     fn on_lea_vc_connected(&mut self, addr: RawAddress, group_id: i32) {}
2969 
2970     #[dbus_method("OnLeaGroupVolumeChanged")]
on_lea_group_volume_changed(&mut self, group_id: i32, volume: u8)2971     fn on_lea_group_volume_changed(&mut self, group_id: i32, volume: u8) {}
2972 }
2973 
2974 pub(crate) struct BatteryManagerDBusRPC {
2975     client_proxy: ClientDBusProxy,
2976 }
2977 
2978 pub(crate) struct BatteryManagerDBus {
2979     client_proxy: ClientDBusProxy,
2980     pub rpc: BatteryManagerDBusRPC,
2981 }
2982 
2983 impl BatteryManagerDBus {
make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy2984     fn make_client_proxy(conn: Arc<SyncConnection>, index: i32) -> ClientDBusProxy {
2985         ClientDBusProxy::new(
2986             conn.clone(),
2987             String::from("org.chromium.bluetooth"),
2988             make_object_path(index, "battery_manager"),
2989             String::from("org.chromium.bluetooth.BatteryManager"),
2990         )
2991     }
2992 
new(conn: Arc<SyncConnection>, index: i32) -> BatteryManagerDBus2993     pub(crate) fn new(conn: Arc<SyncConnection>, index: i32) -> BatteryManagerDBus {
2994         BatteryManagerDBus {
2995             client_proxy: Self::make_client_proxy(conn.clone(), index),
2996             rpc: BatteryManagerDBusRPC {
2997                 client_proxy: Self::make_client_proxy(conn.clone(), index),
2998             },
2999         }
3000     }
3001 }
3002 
3003 #[generate_dbus_interface_client(BatteryManagerDBusRPC)]
3004 impl IBatteryManager for BatteryManagerDBus {
3005     #[dbus_method("RegisterBatteryCallback")]
register_battery_callback( &mut self, battery_manager_callback: Box<dyn IBatteryManagerCallback + Send>, ) -> u323006     fn register_battery_callback(
3007         &mut self,
3008         battery_manager_callback: Box<dyn IBatteryManagerCallback + Send>,
3009     ) -> u32 {
3010         dbus_generated!()
3011     }
3012 
3013     #[dbus_method("UnregisterBatteryCallback")]
unregister_battery_callback(&mut self, callback_id: u32) -> bool3014     fn unregister_battery_callback(&mut self, callback_id: u32) -> bool {
3015         dbus_generated!()
3016     }
3017 
3018     #[dbus_method("GetBatteryInformation")]
get_battery_information(&self, remote_address: RawAddress) -> Option<BatterySet>3019     fn get_battery_information(&self, remote_address: RawAddress) -> Option<BatterySet> {
3020         dbus_generated!()
3021     }
3022 }
3023 
3024 #[dbus_propmap(BatterySet)]
3025 pub struct BatterySetDBus {
3026     address: RawAddress,
3027     source_uuid: String,
3028     source_info: String,
3029     batteries: Vec<Battery>,
3030 }
3031 
3032 #[dbus_propmap(Battery)]
3033 pub struct BatteryDBus {
3034     percentage: u32,
3035     variant: String,
3036 }
3037 
3038 struct IBatteryManagerCallbackDBus {}
3039 
3040 impl RPCProxy for IBatteryManagerCallbackDBus {}
3041 
3042 #[generate_dbus_exporter(
3043     export_battery_manager_callback_dbus_intf,
3044     "org.chromium.bluetooth.BatteryManagerCallback"
3045 )]
3046 impl IBatteryManagerCallback for IBatteryManagerCallbackDBus {
3047     #[dbus_method("OnBatteryInfoUpdated")]
on_battery_info_updated(&mut self, remote_address: RawAddress, battery_set: BatterySet)3048     fn on_battery_info_updated(&mut self, remote_address: RawAddress, battery_set: BatterySet) {}
3049 }
3050