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