nm_rs/auto/device_generic.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi,Device,Object};
8use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
9use std::{boxed::Box as Box_};
10
11glib::wrapper! {
12 ///
13 ///
14 /// ## Properties
15 ///
16 ///
17 /// #### `type-description`
18 /// A description of the specific type of device this is, or [`None`]
19 /// if not known.
20 ///
21 /// Readable
22 /// <details><summary><h4>Device</h4></summary>
23 ///
24 ///
25 /// #### `active-connection`
26 /// The #NMActiveConnection object that "owns" this device during activation.
27 ///
28 /// Readable
29 ///
30 ///
31 /// #### `autoconnect`
32 /// Whether the device can auto-activate a connection.
33 ///
34 /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
35 ///
36 /// Readable | Writeable
37 ///
38 ///
39 /// #### `available-connections`
40 /// The available connections of the device
41 ///
42 /// Readable
43 ///
44 ///
45 /// #### `capabilities`
46 /// The capabilities of the device.
47 ///
48 /// Readable
49 ///
50 ///
51 /// #### `device-type`
52 /// The numeric type of the device.
53 ///
54 /// Readable
55 ///
56 ///
57 /// #### `dhcp4-config`
58 /// The IPv4 #NMDhcpConfig of the device.
59 ///
60 /// Readable
61 ///
62 ///
63 /// #### `dhcp6-config`
64 /// The IPv6 #NMDhcpConfig of the device.
65 ///
66 /// Readable
67 ///
68 ///
69 /// #### `driver`
70 /// The driver of the device.
71 ///
72 /// Readable
73 ///
74 ///
75 /// #### `driver-version`
76 /// The version of the device driver.
77 ///
78 /// Readable
79 ///
80 ///
81 /// #### `firmware-missing`
82 /// When [`true`] indicates the device is likely missing firmware required
83 /// for its operation.
84 ///
85 /// Readable
86 ///
87 ///
88 /// #### `firmware-version`
89 /// The firmware version of the device.
90 ///
91 /// Readable
92 ///
93 ///
94 /// #### `hw-address`
95 /// The hardware address of the device.
96 ///
97 /// Readable
98 ///
99 ///
100 /// #### `interface`
101 /// The interface of the device.
102 ///
103 /// Readable
104 ///
105 ///
106 /// #### `interface-flags`
107 /// The interface flags.
108 ///
109 /// Readable
110 ///
111 ///
112 /// #### `ip-interface`
113 /// The IP interface of the device which should be used for all IP-related
114 /// operations like addressing and routing.
115 ///
116 /// Readable
117 ///
118 ///
119 /// #### `ip4-config`
120 /// The #NMIP4Config of the device.
121 ///
122 /// Readable
123 ///
124 ///
125 /// #### `ip4-connectivity`
126 /// The IPv4 connectivity state of the device.
127 ///
128 /// Readable
129 ///
130 ///
131 /// #### `ip6-config`
132 /// The IPv6 #NMIPConfig of the device.
133 ///
134 /// Readable
135 ///
136 ///
137 /// #### `ip6-connectivity`
138 /// The IPv6 connectivity state of the device.
139 ///
140 /// Readable
141 ///
142 ///
143 /// #### `lldp-neighbors`
144 /// The LLDP neighbors.
145 ///
146 /// Readable
147 ///
148 ///
149 /// #### `managed`
150 /// Whether the device is managed by NetworkManager.
151 ///
152 /// Readable
153 ///
154 ///
155 /// #### `metered`
156 /// Whether the device is metered.
157 ///
158 /// Readable
159 ///
160 ///
161 /// #### `mtu`
162 /// The MTU of the device.
163 ///
164 /// Readable
165 ///
166 ///
167 /// #### `nm-plugin-missing`
168 /// When [`true`] indicates that the NetworkManager plugin for the device
169 /// is not installed.
170 ///
171 /// Readable
172 ///
173 ///
174 /// #### `path`
175 /// The device path as exposed by the udev property ID_PATH.
176 ///
177 /// The string is backslash escaped (C escaping) for invalid
178 /// characters. The escaping can be reverted with g_strcompress(),
179 /// however the result may not be valid UTF-8.
180 ///
181 /// Readable
182 ///
183 ///
184 /// #### `physical-port-id`
185 /// The physical port ID of the device. (See
186 /// nm_device_get_physical_port_id().)
187 ///
188 /// Readable
189 ///
190 ///
191 /// #### `ports`
192 /// The port devices of the controller device. For devices that cannot be
193 /// controllers this is likely to be always empty.
194 ///
195 /// Readable
196 ///
197 ///
198 /// #### `product`
199 /// The product string of the device.
200 ///
201 /// Readable
202 ///
203 ///
204 /// #### `real`
205 /// Whether the device is real or is a placeholder device that could
206 /// be created automatically by NetworkManager if one of its
207 /// #NMDevice:available-connections was activated.
208 ///
209 /// Readable
210 ///
211 ///
212 /// #### `state`
213 /// The state of the device.
214 ///
215 /// Readable
216 ///
217 ///
218 /// #### `state-reason`
219 /// The reason for the device state.
220 ///
221 /// Readable
222 ///
223 ///
224 /// #### `udi`
225 /// An operating-system specific device hardware identifier; this is not
226 /// unique to a specific hardware device across reboots or hotplugs. It
227 /// is an opaque string which for some device types (Bluetooth, Modem)
228 /// contains an identifier provided by the underlying hardware service daemon
229 /// such as Bluez or ModemManager, and clients can use this property to
230 /// request more information about the device from those services.
231 ///
232 /// Readable
233 ///
234 ///
235 /// #### `vendor`
236 /// The vendor string of the device.
237 ///
238 /// Readable
239 /// </details>
240 /// <details><summary><h4>Object</h4></summary>
241 ///
242 ///
243 /// #### `client`
244 /// The NMClient instance as returned by nm_object_get_client().
245 ///
246 /// When an NMObject gets removed from the NMClient cache,
247 /// the NMObject:path property stays unchanged, but this client
248 /// instance gets reset to [`None`]. You can use this property to
249 /// track removal of the object from the cache.
250 ///
251 /// Readable
252 ///
253 ///
254 /// #### `path`
255 /// The D-Bus object path.
256 ///
257 /// The D-Bus path of an object instance never changes, even if the object
258 /// gets removed from the cache. To see whether the object is still in the
259 /// cache, check NMObject:client.
260 ///
261 /// Readable
262 /// </details>
263 ///
264 /// # Implements
265 ///
266 /// [`DeviceExt`][trait@crate::prelude::DeviceExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
267 #[doc(alias = "NMDeviceGeneric")]
268 pub struct DeviceGeneric(Object<ffi::NMDeviceGeneric, ffi::NMDeviceGenericClass>) @extends Device, Object;
269
270 match fn {
271 type_ => || ffi::nm_device_generic_get_type(),
272 }
273}
274
275impl DeviceGeneric {
276 // rustdoc-stripper-ignore-next
277 /// Creates a new builder-pattern struct instance to construct [`DeviceGeneric`] objects.
278 ///
279 /// This method returns an instance of [`DeviceGenericBuilder`](crate::builders::DeviceGenericBuilder) which can be used to create [`DeviceGeneric`] objects.
280 pub fn builder() -> DeviceGenericBuilder {
281 DeviceGenericBuilder::new()
282 }
283
284
285 /// Gets the hardware address of the #NMDeviceGeneric
286 ///
287 /// # Deprecated since 1.24
288 ///
289 /// Use nm_device_get_hw_address() instead.
290 ///
291 /// # Returns
292 ///
293 /// the hardware address. This is the internal string used by the
294 /// device, and must not be modified.
295 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
296 #[allow(deprecated)]
297 #[doc(alias = "nm_device_generic_get_hw_address")]
298 #[doc(alias = "get_hw_address")]
299 pub fn hw_address(&self) -> glib::GString {
300 unsafe {
301 from_glib_none(ffi::nm_device_generic_get_hw_address(self.to_glib_none().0))
302 }
303 }
304
305 #[doc(alias = "type-description")]
306 pub fn connect_type_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
307 unsafe extern "C" fn notify_type_description_trampoline<F: Fn(&DeviceGeneric) + 'static>(this: *mut ffi::NMDeviceGeneric, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
308 let f: &F = &*(f as *const F);
309 f(&from_glib_borrow(this))
310 }
311 unsafe {
312 let f: Box_<F> = Box_::new(f);
313 connect_raw(self.as_ptr() as *mut _, c"notify::type-description".as_ptr() as *const _,
314 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_type_description_trampoline::<F> as *const ())), Box_::into_raw(f))
315 }
316 }
317}
318
319// rustdoc-stripper-ignore-next
320 /// A [builder-pattern] type to construct [`DeviceGeneric`] objects.
321 ///
322 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
323#[must_use = "The builder must be built to be used"]
324pub struct DeviceGenericBuilder {
325 builder: glib::object::ObjectBuilder<'static, DeviceGeneric>,
326 }
327
328 impl DeviceGenericBuilder {
329 fn new() -> Self {
330 Self { builder: glib::object::Object::builder() }
331 }
332
333 /// Whether the device can auto-activate a connection.
334 ///
335 /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
336 pub fn autoconnect(self, autoconnect: bool) -> Self {
337 Self { builder: self.builder.property("autoconnect", autoconnect), }
338 }
339
340 // rustdoc-stripper-ignore-next
341 /// Build the [`DeviceGeneric`].
342 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
343 pub fn build(self) -> DeviceGeneric {
344assert_initialized_main_thread!();
345 self.builder.build() }
346}