1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// This code was autogenerated with `dbus-codegen-rust --file=specs/org.bluez.LEAdvertisingManager1.xml --interfaces=org.bluez.LEAdvertisingManager1 --client=nonblock --methodtype=none --prop-newtype`, see https://github.com/diwic/dbus-rs
#[allow(unused_imports)]
use dbus::arg;
use dbus::nonblock;

pub trait OrgBluezLEAdvertisingManager1 {
    fn register_advertisement(
        &self,
        advertisement: dbus::Path,
        options: arg::PropMap,
    ) -> nonblock::MethodReply<()>;
    fn unregister_advertisement(&self, service: dbus::Path) -> nonblock::MethodReply<()>;
    fn active_instances(&self) -> nonblock::MethodReply<u8>;
    fn supported_instances(&self) -> nonblock::MethodReply<u8>;
    fn supported_includes(&self) -> nonblock::MethodReply<Vec<String>>;
}

impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezLEAdvertisingManager1
    for nonblock::Proxy<'a, C>
{
    fn register_advertisement(
        &self,
        advertisement: dbus::Path,
        options: arg::PropMap,
    ) -> nonblock::MethodReply<()> {
        self.method_call(
            "org.bluez.LEAdvertisingManager1",
            "RegisterAdvertisement",
            (advertisement, options),
        )
    }

    fn unregister_advertisement(&self, service: dbus::Path) -> nonblock::MethodReply<()> {
        self.method_call(
            "org.bluez.LEAdvertisingManager1",
            "UnregisterAdvertisement",
            (service,),
        )
    }

    fn active_instances(&self) -> nonblock::MethodReply<u8> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.LEAdvertisingManager1",
            "ActiveInstances",
        )
    }

    fn supported_instances(&self) -> nonblock::MethodReply<u8> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.LEAdvertisingManager1",
            "SupportedInstances",
        )
    }

    fn supported_includes(&self) -> nonblock::MethodReply<Vec<String>> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.LEAdvertisingManager1",
            "SupportedIncludes",
        )
    }
}

pub const ORG_BLUEZ_LEADVERTISING_MANAGER1_NAME: &str = "org.bluez.LEAdvertisingManager1";

#[derive(Copy, Clone, Debug)]
pub struct OrgBluezLEAdvertisingManager1Properties<'a>(pub &'a arg::PropMap);

impl<'a> OrgBluezLEAdvertisingManager1Properties<'a> {
    pub fn from_interfaces(
        interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
    ) -> Option<Self> {
        interfaces.get("org.bluez.LEAdvertisingManager1").map(Self)
    }

    pub fn active_instances(&self) -> Option<u8> {
        arg::prop_cast(self.0, "ActiveInstances").copied()
    }

    pub fn supported_instances(&self) -> Option<u8> {
        arg::prop_cast(self.0, "SupportedInstances").copied()
    }

    pub fn supported_includes(&self) -> Option<&Vec<String>> {
        arg::prop_cast(self.0, "SupportedIncludes")
    }
}