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
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// This code was autogenerated with `dbus-codegen-rust --file=specs/org.bluez.GattCharacteristic1.xml --interfaces=org.bluez.GattCharacteristic1 --client=nonblock --methodtype=none`, see https://github.com/diwic/dbus-rs
use dbus;
#[allow(unused_imports)]
use dbus::arg;
use dbus::nonblock;

pub trait OrgBluezGattCharacteristic1 {
    fn read_value(
        &self,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<Vec<u8>>;
    fn write_value(
        &self,
        value: Vec<u8>,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<()>;
    fn acquire_write(
        &self,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<(arg::OwnedFd, u16)>;
    fn acquire_notify(
        &self,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<(arg::OwnedFd, u16)>;
    fn start_notify(&self) -> nonblock::MethodReply<()>;
    fn stop_notify(&self) -> nonblock::MethodReply<()>;
    fn uuid(&self) -> nonblock::MethodReply<String>;
    fn service(&self) -> nonblock::MethodReply<dbus::Path<'static>>;
    fn value(&self) -> nonblock::MethodReply<Vec<u8>>;
    fn notifying(&self) -> nonblock::MethodReply<bool>;
    fn flags(&self) -> nonblock::MethodReply<Vec<String>>;
    fn write_acquired(&self) -> nonblock::MethodReply<bool>;
    fn notify_acquired(&self) -> nonblock::MethodReply<bool>;
}

impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezGattCharacteristic1
    for nonblock::Proxy<'a, C>
{
    fn read_value(
        &self,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<Vec<u8>> {
        self.method_call("org.bluez.GattCharacteristic1", "ReadValue", (options,))
            .and_then(|r: (Vec<u8>,)| Ok(r.0))
    }

    fn write_value(
        &self,
        value: Vec<u8>,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<()> {
        self.method_call(
            "org.bluez.GattCharacteristic1",
            "WriteValue",
            (value, options),
        )
    }

    fn acquire_write(
        &self,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<(arg::OwnedFd, u16)> {
        self.method_call("org.bluez.GattCharacteristic1", "AcquireWrite", (options,))
    }

    fn acquire_notify(
        &self,
        options: ::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>,
    ) -> nonblock::MethodReply<(arg::OwnedFd, u16)> {
        self.method_call("org.bluez.GattCharacteristic1", "AcquireNotify", (options,))
    }

    fn start_notify(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.GattCharacteristic1", "StartNotify", ())
    }

    fn stop_notify(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.GattCharacteristic1", "StopNotify", ())
    }

    fn uuid(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "UUID",
        )
    }

    fn service(&self) -> nonblock::MethodReply<dbus::Path<'static>> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "Service",
        )
    }

    fn value(&self) -> nonblock::MethodReply<Vec<u8>> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "Value",
        )
    }

    fn notifying(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "Notifying",
        )
    }

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

    fn write_acquired(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "WriteAcquired",
        )
    }

    fn notify_acquired(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "NotifyAcquired",
        )
    }
}