1 extern crate bt_shim;
2 
3 use btstack::bluetooth::{IBluetooth, IBluetoothCallback};
4 use btstack::RPCProxy;
5 
6 use dbus::nonblock::SyncConnection;
7 use dbus::strings::{BusName, Path};
8 
9 use dbus_macros::{dbus_method, dbus_proxy_obj, generate_dbus_exporter};
10 
11 use dbus_projection::DisconnectWatcher;
12 
13 use std::error::Error;
14 use std::sync::Arc;
15 use std::sync::Mutex;
16 
17 use crate::dbus_arg::DBusArg;
18 
19 #[allow(dead_code)]
20 struct BluetoothCallbackDBus {}
21 
22 #[dbus_proxy_obj(BluetoothCallback, "org.chromium.bluetooth.BluetoothCallback")]
23 impl IBluetoothCallback for BluetoothCallbackDBus {
24     #[dbus_method("OnBluetoothStateChange")]
on_bluetooth_state_changed(&self, prev_state: u32, new_state: u32)25     fn on_bluetooth_state_changed(&self, prev_state: u32, new_state: u32) {}
26     #[dbus_method("OnBluetoothAddressChanged")]
on_bluetooth_address_changed(&self, addr: String)27     fn on_bluetooth_address_changed(&self, addr: String) {}
28 }
29 
30 #[allow(dead_code)]
31 struct IBluetoothDBus {}
32 
33 #[generate_dbus_exporter(export_bluetooth_dbus_obj, "org.chromium.bluetooth.Bluetooth")]
34 impl IBluetooth for IBluetoothDBus {
35     #[dbus_method("RegisterCallback")]
register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>)36     fn register_callback(&mut self, callback: Box<dyn IBluetoothCallback + Send>) {}
37 
38     #[dbus_method("Enable")]
enable(&mut self) -> bool39     fn enable(&mut self) -> bool {
40         false
41     }
42     #[dbus_method("Disable")]
disable(&mut self) -> bool43     fn disable(&mut self) -> bool {
44         false
45     }
46 
47     #[dbus_method("GetAddress")]
get_address(&self) -> String48     fn get_address(&self) -> String {
49         String::from("")
50     }
51 }
52