1 | // This code was autogenerated with `dbus-codegen-rust -m none -c blocking -g -i org.freedesktop.DBus --dbuscrate crate --file ./data/standard_interfaces.xml -o ../dbus/src/blocking/generated_org_freedesktop_standard_interfaces.rs`, see https://github.com/diwic/dbus-rs |
2 | use crate as dbus; |
3 | #[allow (unused_imports)] |
4 | use crate::arg; |
5 | use crate::blocking; |
6 | |
7 | pub trait Properties { |
8 | fn get<R0: for<'b> dynarg::Get<'b> + 'static>(&self, interface_name: &str, property_name: &str) -> Result<R0, dbus::Error>; |
9 | fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error>; |
10 | fn set<I2: arg::Arg + arg::Append>(&self, interface_name: &str, property_name: &str, value: I2) -> Result<(), dbus::Error>; |
11 | } |
12 | |
13 | impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> Properties for blocking::Proxy<'a, C> { |
14 | |
15 | fn get<R0: for<'b> dynarg::Get<'b> + 'static>(&self, interface_name: &str, property_name: &str) -> Result<R0, dbus::Error> { |
16 | self.method_call("org.freedesktop.DBus.Properties" , "Get" , (interface_name, property_name, )) |
17 | .and_then(|r: (arg::Variant<R0>, )| Ok((r.0).0, )) |
18 | } |
19 | |
20 | fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error> { |
21 | self.method_call("org.freedesktop.DBus.Properties" , "GetAll" , (interface_name, )) |
22 | .and_then(|r: (arg::PropMap, )| Ok(r.0, )) |
23 | } |
24 | |
25 | fn set<I2: arg::Arg + arg::Append>(&self, interface_name: &str, property_name: &str, value: I2) -> Result<(), dbus::Error> { |
26 | self.method_call(i:"org.freedesktop.DBus.Properties" , m:"Set" , (interface_name, property_name, arg::Variant(value), )) |
27 | } |
28 | } |
29 | |
30 | #[derive (Debug)] |
31 | pub struct PropertiesPropertiesChanged { |
32 | pub interface_name: String, |
33 | pub changed_properties: arg::PropMap, |
34 | pub invalidated_properties: Vec<String>, |
35 | } |
36 | |
37 | impl arg::AppendAll for PropertiesPropertiesChanged { |
38 | fn append(&self, i: &mut arg::IterAppend) { |
39 | arg::RefArg::append(&self.interface_name, i); |
40 | arg::RefArg::append(&self.changed_properties, i); |
41 | arg::RefArg::append(&self.invalidated_properties, i); |
42 | } |
43 | } |
44 | |
45 | impl arg::ReadAll for PropertiesPropertiesChanged { |
46 | fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> { |
47 | Ok(PropertiesPropertiesChanged { |
48 | interface_name: i.read()?, |
49 | changed_properties: i.read()?, |
50 | invalidated_properties: i.read()?, |
51 | }) |
52 | } |
53 | } |
54 | |
55 | impl dbus::message::SignalArgs for PropertiesPropertiesChanged { |
56 | const NAME: &'static str = "PropertiesChanged" ; |
57 | const INTERFACE: &'static str = "org.freedesktop.DBus.Properties" ; |
58 | } |
59 | |
60 | pub trait Introspectable { |
61 | fn introspect(&self) -> Result<String, dbus::Error>; |
62 | } |
63 | |
64 | impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> Introspectable for blocking::Proxy<'a, C> { |
65 | |
66 | fn introspect(&self) -> Result<String, dbus::Error> { |
67 | self.method_call("org.freedesktop.DBus.Introspectable" , "Introspect" , ()) |
68 | .and_then(|r: (String, )| Ok(r.0, )) |
69 | } |
70 | } |
71 | |
72 | pub trait Peer { |
73 | fn ping(&self) -> Result<(), dbus::Error>; |
74 | fn get_machine_id(&self) -> Result<String, dbus::Error>; |
75 | } |
76 | |
77 | impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> Peer for blocking::Proxy<'a, C> { |
78 | |
79 | fn ping(&self) -> Result<(), dbus::Error> { |
80 | self.method_call(i:"org.freedesktop.DBus.Peer" , m:"Ping" , ()) |
81 | } |
82 | |
83 | fn get_machine_id(&self) -> Result<String, dbus::Error> { |
84 | self.method_call("org.freedesktop.DBus.Peer" , "GetMachineId" , ()) |
85 | .and_then(|r: (String, )| Ok(r.0, )) |
86 | } |
87 | } |
88 | |
89 | pub trait ObjectManager { |
90 | fn get_managed_objects(&self) -> Result<::std::collections::HashMap<dbus::Path<'static>, ::std::collections::HashMap<String, arg::PropMap>>, dbus::Error>; |
91 | } |
92 | |
93 | impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> ObjectManager for blocking::Proxy<'a, C> { |
94 | |
95 | fn get_managed_objects(&self) -> Result<::std::collections::HashMap<dbus::Path<'static>, ::std::collections::HashMap<String, arg::PropMap>>, dbus::Error> { |
96 | self.method_call("org.freedesktop.DBus.ObjectManager" , "GetManagedObjects" , ()) |
97 | .and_then(|r: (::std::collections::HashMap<dbus::Path<'static>, ::std::collections::HashMap<String, arg::PropMap>>, )| Ok(r.0, )) |
98 | } |
99 | } |
100 | |
101 | #[derive (Debug)] |
102 | pub struct ObjectManagerInterfacesAdded { |
103 | pub object: dbus::Path<'static>, |
104 | pub interfaces: ::std::collections::HashMap<String, arg::PropMap>, |
105 | } |
106 | |
107 | impl arg::AppendAll for ObjectManagerInterfacesAdded { |
108 | fn append(&self, i: &mut arg::IterAppend) { |
109 | arg::RefArg::append(&self.object, i); |
110 | arg::RefArg::append(&self.interfaces, i); |
111 | } |
112 | } |
113 | |
114 | impl arg::ReadAll for ObjectManagerInterfacesAdded { |
115 | fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> { |
116 | Ok(ObjectManagerInterfacesAdded { |
117 | object: i.read()?, |
118 | interfaces: i.read()?, |
119 | }) |
120 | } |
121 | } |
122 | |
123 | impl dbus::message::SignalArgs for ObjectManagerInterfacesAdded { |
124 | const NAME: &'static str = "InterfacesAdded" ; |
125 | const INTERFACE: &'static str = "org.freedesktop.DBus.ObjectManager" ; |
126 | } |
127 | |
128 | #[derive (Debug)] |
129 | pub struct ObjectManagerInterfacesRemoved { |
130 | pub object: dbus::Path<'static>, |
131 | pub interfaces: Vec<String>, |
132 | } |
133 | |
134 | impl arg::AppendAll for ObjectManagerInterfacesRemoved { |
135 | fn append(&self, i: &mut arg::IterAppend) { |
136 | arg::RefArg::append(&self.object, i); |
137 | arg::RefArg::append(&self.interfaces, i); |
138 | } |
139 | } |
140 | |
141 | impl arg::ReadAll for ObjectManagerInterfacesRemoved { |
142 | fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> { |
143 | Ok(ObjectManagerInterfacesRemoved { |
144 | object: i.read()?, |
145 | interfaces: i.read()?, |
146 | }) |
147 | } |
148 | } |
149 | |
150 | impl dbus::message::SignalArgs for ObjectManagerInterfacesRemoved { |
151 | const NAME: &'static str = "InterfacesRemoved" ; |
152 | const INTERFACE: &'static str = "org.freedesktop.DBus.ObjectManager" ; |
153 | } |
154 | |