1#[allow(unused_imports)]
3use dbus::arg;
4use dbus::nonblock;
5
6pub trait OrgBluezAdapter1 {
7 fn start_discovery(&self) -> nonblock::MethodReply<()>;
8 fn set_discovery_filter(&self, properties: arg::PropMap) -> nonblock::MethodReply<()>;
9 fn stop_discovery(&self) -> nonblock::MethodReply<()>;
10 fn remove_device(&self, device: dbus::Path) -> nonblock::MethodReply<()>;
11 fn get_discovery_filters(&self) -> nonblock::MethodReply<Vec<String>>;
12 fn address(&self) -> nonblock::MethodReply<String>;
13 fn address_type(&self) -> nonblock::MethodReply<String>;
14 fn name(&self) -> nonblock::MethodReply<String>;
15 fn alias(&self) -> nonblock::MethodReply<String>;
16 fn set_alias(&self, value: String) -> nonblock::MethodReply<()>;
17 fn class(&self) -> nonblock::MethodReply<u32>;
18 fn powered(&self) -> nonblock::MethodReply<bool>;
19 fn set_powered(&self, value: bool) -> nonblock::MethodReply<()>;
20 fn power_state(&self) -> nonblock::MethodReply<String>;
21 fn discoverable(&self) -> nonblock::MethodReply<bool>;
22 fn set_discoverable(&self, value: bool) -> nonblock::MethodReply<()>;
23 fn discoverable_timeout(&self) -> nonblock::MethodReply<u32>;
24 fn set_discoverable_timeout(&self, value: u32) -> nonblock::MethodReply<()>;
25 fn pairable(&self) -> nonblock::MethodReply<bool>;
26 fn set_pairable(&self, value: bool) -> nonblock::MethodReply<()>;
27 fn pairable_timeout(&self) -> nonblock::MethodReply<u32>;
28 fn set_pairable_timeout(&self, value: u32) -> nonblock::MethodReply<()>;
29 fn discovering(&self) -> nonblock::MethodReply<bool>;
30 fn uuids(&self) -> nonblock::MethodReply<Vec<String>>;
31 fn modalias(&self) -> nonblock::MethodReply<String>;
32 fn roles(&self) -> nonblock::MethodReply<Vec<String>>;
33 fn experimental_features(&self) -> nonblock::MethodReply<Vec<String>>;
34}
35
36pub const ORG_BLUEZ_ADAPTER1_NAME: &str = "org.bluez.Adapter1";
37
38#[derive(Copy, Clone, Debug)]
39pub struct OrgBluezAdapter1Properties<'a>(pub &'a arg::PropMap);
40
41impl<'a> OrgBluezAdapter1Properties<'a> {
42 pub fn from_interfaces(
43 interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
44 ) -> Option<Self> {
45 interfaces.get("org.bluez.Adapter1").map(Self)
46 }
47
48 pub fn address(&self) -> Option<&String> {
49 arg::prop_cast(self.0, "Address")
50 }
51
52 pub fn address_type(&self) -> Option<&String> {
53 arg::prop_cast(self.0, "AddressType")
54 }
55
56 pub fn name(&self) -> Option<&String> {
57 arg::prop_cast(self.0, "Name")
58 }
59
60 pub fn alias(&self) -> Option<&String> {
61 arg::prop_cast(self.0, "Alias")
62 }
63
64 pub fn class(&self) -> Option<u32> {
65 arg::prop_cast(self.0, "Class").copied()
66 }
67
68 pub fn powered(&self) -> Option<bool> {
69 arg::prop_cast(self.0, "Powered").copied()
70 }
71
72 pub fn power_state(&self) -> Option<&String> {
73 arg::prop_cast(self.0, "PowerState")
74 }
75
76 pub fn discoverable(&self) -> Option<bool> {
77 arg::prop_cast(self.0, "Discoverable").copied()
78 }
79
80 pub fn discoverable_timeout(&self) -> Option<u32> {
81 arg::prop_cast(self.0, "DiscoverableTimeout").copied()
82 }
83
84 pub fn pairable(&self) -> Option<bool> {
85 arg::prop_cast(self.0, "Pairable").copied()
86 }
87
88 pub fn pairable_timeout(&self) -> Option<u32> {
89 arg::prop_cast(self.0, "PairableTimeout").copied()
90 }
91
92 pub fn discovering(&self) -> Option<bool> {
93 arg::prop_cast(self.0, "Discovering").copied()
94 }
95
96 pub fn uuids(&self) -> Option<&Vec<String>> {
97 arg::prop_cast(self.0, "UUIDs")
98 }
99
100 pub fn modalias(&self) -> Option<&String> {
101 arg::prop_cast(self.0, "Modalias")
102 }
103
104 pub fn roles(&self) -> Option<&Vec<String>> {
105 arg::prop_cast(self.0, "Roles")
106 }
107
108 pub fn experimental_features(&self) -> Option<&Vec<String>> {
109 arg::prop_cast(self.0, "ExperimentalFeatures")
110 }
111}
112
113impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezAdapter1
114 for nonblock::Proxy<'a, C>
115{
116 fn start_discovery(&self) -> nonblock::MethodReply<()> {
117 self.method_call("org.bluez.Adapter1", "StartDiscovery", ())
118 }
119
120 fn set_discovery_filter(&self, properties: arg::PropMap) -> nonblock::MethodReply<()> {
121 self.method_call("org.bluez.Adapter1", "SetDiscoveryFilter", (properties,))
122 }
123
124 fn stop_discovery(&self) -> nonblock::MethodReply<()> {
125 self.method_call("org.bluez.Adapter1", "StopDiscovery", ())
126 }
127
128 fn remove_device(&self, device: dbus::Path) -> nonblock::MethodReply<()> {
129 self.method_call("org.bluez.Adapter1", "RemoveDevice", (device,))
130 }
131
132 fn get_discovery_filters(&self) -> nonblock::MethodReply<Vec<String>> {
133 self.method_call("org.bluez.Adapter1", "GetDiscoveryFilters", ())
134 .and_then(|r: (Vec<String>,)| Ok(r.0))
135 }
136
137 fn address(&self) -> nonblock::MethodReply<String> {
138 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
139 &self,
140 "org.bluez.Adapter1",
141 "Address",
142 )
143 }
144
145 fn address_type(&self) -> nonblock::MethodReply<String> {
146 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
147 &self,
148 "org.bluez.Adapter1",
149 "AddressType",
150 )
151 }
152
153 fn name(&self) -> nonblock::MethodReply<String> {
154 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
155 &self,
156 "org.bluez.Adapter1",
157 "Name",
158 )
159 }
160
161 fn alias(&self) -> nonblock::MethodReply<String> {
162 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
163 &self,
164 "org.bluez.Adapter1",
165 "Alias",
166 )
167 }
168
169 fn class(&self) -> nonblock::MethodReply<u32> {
170 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
171 &self,
172 "org.bluez.Adapter1",
173 "Class",
174 )
175 }
176
177 fn powered(&self) -> nonblock::MethodReply<bool> {
178 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
179 &self,
180 "org.bluez.Adapter1",
181 "Powered",
182 )
183 }
184
185 fn power_state(&self) -> nonblock::MethodReply<String> {
186 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
187 &self,
188 "org.bluez.Adapter1",
189 "PowerState",
190 )
191 }
192
193 fn discoverable(&self) -> nonblock::MethodReply<bool> {
194 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
195 &self,
196 "org.bluez.Adapter1",
197 "Discoverable",
198 )
199 }
200
201 fn discoverable_timeout(&self) -> nonblock::MethodReply<u32> {
202 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
203 &self,
204 "org.bluez.Adapter1",
205 "DiscoverableTimeout",
206 )
207 }
208
209 fn pairable(&self) -> nonblock::MethodReply<bool> {
210 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
211 &self,
212 "org.bluez.Adapter1",
213 "Pairable",
214 )
215 }
216
217 fn pairable_timeout(&self) -> nonblock::MethodReply<u32> {
218 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
219 &self,
220 "org.bluez.Adapter1",
221 "PairableTimeout",
222 )
223 }
224
225 fn discovering(&self) -> nonblock::MethodReply<bool> {
226 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
227 &self,
228 "org.bluez.Adapter1",
229 "Discovering",
230 )
231 }
232
233 fn uuids(&self) -> nonblock::MethodReply<Vec<String>> {
234 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
235 &self,
236 "org.bluez.Adapter1",
237 "UUIDs",
238 )
239 }
240
241 fn modalias(&self) -> nonblock::MethodReply<String> {
242 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
243 &self,
244 "org.bluez.Adapter1",
245 "Modalias",
246 )
247 }
248
249 fn roles(&self) -> nonblock::MethodReply<Vec<String>> {
250 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
251 &self,
252 "org.bluez.Adapter1",
253 "Roles",
254 )
255 }
256
257 fn experimental_features(&self) -> nonblock::MethodReply<Vec<String>> {
258 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
259 &self,
260 "org.bluez.Adapter1",
261 "ExperimentalFeatures",
262 )
263 }
264
265 fn set_alias(&self, value: String) -> nonblock::MethodReply<()> {
266 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
267 &self,
268 "org.bluez.Adapter1",
269 "Alias",
270 value,
271 )
272 }
273
274 fn set_powered(&self, value: bool) -> nonblock::MethodReply<()> {
275 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
276 &self,
277 "org.bluez.Adapter1",
278 "Powered",
279 value,
280 )
281 }
282
283 fn set_discoverable(&self, value: bool) -> nonblock::MethodReply<()> {
284 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
285 &self,
286 "org.bluez.Adapter1",
287 "Discoverable",
288 value,
289 )
290 }
291
292 fn set_discoverable_timeout(&self, value: u32) -> nonblock::MethodReply<()> {
293 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
294 &self,
295 "org.bluez.Adapter1",
296 "DiscoverableTimeout",
297 value,
298 )
299 }
300
301 fn set_pairable(&self, value: bool) -> nonblock::MethodReply<()> {
302 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
303 &self,
304 "org.bluez.Adapter1",
305 "Pairable",
306 value,
307 )
308 }
309
310 fn set_pairable_timeout(&self, value: u32) -> nonblock::MethodReply<()> {
311 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
312 &self,
313 "org.bluez.Adapter1",
314 "PairableTimeout",
315 value,
316 )
317 }
318}