bluez_generated/
gattcharacteristic1.rs1#[allow(unused_imports)]
3use dbus::arg;
4use dbus::nonblock;
5
6pub trait OrgBluezGattCharacteristic1 {
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 acquire_write(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)>;
10 fn acquire_notify(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)>;
11 fn start_notify(&self) -> nonblock::MethodReply<()>;
12 fn stop_notify(&self) -> nonblock::MethodReply<()>;
13 fn uuid(&self) -> nonblock::MethodReply<String>;
14 fn service(&self) -> nonblock::MethodReply<dbus::Path<'static>>;
15 fn value(&self) -> nonblock::MethodReply<Vec<u8>>;
16 fn notifying(&self) -> nonblock::MethodReply<bool>;
17 fn flags(&self) -> nonblock::MethodReply<Vec<String>>;
18 fn write_acquired(&self) -> nonblock::MethodReply<bool>;
19 fn notify_acquired(&self) -> nonblock::MethodReply<bool>;
20 fn mtu(&self) -> nonblock::MethodReply<u16>;
21}
22
23pub const ORG_BLUEZ_GATT_CHARACTERISTIC1_NAME: &str = "org.bluez.GattCharacteristic1";
24
25#[derive(Copy, Clone, Debug)]
26pub struct OrgBluezGattCharacteristic1Properties<'a>(pub &'a arg::PropMap);
27
28impl<'a> OrgBluezGattCharacteristic1Properties<'a> {
29 pub fn from_interfaces(
30 interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
31 ) -> Option<Self> {
32 interfaces.get("org.bluez.GattCharacteristic1").map(Self)
33 }
34
35 pub fn uuid(&self) -> Option<&String> {
36 arg::prop_cast(self.0, "UUID")
37 }
38
39 pub fn service(&self) -> Option<&dbus::Path<'static>> {
40 arg::prop_cast(self.0, "Service")
41 }
42
43 pub fn value(&self) -> Option<&Vec<u8>> {
44 arg::prop_cast(self.0, "Value")
45 }
46
47 pub fn notifying(&self) -> Option<bool> {
48 arg::prop_cast(self.0, "Notifying").copied()
49 }
50
51 pub fn flags(&self) -> Option<&Vec<String>> {
52 arg::prop_cast(self.0, "Flags")
53 }
54
55 pub fn write_acquired(&self) -> Option<bool> {
56 arg::prop_cast(self.0, "WriteAcquired").copied()
57 }
58
59 pub fn notify_acquired(&self) -> Option<bool> {
60 arg::prop_cast(self.0, "NotifyAcquired").copied()
61 }
62
63 pub fn mtu(&self) -> Option<u16> {
64 arg::prop_cast(self.0, "MTU").copied()
65 }
66}
67
68impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezGattCharacteristic1
69 for nonblock::Proxy<'a, C>
70{
71 fn read_value(&self, options: arg::PropMap) -> nonblock::MethodReply<Vec<u8>> {
72 self.method_call("org.bluez.GattCharacteristic1", "ReadValue", (options,))
73 .and_then(|r: (Vec<u8>,)| Ok(r.0))
74 }
75
76 fn write_value(&self, value: Vec<u8>, options: arg::PropMap) -> nonblock::MethodReply<()> {
77 self.method_call(
78 "org.bluez.GattCharacteristic1",
79 "WriteValue",
80 (value, options),
81 )
82 }
83
84 fn acquire_write(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)> {
85 self.method_call("org.bluez.GattCharacteristic1", "AcquireWrite", (options,))
86 }
87
88 fn acquire_notify(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)> {
89 self.method_call("org.bluez.GattCharacteristic1", "AcquireNotify", (options,))
90 }
91
92 fn start_notify(&self) -> nonblock::MethodReply<()> {
93 self.method_call("org.bluez.GattCharacteristic1", "StartNotify", ())
94 }
95
96 fn stop_notify(&self) -> nonblock::MethodReply<()> {
97 self.method_call("org.bluez.GattCharacteristic1", "StopNotify", ())
98 }
99
100 fn uuid(&self) -> nonblock::MethodReply<String> {
101 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
102 &self,
103 "org.bluez.GattCharacteristic1",
104 "UUID",
105 )
106 }
107
108 fn service(&self) -> nonblock::MethodReply<dbus::Path<'static>> {
109 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
110 &self,
111 "org.bluez.GattCharacteristic1",
112 "Service",
113 )
114 }
115
116 fn value(&self) -> nonblock::MethodReply<Vec<u8>> {
117 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
118 &self,
119 "org.bluez.GattCharacteristic1",
120 "Value",
121 )
122 }
123
124 fn notifying(&self) -> nonblock::MethodReply<bool> {
125 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
126 &self,
127 "org.bluez.GattCharacteristic1",
128 "Notifying",
129 )
130 }
131
132 fn flags(&self) -> nonblock::MethodReply<Vec<String>> {
133 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
134 &self,
135 "org.bluez.GattCharacteristic1",
136 "Flags",
137 )
138 }
139
140 fn write_acquired(&self) -> nonblock::MethodReply<bool> {
141 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
142 &self,
143 "org.bluez.GattCharacteristic1",
144 "WriteAcquired",
145 )
146 }
147
148 fn notify_acquired(&self) -> nonblock::MethodReply<bool> {
149 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
150 &self,
151 "org.bluez.GattCharacteristic1",
152 "NotifyAcquired",
153 )
154 }
155
156 fn mtu(&self) -> nonblock::MethodReply<u16> {
157 <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
158 &self,
159 "org.bluez.GattCharacteristic1",
160 "MTU",
161 )
162 }
163}