bluez_generated/
gattdescriptor1.rs

1// This code was autogenerated with `dbus-codegen-rust --file=specs/org.bluez.GattDescriptor1.xml --interfaces=org.bluez.GattDescriptor1 --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 OrgBluezGattDescriptor1 {
7    fn read_value(&self, options: arg::PropMap) -> nonblock::MethodReply<Vec<u8>>;
8    fn write_value(&self, value: Vec<u8>, options: arg::PropMap) -> nonblock::MethodReply<()>;
9    fn uuid(&self) -> nonblock::MethodReply<String>;
10    fn characteristic(&self) -> nonblock::MethodReply<dbus::Path<'static>>;
11    fn value(&self) -> nonblock::MethodReply<Vec<u8>>;
12}
13
14pub const ORG_BLUEZ_GATT_DESCRIPTOR1_NAME: &str = "org.bluez.GattDescriptor1";
15
16#[derive(Copy, Clone, Debug)]
17pub struct OrgBluezGattDescriptor1Properties<'a>(pub &'a arg::PropMap);
18
19impl<'a> OrgBluezGattDescriptor1Properties<'a> {
20    pub fn from_interfaces(
21        interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
22    ) -> Option<Self> {
23        interfaces.get("org.bluez.GattDescriptor1").map(Self)
24    }
25
26    pub fn uuid(&self) -> Option<&String> {
27        arg::prop_cast(self.0, "UUID")
28    }
29
30    pub fn characteristic(&self) -> Option<&dbus::Path<'static>> {
31        arg::prop_cast(self.0, "Characteristic")
32    }
33
34    pub fn value(&self) -> Option<&Vec<u8>> {
35        arg::prop_cast(self.0, "Value")
36    }
37}
38
39impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezGattDescriptor1
40    for nonblock::Proxy<'a, C>
41{
42    fn read_value(&self, options: arg::PropMap) -> nonblock::MethodReply<Vec<u8>> {
43        self.method_call("org.bluez.GattDescriptor1", "ReadValue", (options,))
44            .and_then(|r: (Vec<u8>,)| Ok(r.0))
45    }
46
47    fn write_value(&self, value: Vec<u8>, options: arg::PropMap) -> nonblock::MethodReply<()> {
48        self.method_call("org.bluez.GattDescriptor1", "WriteValue", (value, options))
49    }
50
51    fn uuid(&self) -> nonblock::MethodReply<String> {
52        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
53            &self,
54            "org.bluez.GattDescriptor1",
55            "UUID",
56        )
57    }
58
59    fn characteristic(&self) -> nonblock::MethodReply<dbus::Path<'static>> {
60        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
61            &self,
62            "org.bluez.GattDescriptor1",
63            "Characteristic",
64        )
65    }
66
67    fn value(&self) -> nonblock::MethodReply<Vec<u8>> {
68        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
69            &self,
70            "org.bluez.GattDescriptor1",
71            "Value",
72        )
73    }
74}