1#[allow(unused_imports)]
3use dbus::arg;
4use dbus::nonblock;
5
6pub trait OrgBluezDevice1 {
7 fn disconnect(&self) -> nonblock::MethodReply<()>;
8 fn connect(&self) -> nonblock::MethodReply<()>;
9 fn connect_profile(&self, uuid: &str) -> nonblock::MethodReply<()>;
10 fn disconnect_profile(&self, uuid: &str) -> nonblock::MethodReply<()>;
11 fn pair(&self) -> nonblock::MethodReply<()>;
12 fn cancel_pairing(&self) -> nonblock::MethodReply<()>;
13 fn address(&self) -> nonblock::MethodReply<String>;
14 fn address_type(&self) -> nonblock::MethodReply<String>;
15 fn name(&self) -> nonblock::MethodReply<String>;
16 fn alias(&self) -> nonblock::MethodReply<String>;
17 fn set_alias(&self, value: String) -> nonblock::MethodReply<()>;
18 fn class(&self) -> nonblock::MethodReply<u32>;
19 fn appearance(&self) -> nonblock::MethodReply<u16>;
20 fn icon(&self) -> nonblock::MethodReply<String>;
21 fn paired(&self) -> nonblock::MethodReply<bool>;
22 fn bonded(&self) -> nonblock::MethodReply<bool>;
23 fn trusted(&self) -> nonblock::MethodReply<bool>;
24 fn set_trusted(&self, value: bool) -> nonblock::MethodReply<()>;
25 fn blocked(&self) -> nonblock::MethodReply<bool>;
26 fn set_blocked(&self, value: bool) -> nonblock::MethodReply<()>;
27 fn legacy_pairing(&self) -> nonblock::MethodReply<bool>;
28 fn rssi(&self) -> nonblock::MethodReply<i16>;
29 fn connected(&self) -> nonblock::MethodReply<bool>;
30 fn uuids(&self) -> nonblock::MethodReply<Vec<String>>;
31 fn modalias(&self) -> nonblock::MethodReply<String>;
32 fn adapter(&self) -> nonblock::MethodReply<dbus::Path<'static>>;
33 fn manufacturer_data(
34 &self,
35 ) -> nonblock::MethodReply<
36 ::std::collections::HashMap<u16, arg::Variant<Box<dyn arg::RefArg + 'static>>>,
37 >;
38 fn service_data(&self) -> nonblock::MethodReply<arg::PropMap>;
39 fn tx_power(&self) -> nonblock::MethodReply<i16>;
40 fn services_resolved(&self) -> nonblock::MethodReply<bool>;
41 fn wake_allowed(&self) -> nonblock::MethodReply<bool>;
42 fn set_wake_allowed(&self, value: bool) -> nonblock::MethodReply<()>;
43}
44
45pub const ORG_BLUEZ_DEVICE1_NAME: &str = "org.bluez.Device1";
46
47#[derive(Copy, Clone, Debug)]
48pub struct OrgBluezDevice1Properties<'a>(pub &'a arg::PropMap);
49
50impl<'a> OrgBluezDevice1Properties<'a> {
51 pub fn from_interfaces(
52 interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
53 ) -> Option<Self> {
54 interfaces.get("org.bluez.Device1").map(Self)
55 }
56
57 pub fn address(&self) -> Option<&String> {
58 arg::prop_cast(self.0, "Address")
59 }
60
61 pub fn address_type(&self) -> Option<&String> {
62 arg::prop_cast(self.0, "AddressType")
63 }
64
65 pub fn name(&self) -> Option<&String> {
66 arg::prop_cast(self.0, "Name")
67 }
68
69 pub fn alias(&self) -> Option<&String> {
70 arg::prop_cast(self.0, "Alias")
71 }
72
73 pub fn class(&self) -> Option<u32> {
74 arg::prop_cast(self.0, "Class").copied()
75 }
76
77 pub fn appearance(&self) -> Option<u16> {
78 arg::prop_cast(self.0, "Appearance").copied()
79 }
80
81 pub fn icon(&self) -> Option<&String> {
82 arg::prop_cast(self.0, "Icon")
83 }
84
85 pub fn paired(&self) -> Option<bool> {
86 arg::prop_cast(self.0, "Paired").copied()
87 }
88
89 pub fn bonded(&self) -> Option<bool> {
90 arg::prop_cast(self.0, "Bonded").copied()
91 }
92
93 pub fn trusted(&self) -> Option<bool> {
94 arg::prop_cast(self.0, "Trusted").copied()
95 }
96
97 pub fn blocked(&self) -> Option<bool> {
98 arg::prop_cast(self.0, "Blocked").copied()
99 }
100
101 pub fn legacy_pairing(&self) -> Option<bool> {
102 arg::prop_cast(self.0, "LegacyPairing").copied()
103 }
104
105 pub fn rssi(&self) -> Option<i16> {
106 arg::prop_cast(self.0, "RSSI").copied()
107 }
108
109 pub fn connected(&self) -> Option<bool> {
110 arg::prop_cast(self.0, "Connected").copied()
111 }
112
113 pub fn uuids(&self) -> Option<&Vec<String>> {
114 arg::prop_cast(self.0, "UUIDs")
115 }
116
117 pub fn modalias(&self) -> Option<&String> {
118 arg::prop_cast(self.0, "Modalias")
119 }
120
121 pub fn adapter(&self) -> Option<&dbus::Path<'static>> {
122 arg::prop_cast(self.0, "Adapter")
123 }
124
125 pub fn manufacturer_data(
126 &self,
127 ) -> Option<&::std::collections::HashMap<u16, arg::Variant<Box<dyn arg::RefArg + 'static>>>>
128 {
129 arg::prop_cast(self.0, "ManufacturerData")
130 }
131
132 pub fn service_data(&self) -> Option<&arg::PropMap> {
133 arg::prop_cast(self.0, "ServiceData")
134 }
135
136 pub fn tx_power(&self) -> Option<i16> {
137 arg::prop_cast(self.0, "TxPower").copied()
138 }
139
140 pub fn services_resolved(&self) -> Option<bool> {
141 arg::prop_cast(self.0, "ServicesResolved").copied()
142 }
143
144 pub fn wake_allowed(&self) -> Option<bool> {
145 arg::prop_cast(self.0, "WakeAllowed").copied()
146 }
147}
148
149impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezDevice1
150 for nonblock::Proxy<'a, C>
151{
152 fn disconnect(&self) -> nonblock::MethodReply<()> {
153 self.method_call("org.bluez.Device1", "Disconnect", ())
154 }
155
156 fn connect(&self) -> nonblock::MethodReply<()> {
157 self.method_call("org.bluez.Device1", "Connect", ())
158 }
159
160 fn connect_profile(&self, uuid: &str) -> nonblock::MethodReply<()> {
161 self.method_call("org.bluez.Device1", "ConnectProfile", (uuid,))
162 }
163
164 fn disconnect_profile(&self, uuid: &str) -> nonblock::MethodReply<()> {
165 self.method_call("org.bluez.Device1", "DisconnectProfile", (uuid,))
166 }
167
168 fn pair(&self) -> nonblock::MethodReply<()> {
169 self.method_call("org.bluez.Device1", "Pair", ())
170 }
171
172 fn cancel_pairing(&self) -> nonblock::MethodReply<()> {
173 self.method_call("org.bluez.Device1", "CancelPairing", ())
174 }
175
176 fn address(&self) -> nonblock::MethodReply<String> {
177 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
178 &self,
179 "org.bluez.Device1",
180 "Address",
181 )
182 }
183
184 fn address_type(&self) -> nonblock::MethodReply<String> {
185 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
186 &self,
187 "org.bluez.Device1",
188 "AddressType",
189 )
190 }
191
192 fn name(&self) -> nonblock::MethodReply<String> {
193 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
194 &self,
195 "org.bluez.Device1",
196 "Name",
197 )
198 }
199
200 fn alias(&self) -> nonblock::MethodReply<String> {
201 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
202 &self,
203 "org.bluez.Device1",
204 "Alias",
205 )
206 }
207
208 fn class(&self) -> nonblock::MethodReply<u32> {
209 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
210 &self,
211 "org.bluez.Device1",
212 "Class",
213 )
214 }
215
216 fn appearance(&self) -> nonblock::MethodReply<u16> {
217 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
218 &self,
219 "org.bluez.Device1",
220 "Appearance",
221 )
222 }
223
224 fn icon(&self) -> nonblock::MethodReply<String> {
225 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
226 &self,
227 "org.bluez.Device1",
228 "Icon",
229 )
230 }
231
232 fn paired(&self) -> nonblock::MethodReply<bool> {
233 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
234 &self,
235 "org.bluez.Device1",
236 "Paired",
237 )
238 }
239
240 fn bonded(&self) -> nonblock::MethodReply<bool> {
241 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
242 &self,
243 "org.bluez.Device1",
244 "Bonded",
245 )
246 }
247
248 fn trusted(&self) -> nonblock::MethodReply<bool> {
249 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
250 &self,
251 "org.bluez.Device1",
252 "Trusted",
253 )
254 }
255
256 fn blocked(&self) -> nonblock::MethodReply<bool> {
257 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
258 &self,
259 "org.bluez.Device1",
260 "Blocked",
261 )
262 }
263
264 fn legacy_pairing(&self) -> nonblock::MethodReply<bool> {
265 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
266 &self,
267 "org.bluez.Device1",
268 "LegacyPairing",
269 )
270 }
271
272 fn rssi(&self) -> nonblock::MethodReply<i16> {
273 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
274 &self,
275 "org.bluez.Device1",
276 "RSSI",
277 )
278 }
279
280 fn connected(&self) -> nonblock::MethodReply<bool> {
281 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
282 &self,
283 "org.bluez.Device1",
284 "Connected",
285 )
286 }
287
288 fn uuids(&self) -> nonblock::MethodReply<Vec<String>> {
289 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
290 &self,
291 "org.bluez.Device1",
292 "UUIDs",
293 )
294 }
295
296 fn modalias(&self) -> nonblock::MethodReply<String> {
297 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
298 &self,
299 "org.bluez.Device1",
300 "Modalias",
301 )
302 }
303
304 fn adapter(&self) -> nonblock::MethodReply<dbus::Path<'static>> {
305 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
306 &self,
307 "org.bluez.Device1",
308 "Adapter",
309 )
310 }
311
312 fn manufacturer_data(
313 &self,
314 ) -> nonblock::MethodReply<
315 ::std::collections::HashMap<u16, arg::Variant<Box<dyn arg::RefArg + 'static>>>,
316 > {
317 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
318 &self,
319 "org.bluez.Device1",
320 "ManufacturerData",
321 )
322 }
323
324 fn service_data(&self) -> nonblock::MethodReply<arg::PropMap> {
325 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
326 &self,
327 "org.bluez.Device1",
328 "ServiceData",
329 )
330 }
331
332 fn tx_power(&self) -> nonblock::MethodReply<i16> {
333 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
334 &self,
335 "org.bluez.Device1",
336 "TxPower",
337 )
338 }
339
340 fn services_resolved(&self) -> nonblock::MethodReply<bool> {
341 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
342 &self,
343 "org.bluez.Device1",
344 "ServicesResolved",
345 )
346 }
347
348 fn wake_allowed(&self) -> nonblock::MethodReply<bool> {
349 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
350 &self,
351 "org.bluez.Device1",
352 "WakeAllowed",
353 )
354 }
355
356 fn set_alias(&self, value: String) -> nonblock::MethodReply<()> {
357 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
358 &self,
359 "org.bluez.Device1",
360 "Alias",
361 value,
362 )
363 }
364
365 fn set_trusted(&self, value: bool) -> nonblock::MethodReply<()> {
366 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
367 &self,
368 "org.bluez.Device1",
369 "Trusted",
370 value,
371 )
372 }
373
374 fn set_blocked(&self, value: bool) -> nonblock::MethodReply<()> {
375 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
376 &self,
377 "org.bluez.Device1",
378 "Blocked",
379 value,
380 )
381 }
382
383 fn set_wake_allowed(&self, value: bool) -> nonblock::MethodReply<()> {
384 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
385 &self,
386 "org.bluez.Device1",
387 "WakeAllowed",
388 value,
389 )
390 }
391}