1use dbus::{arg::{self, PropMap}, Path};
2
3use crate::{bluetooth::bluetooth::BluetoothDevice, network::network::{WifiDevice, AccessPoint}};
4
5pub trait GetVal<T> {
6 fn get_value(&self) -> T;
7}
8
9#[derive(Debug)]
10pub struct BluetoothDeviceAdded {
11 pub bluetooth_device: BluetoothDevice,
12}
13
14impl arg::AppendAll for BluetoothDeviceAdded {
15 fn append(&self, i: &mut arg::IterAppend) {
16 arg::RefArg::append(&self.bluetooth_device, i);
17 }
18}
19
20impl arg::ReadAll for BluetoothDeviceAdded {
21 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
22 Ok(BluetoothDeviceAdded {
23 bluetooth_device: i.read()?,
24 })
25 }
26}
27
28impl GetVal<(BluetoothDevice,)> for BluetoothDeviceAdded {
29 fn get_value(&self) -> (BluetoothDevice,) {
30 (self.bluetooth_device.clone(),)
31 }
32}
33
34impl dbus::message::SignalArgs for BluetoothDeviceAdded {
35 const NAME: &'static str = "BluetoothDeviceAdded";
36 const INTERFACE: &'static str = "org.Xetibo.ReSetBluetooth";
37}
38
39
40#[derive(Debug)]
41pub struct BluetoothDeviceChanged {
42 pub bluetooth_device: BluetoothDevice,
43}
44
45impl arg::AppendAll for BluetoothDeviceChanged {
46 fn append(&self, i: &mut arg::IterAppend) {
47 arg::RefArg::append(&self.bluetooth_device, i);
48 }
49}
50
51impl arg::ReadAll for BluetoothDeviceChanged {
52 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
53 Ok(BluetoothDeviceChanged {
54 bluetooth_device: i.read()?,
55 })
56 }
57}
58
59impl GetVal<(BluetoothDevice,)> for BluetoothDeviceChanged {
60 fn get_value(&self) -> (BluetoothDevice,) {
61 (self.bluetooth_device.clone(),)
62 }
63}
64
65impl dbus::message::SignalArgs for BluetoothDeviceChanged {
66 const NAME: &'static str = "BluetoothDeviceChanged";
67 const INTERFACE: &'static str = "org.Xetibo.ReSetBluetooth";
68}
69
70#[derive(Debug)]
71pub struct BluetoothDeviceRemoved {
72 pub bluetooth_device: Path<'static>,
73}
74
75impl arg::AppendAll for BluetoothDeviceRemoved {
76 fn append(&self, i: &mut arg::IterAppend) {
77 arg::RefArg::append(&self.bluetooth_device, i);
78 }
79}
80
81impl arg::ReadAll for BluetoothDeviceRemoved {
82 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
83 Ok(BluetoothDeviceRemoved {
84 bluetooth_device: i.read()?,
85 })
86 }
87}
88
89impl dbus::message::SignalArgs for BluetoothDeviceRemoved {
90 const NAME: &'static str = "BluetoothDeviceRemoved";
91 const INTERFACE: &'static str = "org.Xetibo.ReSetBluetooth";
92}
93
94impl GetVal<(Path<'static>,)> for BluetoothDeviceRemoved {
95 fn get_value(&self) -> (Path<'static>,) {
96 (self.bluetooth_device.clone(),)
97 }
98}
99
100#[derive(Debug)]
101pub struct AccessPointAdded {
102 pub access_point: AccessPoint,
103}
104
105impl arg::AppendAll for AccessPointAdded {
106 fn append(&self, i: &mut arg::IterAppend) {
107 arg::RefArg::append(&self.access_point, i);
108 }
109}
110
111impl arg::ReadAll for AccessPointAdded {
112 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
113 Ok(AccessPointAdded {
114 access_point: i.read()?,
115 })
116 }
117}
118
119impl dbus::message::SignalArgs for AccessPointAdded {
120 const NAME: &'static str = "AccessPointAdded";
121 const INTERFACE: &'static str = "org.Xetibo.ReSetWireless";
122}
123
124impl GetVal<(AccessPoint,)> for AccessPointAdded {
125 fn get_value(&self) -> (AccessPoint,) {
126 (self.access_point.clone(),)
127 }
128}
129
130#[derive(Debug)]
131pub struct AccessPointChanged {
132 pub access_point: AccessPoint,
133}
134
135impl arg::AppendAll for AccessPointChanged {
136 fn append(&self, i: &mut arg::IterAppend) {
137 arg::RefArg::append(&self.access_point, i);
138 }
139}
140
141impl arg::ReadAll for AccessPointChanged {
142 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
143 Ok(AccessPointChanged {
144 access_point: i.read()?,
145 })
146 }
147}
148
149impl dbus::message::SignalArgs for AccessPointChanged {
150 const NAME: &'static str = "AccessPointChanged";
151 const INTERFACE: &'static str = "org.Xetibo.ReSetWireless";
152}
153
154impl GetVal<(AccessPoint,)> for AccessPointChanged {
155 fn get_value(&self) -> (AccessPoint,) {
156 (self.access_point.clone(),)
157 }
158}
159
160#[derive(Debug)]
161pub struct AccessPointRemoved {
162 pub access_point: Path<'static>,
163}
164
165impl arg::AppendAll for AccessPointRemoved {
166 fn append(&self, i: &mut arg::IterAppend) {
167 arg::RefArg::append(&self.access_point, i);
168 }
169}
170
171impl arg::ReadAll for AccessPointRemoved {
172 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
173 Ok(AccessPointRemoved {
174 access_point: i.read()?,
175 })
176 }
177}
178
179impl dbus::message::SignalArgs for AccessPointRemoved {
180 const NAME: &'static str = "AccessPointRemoved";
181 const INTERFACE: &'static str = "org.Xetibo.ReSetWireless";
182}
183
184impl GetVal<(Path<'static>,)> for AccessPointRemoved {
185 fn get_value(&self) -> (Path<'static>,) {
186 (self.access_point.clone(),)
187 }
188}
189
190#[derive(Debug)]
191pub struct WifiDeviceChanged {
192 pub wifi_device: WifiDevice,
193}
194
195impl arg::AppendAll for WifiDeviceChanged {
196 fn append(&self, i: &mut arg::IterAppend) {
197 arg::RefArg::append(&self.wifi_device, i);
198 }
199}
200
201impl arg::ReadAll for WifiDeviceChanged {
202 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
203 Ok(WifiDeviceChanged {
204 wifi_device: i.read()?,
205 })
206 }
207}
208
209impl dbus::message::SignalArgs for WifiDeviceChanged {
210 const NAME: &'static str = "WifiDeviceChanged";
211 const INTERFACE: &'static str = "org.Xetibo.ReSetWireless";
212}
213
214impl GetVal<(WifiDevice,)> for WifiDeviceChanged {
215 fn get_value(&self) -> (WifiDevice,) {
216 (self.wifi_device.clone(),)
217 }
218}
219
220#[derive(Debug)]
221pub struct PropertiesChanged {
222 pub interface: String,
223 pub map: PropMap,
224 pub invalid: Vec<String>,
225}
226
227impl arg::AppendAll for PropertiesChanged {
228 fn append(&self, i: &mut arg::IterAppend) {
229 arg::RefArg::append(&self.interface, i);
230 arg::RefArg::append(&self.map, i);
231 arg::RefArg::append(&self.invalid, i);
232 }
233}
234
235impl arg::ReadAll for PropertiesChanged {
236 fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
237 Ok(PropertiesChanged {
238 interface: i.read()?,
239 map: i.read()?,
240 invalid: i.read()?,
241 })
242 }
243}
244
245impl dbus::message::SignalArgs for PropertiesChanged {
246 const NAME: &'static str = "PropertiesChanged";
247 const INTERFACE: &'static str = "org.freedesktop.DBus.Properties";
248}