bluez_generated/
network1.rs

1// This code was autogenerated with `dbus-codegen-rust --file=specs/org.bluez.Network1.xml --interfaces=org.bluez.Network1 --client=nonblock --methodtype=none --prop-newtype`, see https://github.com/diwic/dbus-rs
2#[allow(unused_imports)]
3use dbus::arg;
4use dbus::nonblock;
5
6pub trait OrgBluezNetwork1 {
7    fn connect(&self, uuid: &str) -> nonblock::MethodReply<String>;
8    fn disconnect(&self) -> nonblock::MethodReply<()>;
9    fn connected(&self) -> nonblock::MethodReply<bool>;
10    fn interface(&self) -> nonblock::MethodReply<String>;
11    fn uuid(&self) -> nonblock::MethodReply<String>;
12}
13
14pub const ORG_BLUEZ_NETWORK1_NAME: &str = "org.bluez.Network1";
15
16#[derive(Copy, Clone, Debug)]
17pub struct OrgBluezNetwork1Properties<'a>(pub &'a arg::PropMap);
18
19impl<'a> OrgBluezNetwork1Properties<'a> {
20    pub fn from_interfaces(
21        interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
22    ) -> Option<Self> {
23        interfaces.get("org.bluez.Network1").map(Self)
24    }
25
26    pub fn connected(&self) -> Option<bool> {
27        arg::prop_cast(self.0, "Connected").copied()
28    }
29
30    pub fn interface(&self) -> Option<&String> {
31        arg::prop_cast(self.0, "Interface")
32    }
33
34    pub fn uuid(&self) -> Option<&String> {
35        arg::prop_cast(self.0, "UUID")
36    }
37}
38
39impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezNetwork1
40    for nonblock::Proxy<'a, C>
41{
42    fn connect(&self, uuid: &str) -> nonblock::MethodReply<String> {
43        self.method_call("org.bluez.Network1", "Connect", (uuid,))
44            .and_then(|r: (String,)| Ok(r.0))
45    }
46
47    fn disconnect(&self) -> nonblock::MethodReply<()> {
48        self.method_call("org.bluez.Network1", "Disconnect", ())
49    }
50
51    fn connected(&self) -> nonblock::MethodReply<bool> {
52        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
53            &self,
54            "org.bluez.Network1",
55            "Connected",
56        )
57    }
58
59    fn interface(&self) -> nonblock::MethodReply<String> {
60        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
61            &self,
62            "org.bluez.Network1",
63            "Interface",
64        )
65    }
66
67    fn uuid(&self) -> nonblock::MethodReply<String> {
68        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
69            &self,
70            "org.bluez.Network1",
71            "UUID",
72        )
73    }
74}