ReSet_Lib/bluetooth/
bluetooth_signals.rs1#[allow(unused_imports)]
3use dbus::arg;
4use dbus::blocking;
5use dbus::{self};
6
7pub trait OrgFreedesktopDBusIntrospectable {
8 fn introspect(&self) -> Result<String, dbus::Error>;
9}
10
11impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>>
12 OrgFreedesktopDBusIntrospectable for blocking::Proxy<'a, C>
13{
14 fn introspect(&self) -> Result<String, dbus::Error> {
15 self.method_call("org.freedesktop.DBus.Introspectable", "Introspect", ())
16 .map(|r: (String,)| r.0)
17 }
18}
19
20pub trait OrgFreedesktopDBusObjectManager {
21 fn get_managed_objects(
22 &self,
23 ) -> Result<
24 ::std::collections::HashMap<
25 dbus::Path<'static>,
26 ::std::collections::HashMap<String, arg::PropMap>,
27 >,
28 dbus::Error,
29 >;
30}
31
32#[derive(Debug)]
33pub struct BluetoothDeviceAdded {
34 pub object: dbus::Path<'static>,
35 pub interfaces: ::std::collections::HashMap<String, arg::PropMap>,
36}
37
38impl arg::AppendAll for BluetoothDeviceAdded {
39 fn append(&self, i: &mut arg::IterAppend) {
40 arg::RefArg::append(&self.object, i);
41 arg::RefArg::append(&self.interfaces, i);
42 }
43}
44
45impl arg::ReadAll for BluetoothDeviceAdded {
46 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
47 Ok(BluetoothDeviceAdded {
48 object: i.read()?,
49 interfaces: i.read()?,
50 })
51 }
52}
53
54impl dbus::message::SignalArgs for BluetoothDeviceAdded {
55 const NAME: &'static str = "InterfacesAdded";
56 const INTERFACE: &'static str = "org.freedesktop.DBus.ObjectManager";
57}
58
59#[derive(Debug)]
60pub struct BluetoothDeviceRemoved {
61 pub object: dbus::Path<'static>,
62 pub interfaces: Vec<String>,
63}
64
65impl arg::AppendAll for BluetoothDeviceRemoved {
66 fn append(&self, i: &mut arg::IterAppend) {
67 arg::RefArg::append(&self.object, i);
68 arg::RefArg::append(&self.interfaces, i);
69 }
70}
71
72impl arg::ReadAll for BluetoothDeviceRemoved {
73 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
74 Ok(BluetoothDeviceRemoved {
75 object: i.read()?,
76 interfaces: i.read()?,
77 })
78 }
79}
80
81impl dbus::message::SignalArgs for BluetoothDeviceRemoved {
82 const NAME: &'static str = "InterfacesRemoved";
83 const INTERFACE: &'static str = "org.freedesktop.DBus.ObjectManager";
84}
85
86impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>>
87 OrgFreedesktopDBusObjectManager for blocking::Proxy<'a, C>
88{
89 fn get_managed_objects(
90 &self,
91 ) -> Result<
92 ::std::collections::HashMap<
93 dbus::Path<'static>,
94 ::std::collections::HashMap<String, arg::PropMap>,
95 >,
96 dbus::Error,
97 > {
98 self.method_call(
99 "org.freedesktop.DBus.ObjectManager",
100 "GetManagedObjects",
101 (),
102 )
103 .map(
104 |r: (
105 ::std::collections::HashMap<
106 dbus::Path<'static>,
107 ::std::collections::HashMap<String, arg::PropMap>,
108 >,
109 )| r.0,
110 )
111 }
112}