nm_rs/auto/
device.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,ActiveConnection,Connection,DeviceCapabilities,DeviceState,DeviceStateReason,DeviceType,DhcpConfig,IPConfig,Object,RemoteConnection};
8#[cfg(feature = "v1_2")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
10use crate::{LldpNeighbor,Metered};
11#[cfg(feature = "v1_16")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
13use crate::{ConnectivityState};
14#[cfg(feature = "v1_22")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
16use crate::{DeviceInterfaceFlags};
17use glib::{object::ObjectType as _,prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
18use std::{boxed::Box as Box_,pin::Pin};
19
20glib::wrapper! {
21    ///
22    ///
23    /// This is an Abstract Base Class, you cannot instantiate it.
24    ///
25    /// ## Properties
26    ///
27    ///
28    /// #### `active-connection`
29    ///  The #NMActiveConnection object that "owns" this device during activation.
30    ///
31    /// Readable
32    ///
33    ///
34    /// #### `autoconnect`
35    ///  Whether the device can auto-activate a connection.
36    ///
37    /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
38    ///
39    /// Readable | Writeable
40    ///
41    ///
42    /// #### `available-connections`
43    ///  The available connections of the device
44    ///
45    /// Readable
46    ///
47    ///
48    /// #### `capabilities`
49    ///  The capabilities of the device.
50    ///
51    /// Readable
52    ///
53    ///
54    /// #### `device-type`
55    ///  The numeric type of the device.
56    ///
57    /// Readable
58    ///
59    ///
60    /// #### `dhcp4-config`
61    ///  The IPv4 #NMDhcpConfig of the device.
62    ///
63    /// Readable
64    ///
65    ///
66    /// #### `dhcp6-config`
67    ///  The IPv6 #NMDhcpConfig of the device.
68    ///
69    /// Readable
70    ///
71    ///
72    /// #### `driver`
73    ///  The driver of the device.
74    ///
75    /// Readable
76    ///
77    ///
78    /// #### `driver-version`
79    ///  The version of the device driver.
80    ///
81    /// Readable
82    ///
83    ///
84    /// #### `firmware-missing`
85    ///  When [`true`] indicates the device is likely missing firmware required
86    /// for its operation.
87    ///
88    /// Readable
89    ///
90    ///
91    /// #### `firmware-version`
92    ///  The firmware version of the device.
93    ///
94    /// Readable
95    ///
96    ///
97    /// #### `hw-address`
98    ///  The hardware address of the device.
99    ///
100    /// Readable
101    ///
102    ///
103    /// #### `interface`
104    ///  The interface of the device.
105    ///
106    /// Readable
107    ///
108    ///
109    /// #### `interface-flags`
110    ///  The interface flags.
111    ///
112    /// Readable
113    ///
114    ///
115    /// #### `ip-interface`
116    ///  The IP interface of the device which should be used for all IP-related
117    /// operations like addressing and routing.
118    ///
119    /// Readable
120    ///
121    ///
122    /// #### `ip4-config`
123    ///  The #NMIP4Config of the device.
124    ///
125    /// Readable
126    ///
127    ///
128    /// #### `ip4-connectivity`
129    ///  The IPv4 connectivity state of the device.
130    ///
131    /// Readable
132    ///
133    ///
134    /// #### `ip6-config`
135    ///  The IPv6 #NMIPConfig of the device.
136    ///
137    /// Readable
138    ///
139    ///
140    /// #### `ip6-connectivity`
141    ///  The IPv6 connectivity state of the device.
142    ///
143    /// Readable
144    ///
145    ///
146    /// #### `lldp-neighbors`
147    ///  The LLDP neighbors.
148    ///
149    /// Readable
150    ///
151    ///
152    /// #### `managed`
153    ///  Whether the device is managed by NetworkManager.
154    ///
155    /// Readable
156    ///
157    ///
158    /// #### `metered`
159    ///  Whether the device is metered.
160    ///
161    /// Readable
162    ///
163    ///
164    /// #### `mtu`
165    ///  The MTU of the device.
166    ///
167    /// Readable
168    ///
169    ///
170    /// #### `nm-plugin-missing`
171    ///  When [`true`] indicates that the NetworkManager plugin for the device
172    /// is not installed.
173    ///
174    /// Readable
175    ///
176    ///
177    /// #### `path`
178    ///  The device path as exposed by the udev property ID_PATH.
179    ///
180    /// The string is backslash escaped (C escaping) for invalid
181    /// characters. The escaping can be reverted with g_strcompress(),
182    /// however the result may not be valid UTF-8.
183    ///
184    /// Readable
185    ///
186    ///
187    /// #### `physical-port-id`
188    ///  The physical port ID of the device. (See
189    /// nm_device_get_physical_port_id().)
190    ///
191    /// Readable
192    ///
193    ///
194    /// #### `ports`
195    ///  The port devices of the controller device. For devices that cannot be
196    /// controllers this is likely to be always empty.
197    ///
198    /// Readable
199    ///
200    ///
201    /// #### `product`
202    ///  The product string of the device.
203    ///
204    /// Readable
205    ///
206    ///
207    /// #### `real`
208    ///  Whether the device is real or is a placeholder device that could
209    /// be created automatically by NetworkManager if one of its
210    /// #NMDevice:available-connections was activated.
211    ///
212    /// Readable
213    ///
214    ///
215    /// #### `state`
216    ///  The state of the device.
217    ///
218    /// Readable
219    ///
220    ///
221    /// #### `state-reason`
222    ///  The reason for the device state.
223    ///
224    /// Readable
225    ///
226    ///
227    /// #### `udi`
228    ///  An operating-system specific device hardware identifier; this is not
229    /// unique to a specific hardware device across reboots or hotplugs.  It
230    /// is an opaque string which for some device types (Bluetooth, Modem)
231    /// contains an identifier provided by the underlying hardware service daemon
232    /// such as Bluez or ModemManager, and clients can use this property to
233    /// request more information about the device from those services.
234    ///
235    /// Readable
236    ///
237    ///
238    /// #### `vendor`
239    ///  The vendor string of the device.
240    ///
241    /// Readable
242    /// <details><summary><h4>Object</h4></summary>
243    ///
244    ///
245    /// #### `client`
246    ///  The NMClient instance as returned by nm_object_get_client().
247    ///
248    /// When an NMObject gets removed from the NMClient cache,
249    /// the NMObject:path property stays unchanged, but this client
250    /// instance gets reset to [`None`]. You can use this property to
251    /// track removal of the object from the cache.
252    ///
253    /// Readable
254    ///
255    ///
256    /// #### `path`
257    ///  The D-Bus object path.
258    ///
259    /// The D-Bus path of an object instance never changes, even if the object
260    /// gets removed from the cache. To see whether the object is still in the
261    /// cache, check NMObject:client.
262    ///
263    /// Readable
264    /// </details>
265    ///
266    /// ## Signals
267    ///
268    ///
269    /// #### `state-changed`
270    ///  Notifies the state change of a #NMDevice.
271    ///
272    ///
273    ///
274    /// # Implements
275    ///
276    /// [`DeviceExt`][trait@crate::prelude::DeviceExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
277    #[doc(alias = "NMDevice")]
278    pub struct Device(Object<ffi::NMDevice, ffi::NMDeviceClass>) @extends Object;
279
280    match fn {
281        type_ => || ffi::nm_device_get_type(),
282    }
283}
284
285impl Device {
286        pub const NONE: Option<&'static Device> = None;
287    
288
289    /// Generates a list of short-ish unique presentation names for the
290    /// devices in @devices.
291    /// ## `devices`
292    /// an array of #NMDevice
293    ///
294    /// # Returns
295    ///
296    /// the device names
297    #[doc(alias = "nm_device_disambiguate_names")]
298    pub fn disambiguate_names(devices: &[Device]) -> Vec<glib::GString> {
299        assert_initialized_main_thread!();
300        let num_devices = devices.len() as _;
301        unsafe {
302            FromGlibPtrContainer::from_glib_full(ffi::nm_device_disambiguate_names(devices.to_glib_none().0, num_devices))
303        }
304    }
305}
306
307/// Trait containing all [`struct@Device`] methods.
308///
309/// # Implementors
310///
311/// [`Device6Lowpan`][struct@crate::Device6Lowpan], [`DeviceAdsl`][struct@crate::DeviceAdsl], [`DeviceBond`][struct@crate::DeviceBond], [`DeviceBridge`][struct@crate::DeviceBridge], [`DeviceBt`][struct@crate::DeviceBt], [`DeviceDummy`][struct@crate::DeviceDummy], [`DeviceEthernet`][struct@crate::DeviceEthernet], [`DeviceGeneric`][struct@crate::DeviceGeneric], [`DeviceHsr`][struct@crate::DeviceHsr], [`DeviceIPTunnel`][struct@crate::DeviceIPTunnel], [`DeviceInfiniband`][struct@crate::DeviceInfiniband], [`DeviceIpvlan`][struct@crate::DeviceIpvlan], [`DeviceLoopback`][struct@crate::DeviceLoopback], [`DeviceMacsec`][struct@crate::DeviceMacsec], [`DeviceMacvlan`][struct@crate::DeviceMacvlan], [`DeviceModem`][struct@crate::DeviceModem], [`DeviceOlpcMesh`][struct@crate::DeviceOlpcMesh], [`DeviceOvsBridge`][struct@crate::DeviceOvsBridge], [`DeviceOvsPort`][struct@crate::DeviceOvsPort], [`DevicePpp`][struct@crate::DevicePpp], [`DeviceTeam`][struct@crate::DeviceTeam], [`DeviceTun`][struct@crate::DeviceTun], [`DeviceVlan`][struct@crate::DeviceVlan], [`DeviceVrf`][struct@crate::DeviceVrf], [`DeviceVxlan`][struct@crate::DeviceVxlan], [`DeviceWifiP2P`][struct@crate::DeviceWifiP2P], [`DeviceWifi`][struct@crate::DeviceWifi], [`DeviceWimax`][struct@crate::DeviceWimax], [`DeviceWireGuard`][struct@crate::DeviceWireGuard], [`DeviceWpan`][struct@crate::DeviceWpan], [`Device`][struct@crate::Device]
312pub trait DeviceExt: IsA<Device> + 'static {
313    /// Validates a given connection for a given #NMDevice object and returns
314    /// whether the connection may be activated with the device. For example if
315    /// @self is a Wi-Fi device that supports only WEP encryption, the connection
316    /// will only be valid if it is a Wi-Fi connection which describes a WEP or open
317    /// network, and will not be valid if it describes a WPA network, or if it is
318    /// an Ethernet, Bluetooth, WWAN, etc connection that is incompatible with the
319    /// device.
320    ///
321    /// This function does the same as nm_device_connection_valid(), i.e. checking
322    /// compatibility of the given device and connection. But, in addition, it sets
323    /// GError when FALSE is returned.
324    /// ## `connection`
325    /// an #NMConnection to validate against @self
326    ///
327    /// # Returns
328    ///
329    /// [`true`] if the connection may be activated with this device, [`false`]
330    /// if is incompatible with the device's capabilities and characteristics.
331    #[doc(alias = "nm_device_connection_compatible")]
332    fn connection_compatible(&self, connection: &impl IsA<Connection>) -> Result<(), glib::Error> {
333        unsafe {
334            let mut error = std::ptr::null_mut();
335            let is_ok = ffi::nm_device_connection_compatible(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0, &mut error);
336            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
337            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
338        }
339    }
340
341    /// Validates a given connection for a given #NMDevice object and returns
342    /// whether the connection may be activated with the device. For example if
343    /// @self is a Wi-Fi device that supports only WEP encryption, the connection
344    /// will only be valid if it is a Wi-Fi connection which describes a WEP or open
345    /// network, and will not be valid if it describes a WPA network, or if it is
346    /// an Ethernet, Bluetooth, WWAN, etc connection that is incompatible with the
347    /// device.
348    /// ## `connection`
349    /// an #NMConnection to validate against @self
350    ///
351    /// # Returns
352    ///
353    /// [`true`] if the connection may be activated with this device, [`false`]
354    /// if is incompatible with the device's capabilities and characteristics.
355    #[doc(alias = "nm_device_connection_valid")]
356    fn connection_valid(&self, connection: &impl IsA<Connection>) -> bool {
357        unsafe {
358            from_glib(ffi::nm_device_connection_valid(self.as_ref().to_glib_none().0, connection.as_ref().to_glib_none().0))
359        }
360    }
361
362    /// Deletes the software device. Hardware devices can't be deleted.
363    ///
364    /// # Deprecated since 1.22
365    ///
366    /// Use nm_device_delete_async() or GDBusConnection.
367    /// ## `cancellable`
368    /// a #GCancellable, or [`None`]
369    ///
370    /// # Returns
371    ///
372    /// [`true`] on success, [`false`] on error, in which case @error
373    /// will be set.
374    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
375    #[allow(deprecated)]
376    #[doc(alias = "nm_device_delete")]
377    fn delete(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
378        unsafe {
379            let mut error = std::ptr::null_mut();
380            let is_ok = ffi::nm_device_delete(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
381            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
382            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
383        }
384    }
385
386    /// Asynchronously begins deleting the software device. Hardware devices can't
387    /// be deleted.
388    /// ## `cancellable`
389    /// a #GCancellable, or [`None`]
390    /// ## `callback`
391    /// callback to be called when delete operation completes
392    #[doc(alias = "nm_device_delete_async")]
393    fn delete_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
394        
395                let main_context = glib::MainContext::ref_thread_default();
396                let is_main_context_owner = main_context.is_owner();
397                let has_acquired_main_context = (!is_main_context_owner)
398                    .then(|| main_context.acquire().ok())
399                    .flatten();
400                assert!(
401                    is_main_context_owner || has_acquired_main_context.is_some(),
402                    "Async operations only allowed if the thread is owning the MainContext"
403                );
404        
405        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
406        unsafe extern "C" fn delete_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
407            let mut error = std::ptr::null_mut();
408            ffi::nm_device_delete_finish(_source_object as *mut _, res, &mut error);
409            let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
410            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
411            let callback: P = callback.into_inner();
412            callback(result);
413        }
414        let callback = delete_async_trampoline::<P>;
415        unsafe {
416            ffi::nm_device_delete_async(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
417        }
418    }
419
420    
421    fn delete_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
422
423        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
424            obj.delete_async(
425                Some(cancellable),
426                move |res| {
427                    send.resolve(res);
428                },
429            );
430        }))
431    }
432
433    /// Disconnects the device if currently connected, and prevents the device from
434    /// automatically connecting to networks until the next manual network connection
435    /// request.
436    ///
437    /// # Deprecated since 1.22
438    ///
439    /// Use nm_device_disconnect_async() or GDBusConnection.
440    /// ## `cancellable`
441    /// a #GCancellable, or [`None`]
442    ///
443    /// # Returns
444    ///
445    /// [`true`] on success, [`false`] on error, in which case @error will be set.
446    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
447    #[allow(deprecated)]
448    #[doc(alias = "nm_device_disconnect")]
449    fn disconnect(&self, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
450        unsafe {
451            let mut error = std::ptr::null_mut();
452            let is_ok = ffi::nm_device_disconnect(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
453            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
454            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
455        }
456    }
457
458    /// Asynchronously begins disconnecting the device if currently connected, and
459    /// prevents the device from automatically connecting to networks until the next
460    /// manual network connection request.
461    /// ## `cancellable`
462    /// a #GCancellable, or [`None`]
463    /// ## `callback`
464    /// callback to be called when the disconnect operation completes
465    #[doc(alias = "nm_device_disconnect_async")]
466    fn disconnect_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
467        
468                let main_context = glib::MainContext::ref_thread_default();
469                let is_main_context_owner = main_context.is_owner();
470                let has_acquired_main_context = (!is_main_context_owner)
471                    .then(|| main_context.acquire().ok())
472                    .flatten();
473                assert!(
474                    is_main_context_owner || has_acquired_main_context.is_some(),
475                    "Async operations only allowed if the thread is owning the MainContext"
476                );
477        
478        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
479        unsafe extern "C" fn disconnect_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
480            let mut error = std::ptr::null_mut();
481            ffi::nm_device_disconnect_finish(_source_object as *mut _, res, &mut error);
482            let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
483            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
484            let callback: P = callback.into_inner();
485            callback(result);
486        }
487        let callback = disconnect_async_trampoline::<P>;
488        unsafe {
489            ffi::nm_device_disconnect_async(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
490        }
491    }
492
493    
494    fn disconnect_future(&self) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
495
496        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
497            obj.disconnect_async(
498                Some(cancellable),
499                move |res| {
500                    send.resolve(res);
501                },
502            );
503        }))
504    }
505
506    /// Filters a given array of connections for a given #NMDevice object and returns
507    /// connections which may be activated with the device. For example if @self
508    /// is a Wi-Fi device that supports only WEP encryption, the returned array will
509    /// contain any Wi-Fi connections in @connections that allow connection to
510    /// unencrypted or WEP-enabled SSIDs.  The returned array will not contain
511    /// Ethernet, Bluetooth, Wi-Fi WPA connections, or any other connection that is
512    /// incompatible with the device. To get the full list of connections see
513    /// nm_client_get_connections().
514    /// ## `connections`
515    /// an array of #NMConnections to filter
516    ///
517    /// # Returns
518    ///
519    /// an array of
520    /// #NMConnections that could be activated with the given @self.  The array
521    /// should be freed with g_ptr_array_unref() when it is no longer required.
522    ///
523    /// WARNING: the transfer annotation for this function may not work correctly
524    ///   with bindings. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/305.
525    ///   You can filter the list yourself with nm_device_connection_valid().
526    #[doc(alias = "nm_device_filter_connections")]
527    fn filter_connections(&self, connections: &[Connection]) -> Vec<Connection> {
528        unsafe {
529            FromGlibPtrContainer::from_glib_full(ffi::nm_device_filter_connections(self.as_ref().to_glib_none().0, connections.to_glib_none().0))
530        }
531    }
532
533    /// Gets the #NMActiveConnection object which owns this device during activation.
534    ///
535    /// # Returns
536    ///
537    /// the #NMActiveConnection or [`None`] if the device is
538    /// not part of an active connection
539    #[doc(alias = "nm_device_get_active_connection")]
540    #[doc(alias = "get_active_connection")]
541    #[doc(alias = "active-connection")]
542    fn active_connection(&self) -> ActiveConnection {
543        unsafe {
544            from_glib_none(ffi::nm_device_get_active_connection(self.as_ref().to_glib_none().0))
545        }
546    }
547
548    /// Fetch the currently applied connection on the device.
549    ///
550    /// # Deprecated since 1.22
551    ///
552    /// Use nm_device_get_applied_connection_async() or GDBusConnection.
553    /// ## `flags`
554    /// the flags argument. See #NMDeviceReapplyFlags.
555    /// ## `cancellable`
556    /// a #GCancellable, or [`None`]
557    ///
558    /// # Returns
559    ///
560    /// a `NMConnection` with the currently applied settings
561    ///   or [`None`] on error.
562    ///
563    /// The connection is as received from D-Bus and might not validate according
564    /// to nm_connection_verify().
565    ///
566    /// ## `version_id`
567    /// returns the current version id of
568    ///   the applied connection
569    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
570    #[cfg(feature = "v1_2")]
571    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
572    #[allow(deprecated)]
573    #[doc(alias = "nm_device_get_applied_connection")]
574    #[doc(alias = "get_applied_connection")]
575    fn applied_connection(&self, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(Connection, u64), glib::Error> {
576        unsafe {
577            let mut version_id = std::mem::MaybeUninit::uninit();
578            let mut error = std::ptr::null_mut();
579            let ret = ffi::nm_device_get_applied_connection(self.as_ref().to_glib_none().0, flags, version_id.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
580            if error.is_null() { Ok((from_glib_full(ret), version_id.assume_init())) } else { Err(from_glib_full(error)) }
581        }
582    }
583
584    /// Asynchronously begins and gets the currently applied connection.
585    /// ## `flags`
586    /// the flags argument. See #NMDeviceReapplyFlags.
587    /// ## `cancellable`
588    /// a #GCancellable, or [`None`]
589    /// ## `callback`
590    /// callback to be called when the reapply operation completes
591    #[cfg(feature = "v1_2")]
592    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
593    #[doc(alias = "nm_device_get_applied_connection_async")]
594    #[doc(alias = "get_applied_connection_async")]
595    fn applied_connection_async<P: FnOnce(Result<(Connection, u64), glib::Error>) + 'static>(&self, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
596        
597                let main_context = glib::MainContext::ref_thread_default();
598                let is_main_context_owner = main_context.is_owner();
599                let has_acquired_main_context = (!is_main_context_owner)
600                    .then(|| main_context.acquire().ok())
601                    .flatten();
602                assert!(
603                    is_main_context_owner || has_acquired_main_context.is_some(),
604                    "Async operations only allowed if the thread is owning the MainContext"
605                );
606        
607        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
608        unsafe extern "C" fn applied_connection_async_trampoline<P: FnOnce(Result<(Connection, u64), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
609            let mut error = std::ptr::null_mut();
610            let mut version_id = std::mem::MaybeUninit::uninit();
611            let ret = ffi::nm_device_get_applied_connection_finish(_source_object as *mut _, res, version_id.as_mut_ptr(), &mut error);
612            let result = if error.is_null() { Ok((from_glib_full(ret), version_id.assume_init())) } else { Err(from_glib_full(error)) };
613            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
614            let callback: P = callback.into_inner();
615            callback(result);
616        }
617        let callback = applied_connection_async_trampoline::<P>;
618        unsafe {
619            ffi::nm_device_get_applied_connection_async(self.as_ref().to_glib_none().0, flags, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
620        }
621    }
622
623    
624    #[cfg(feature = "v1_2")]
625    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
626    fn applied_connection_future(&self, flags: u32) -> Pin<Box_<dyn std::future::Future<Output = Result<(Connection, u64), glib::Error>> + 'static>> {
627
628        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
629            obj.applied_connection_async(
630                flags,
631                Some(cancellable),
632                move |res| {
633                    send.resolve(res);
634                },
635            );
636        }))
637    }
638
639    /// Whether the #NMDevice can be autoconnected.
640    ///
641    /// # Returns
642    ///
643    /// [`true`] if the device is allowed to be autoconnected
644    #[doc(alias = "nm_device_get_autoconnect")]
645    #[doc(alias = "get_autoconnect")]
646    #[doc(alias = "autoconnect")]
647    fn is_autoconnect(&self) -> bool {
648        unsafe {
649            from_glib(ffi::nm_device_get_autoconnect(self.as_ref().to_glib_none().0))
650        }
651    }
652
653    /// Gets the #NMRemoteConnections currently known to the daemon that could
654    /// be activated on @self.
655    ///
656    /// # Returns
657    ///
658    /// the #GPtrArray
659    /// containing #NMRemoteConnections. This is the internal copy used by
660    /// the connection, and must not be modified.
661    #[doc(alias = "nm_device_get_available_connections")]
662    #[doc(alias = "get_available_connections")]
663    #[doc(alias = "available-connections")]
664    fn available_connections(&self) -> Vec<RemoteConnection> {
665        unsafe {
666            FromGlibPtrContainer::from_glib_none(ffi::nm_device_get_available_connections(self.as_ref().to_glib_none().0))
667        }
668    }
669
670    /// Gets the device' capabilities.
671    ///
672    /// # Returns
673    ///
674    /// the capabilities
675    #[doc(alias = "nm_device_get_capabilities")]
676    #[doc(alias = "get_capabilities")]
677    fn capabilities(&self) -> DeviceCapabilities {
678        unsafe {
679            from_glib(ffi::nm_device_get_capabilities(self.as_ref().to_glib_none().0))
680        }
681    }
682
683    /// The connectivity state of the device for given address family.
684    /// Supported address families are `AF_INET` for IPv4, `AF_INET6`
685    /// for IPv6 or `AF_UNSPEC` for any.
686    /// ## `addr_family`
687    /// network address family
688    ///
689    /// # Returns
690    ///
691    /// the current connectivity state
692    #[cfg(feature = "v1_16")]
693    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
694    #[doc(alias = "nm_device_get_connectivity")]
695    #[doc(alias = "get_connectivity")]
696    fn connectivity(&self, addr_family: i32) -> ConnectivityState {
697        unsafe {
698            from_glib(ffi::nm_device_get_connectivity(self.as_ref().to_glib_none().0, addr_family))
699        }
700    }
701
702    /// Gets a description of @self, based on its vendor and product names.
703    ///
704    /// # Returns
705    ///
706    /// a description of @self. If either the vendor or the
707    ///   product name is unknown, this returns the interface name.
708    #[doc(alias = "nm_device_get_description")]
709    #[doc(alias = "get_description")]
710    fn description(&self) -> glib::GString {
711        unsafe {
712            from_glib_none(ffi::nm_device_get_description(self.as_ref().to_glib_none().0))
713        }
714    }
715
716    /// Returns the numeric type of the #NMDevice, ie Ethernet, Wi-Fi, etc.
717    ///
718    /// # Returns
719    ///
720    /// the device type
721    #[doc(alias = "nm_device_get_device_type")]
722    #[doc(alias = "get_device_type")]
723    #[doc(alias = "device-type")]
724    fn device_type(&self) -> DeviceType {
725        unsafe {
726            from_glib(ffi::nm_device_get_device_type(self.as_ref().to_glib_none().0))
727        }
728    }
729
730    /// Gets the current IPv4 #NMDhcpConfig associated with the #NMDevice.
731    ///
732    /// You can alternatively use nm_active_connection_get_dhcp4_config(), which also
733    /// works with VPN connections.
734    ///
735    /// # Returns
736    ///
737    /// the IPv4 #NMDhcpConfig, or [`None`] if the device is
738    /// not activated or not using DHCP.
739    #[doc(alias = "nm_device_get_dhcp4_config")]
740    #[doc(alias = "get_dhcp4_config")]
741    #[doc(alias = "dhcp4-config")]
742    fn dhcp4_config(&self) -> DhcpConfig {
743        unsafe {
744            from_glib_none(ffi::nm_device_get_dhcp4_config(self.as_ref().to_glib_none().0))
745        }
746    }
747
748    /// Gets the current IPv6 #NMDhcpConfig associated with the #NMDevice.
749    ///
750    /// You can alternatively use nm_active_connection_get_dhcp6_config(), which also
751    /// works with VPN connections.
752    ///
753    /// # Returns
754    ///
755    /// the IPv6 #NMDhcpConfig, or [`None`] if the device is
756    /// not activated or not using DHCPv6.
757    #[doc(alias = "nm_device_get_dhcp6_config")]
758    #[doc(alias = "get_dhcp6_config")]
759    #[doc(alias = "dhcp6-config")]
760    fn dhcp6_config(&self) -> DhcpConfig {
761        unsafe {
762            from_glib_none(ffi::nm_device_get_dhcp6_config(self.as_ref().to_glib_none().0))
763        }
764    }
765
766    /// Gets the driver of the #NMDevice.
767    ///
768    /// # Returns
769    ///
770    /// the driver of the device. This is the internal string used by the
771    /// device, and must not be modified.
772    #[doc(alias = "nm_device_get_driver")]
773    #[doc(alias = "get_driver")]
774    fn driver(&self) -> glib::GString {
775        unsafe {
776            from_glib_none(ffi::nm_device_get_driver(self.as_ref().to_glib_none().0))
777        }
778    }
779
780    /// Gets the driver version of the #NMDevice.
781    ///
782    /// # Returns
783    ///
784    /// the version of the device driver. This is the internal string used by the
785    /// device, and must not be modified.
786    #[doc(alias = "nm_device_get_driver_version")]
787    #[doc(alias = "get_driver_version")]
788    #[doc(alias = "driver-version")]
789    fn driver_version(&self) -> glib::GString {
790        unsafe {
791            from_glib_none(ffi::nm_device_get_driver_version(self.as_ref().to_glib_none().0))
792        }
793    }
794
795    /// Indicates that firmware required for the device's operation is likely
796    /// to be missing.
797    ///
798    /// # Returns
799    ///
800    /// [`true`] if firmware required for the device's operation is likely
801    /// to be missing.
802    #[doc(alias = "nm_device_get_firmware_missing")]
803    #[doc(alias = "get_firmware_missing")]
804    #[doc(alias = "firmware-missing")]
805    fn is_firmware_missing(&self) -> bool {
806        unsafe {
807            from_glib(ffi::nm_device_get_firmware_missing(self.as_ref().to_glib_none().0))
808        }
809    }
810
811    /// Gets the firmware version of the #NMDevice.
812    ///
813    /// # Returns
814    ///
815    /// the firmware version of the device. This is the internal string used by the
816    /// device, and must not be modified.
817    #[doc(alias = "nm_device_get_firmware_version")]
818    #[doc(alias = "get_firmware_version")]
819    #[doc(alias = "firmware-version")]
820    fn firmware_version(&self) -> glib::GString {
821        unsafe {
822            from_glib_none(ffi::nm_device_get_firmware_version(self.as_ref().to_glib_none().0))
823        }
824    }
825
826    /// Gets the current a hardware address (MAC) for the @self.
827    ///
828    /// # Returns
829    ///
830    /// the current MAC of the device, or [`None`].
831    /// This is the internal string used by the device, and must not be modified.
832    #[doc(alias = "nm_device_get_hw_address")]
833    #[doc(alias = "get_hw_address")]
834    #[doc(alias = "hw-address")]
835    fn hw_address(&self) -> glib::GString {
836        unsafe {
837            from_glib_none(ffi::nm_device_get_hw_address(self.as_ref().to_glib_none().0))
838        }
839    }
840
841    /// Gets the interface name of the #NMDevice.
842    ///
843    /// # Returns
844    ///
845    /// the interface of the device. This is the internal string used by the
846    /// device, and must not be modified.
847    #[doc(alias = "nm_device_get_iface")]
848    #[doc(alias = "get_iface")]
849    fn iface(&self) -> glib::GString {
850        unsafe {
851            from_glib_none(ffi::nm_device_get_iface(self.as_ref().to_glib_none().0))
852        }
853    }
854
855    /// Gets the interface flags of the device.
856    ///
857    /// # Returns
858    ///
859    /// the flags
860    #[cfg(feature = "v1_22")]
861    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
862    #[doc(alias = "nm_device_get_interface_flags")]
863    #[doc(alias = "get_interface_flags")]
864    #[doc(alias = "interface-flags")]
865    fn interface_flags(&self) -> DeviceInterfaceFlags {
866        unsafe {
867            from_glib(ffi::nm_device_get_interface_flags(self.as_ref().to_glib_none().0))
868        }
869    }
870
871    /// Gets the current IPv4 #NMIPConfig associated with the #NMDevice.
872    ///
873    /// You can alternatively use nm_active_connection_get_ip4_config(), which also
874    /// works with VPN connections.
875    ///
876    /// # Returns
877    ///
878    /// the IPv4 #NMIPConfig, or [`None`] if the device is not
879    /// activated.
880    #[doc(alias = "nm_device_get_ip4_config")]
881    #[doc(alias = "get_ip4_config")]
882    #[doc(alias = "ip4-config")]
883    fn ip4_config(&self) -> IPConfig {
884        unsafe {
885            from_glib_none(ffi::nm_device_get_ip4_config(self.as_ref().to_glib_none().0))
886        }
887    }
888
889    /// Gets the current IPv6 #NMIPConfig associated with the #NMDevice.
890    ///
891    /// You can alternatively use nm_active_connection_get_ip6_config(), which also
892    /// works with VPN connections.
893    ///
894    /// # Returns
895    ///
896    /// the IPv6 #NMIPConfig or [`None`] if the device is not activated.
897    #[doc(alias = "nm_device_get_ip6_config")]
898    #[doc(alias = "get_ip6_config")]
899    #[doc(alias = "ip6-config")]
900    fn ip6_config(&self) -> IPConfig {
901        unsafe {
902            from_glib_none(ffi::nm_device_get_ip6_config(self.as_ref().to_glib_none().0))
903        }
904    }
905
906    /// Gets the IP interface name of the #NMDevice over which IP traffic flows
907    /// when the device is in the ACTIVATED state.
908    ///
909    /// # Returns
910    ///
911    /// the IP traffic interface of the device. This is the internal string
912    /// used by the device, and must not be modified.
913    #[doc(alias = "nm_device_get_ip_iface")]
914    #[doc(alias = "get_ip_iface")]
915    fn ip_iface(&self) -> glib::GString {
916        unsafe {
917            from_glib_none(ffi::nm_device_get_ip_iface(self.as_ref().to_glib_none().0))
918        }
919    }
920
921    /// Gets the list of neighbors discovered through LLDP.
922    ///
923    /// # Returns
924    ///
925    /// the #GPtrArray
926    /// containing #NMLldpNeighbor<!-- -->s. This is the internal copy used by the
927    /// device and must not be modified. The library never modifies the returned
928    /// array and thus it is safe for callers to reference and keep using it.
929    #[cfg(feature = "v1_2")]
930    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
931    #[doc(alias = "nm_device_get_lldp_neighbors")]
932    #[doc(alias = "get_lldp_neighbors")]
933    #[doc(alias = "lldp-neighbors")]
934    fn lldp_neighbors(&self) -> Vec<LldpNeighbor> {
935        unsafe {
936            FromGlibPtrContainer::from_glib_none(ffi::nm_device_get_lldp_neighbors(self.as_ref().to_glib_none().0))
937        }
938    }
939
940    /// Whether the #NMDevice is managed by NetworkManager.
941    ///
942    /// # Returns
943    ///
944    /// [`true`] if the device is managed by NetworkManager
945    #[doc(alias = "nm_device_get_managed")]
946    #[doc(alias = "get_managed")]
947    #[doc(alias = "managed")]
948    fn is_managed(&self) -> bool {
949        unsafe {
950            from_glib(ffi::nm_device_get_managed(self.as_ref().to_glib_none().0))
951        }
952    }
953
954    /// Gets the metered setting of a #NMDevice.
955    ///
956    /// # Returns
957    ///
958    /// the metered setting.
959    #[cfg(feature = "v1_2")]
960    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
961    #[doc(alias = "nm_device_get_metered")]
962    #[doc(alias = "get_metered")]
963    fn metered(&self) -> Metered {
964        unsafe {
965            from_glib(ffi::nm_device_get_metered(self.as_ref().to_glib_none().0))
966        }
967    }
968
969    /// Gets the  MTU of the #NMDevice.
970    ///
971    /// # Returns
972    ///
973    /// the MTU of the device in bytes.
974    #[doc(alias = "nm_device_get_mtu")]
975    #[doc(alias = "get_mtu")]
976    fn mtu(&self) -> u32 {
977        unsafe {
978            ffi::nm_device_get_mtu(self.as_ref().to_glib_none().0)
979        }
980    }
981
982    /// Indicates that the NetworkManager plugin for the device is not installed.
983    ///
984    /// # Returns
985    ///
986    /// [`true`] if the device plugin not installed.
987    #[cfg(feature = "v1_2")]
988    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
989    #[doc(alias = "nm_device_get_nm_plugin_missing")]
990    #[doc(alias = "get_nm_plugin_missing")]
991    #[doc(alias = "nm-plugin-missing")]
992    fn is_nm_plugin_missing(&self) -> bool {
993        unsafe {
994            from_glib(ffi::nm_device_get_nm_plugin_missing(self.as_ref().to_glib_none().0))
995        }
996    }
997
998    /// Gets the path of the #NMDevice as exposed by the udev property ID_PATH.
999    ///
1000    /// # Returns
1001    ///
1002    /// the path of the device.
1003    ///
1004    /// The string is backslash escaped (C escaping) for invalid characters. The escaping
1005    /// can be reverted with g_strcompress(), however the result may not be valid UTF-8.
1006    #[cfg(feature = "v1_26")]
1007    #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
1008    #[doc(alias = "nm_device_get_path")]
1009    #[doc(alias = "get_path")]
1010    fn path(&self) -> glib::GString {
1011        unsafe {
1012            from_glib_none(ffi::nm_device_get_path(self.as_ref().to_glib_none().0))
1013        }
1014    }
1015
1016    /// Gets the physical port ID of the #NMDevice. If non-[`None`], this is
1017    /// an opaque string that can be used to recognize when
1018    /// seemingly-unrelated #NMDevices are actually just different virtual
1019    /// ports on a single physical port. (Eg, NPAR / SR-IOV.)
1020    ///
1021    /// # Returns
1022    ///
1023    /// the physical port ID of the device, or [`None`] if the port
1024    ///   ID is unknown. This is the internal string used by the device and
1025    ///   must not be modified.
1026    #[doc(alias = "nm_device_get_physical_port_id")]
1027    #[doc(alias = "get_physical_port_id")]
1028    #[doc(alias = "physical-port-id")]
1029    fn physical_port_id(&self) -> glib::GString {
1030        unsafe {
1031            from_glib_none(ffi::nm_device_get_physical_port_id(self.as_ref().to_glib_none().0))
1032        }
1033    }
1034
1035    /// Gets the devices currently set as port of @self.
1036    ///
1037    /// # Returns
1038    ///
1039    /// the #GPtrArray containing #NMDevices that
1040    /// are ports of @self. This is the internal copy used by the device and
1041    /// must not be modified.
1042    #[cfg(feature = "v1_34")]
1043    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
1044    #[doc(alias = "nm_device_get_ports")]
1045    #[doc(alias = "get_ports")]
1046    fn ports(&self) -> Vec<Device> {
1047        unsafe {
1048            FromGlibPtrContainer::from_glib_none(ffi::nm_device_get_ports(self.as_ref().to_glib_none().0))
1049        }
1050    }
1051
1052    /// Gets the product string of the #NMDevice.
1053    ///
1054    /// # Returns
1055    ///
1056    /// the product name of the device. This is the internal string used by the
1057    /// device, and must not be modified.
1058    ///
1059    /// The string is backslash escaped (C escaping) for invalid characters. The escaping
1060    /// can be reverted with g_strcompress(), however the result may not be valid UTF-8.
1061    #[doc(alias = "nm_device_get_product")]
1062    #[doc(alias = "get_product")]
1063    fn product(&self) -> glib::GString {
1064        unsafe {
1065            from_glib_none(ffi::nm_device_get_product(self.as_ref().to_glib_none().0))
1066        }
1067    }
1068
1069    /// Gets the (primary) #NMSetting subtype associated with connections
1070    /// that can be used on @self.
1071    ///
1072    /// # Returns
1073    ///
1074    /// @self's associated #NMSetting type
1075    #[doc(alias = "nm_device_get_setting_type")]
1076    #[doc(alias = "get_setting_type")]
1077    fn setting_type(&self) -> glib::types::Type {
1078        unsafe {
1079            from_glib(ffi::nm_device_get_setting_type(self.as_ref().to_glib_none().0))
1080        }
1081    }
1082
1083    /// Gets the current #NMDevice state.
1084    ///
1085    /// # Returns
1086    ///
1087    /// the current device state
1088    #[doc(alias = "nm_device_get_state")]
1089    #[doc(alias = "get_state")]
1090    fn state(&self) -> DeviceState {
1091        unsafe {
1092            from_glib(ffi::nm_device_get_state(self.as_ref().to_glib_none().0))
1093        }
1094    }
1095
1096    /// Gets the reason for entering the current #NMDevice state.
1097    ///
1098    /// # Returns
1099    ///
1100    /// the reason for entering the current device state
1101    #[doc(alias = "nm_device_get_state_reason")]
1102    #[doc(alias = "get_state_reason")]
1103    #[doc(alias = "state-reason")]
1104    fn state_reason(&self) -> DeviceStateReason {
1105        unsafe {
1106            from_glib(ffi::nm_device_get_state_reason(self.as_ref().to_glib_none().0))
1107        }
1108    }
1109
1110    /// Gets a (non-localized) description of the type of device that
1111    /// @self is.
1112    ///
1113    /// # Returns
1114    ///
1115    /// the type description of the device. This is the internal
1116    /// string used by the device, and must not be modified.
1117    #[doc(alias = "nm_device_get_type_description")]
1118    #[doc(alias = "get_type_description")]
1119    fn type_description(&self) -> glib::GString {
1120        unsafe {
1121            from_glib_none(ffi::nm_device_get_type_description(self.as_ref().to_glib_none().0))
1122        }
1123    }
1124
1125    /// Gets the Unique Device Identifier of the #NMDevice.
1126    ///
1127    /// # Returns
1128    ///
1129    /// the Unique Device Identifier of the device.  This identifier may be
1130    /// used to gather more information about the device from various operating
1131    /// system services like udev or sysfs.
1132    #[doc(alias = "nm_device_get_udi")]
1133    #[doc(alias = "get_udi")]
1134    fn udi(&self) -> glib::GString {
1135        unsafe {
1136            from_glib_none(ffi::nm_device_get_udi(self.as_ref().to_glib_none().0))
1137        }
1138    }
1139
1140    /// Gets the vendor string of the #NMDevice.
1141    ///
1142    /// # Returns
1143    ///
1144    /// the vendor name of the device. This is the internal string used by the
1145    /// device, and must not be modified.
1146    ///
1147    /// The string is backslash escaped (C escaping) for invalid characters. The escaping
1148    /// can be reverted with g_strcompress(), however the result may not be valid UTF-8.
1149    #[doc(alias = "nm_device_get_vendor")]
1150    #[doc(alias = "get_vendor")]
1151    fn vendor(&self) -> glib::GString {
1152        unsafe {
1153            from_glib_none(ffi::nm_device_get_vendor(self.as_ref().to_glib_none().0))
1154        }
1155    }
1156
1157    ///
1158    /// # Returns
1159    ///
1160    /// [`true`] if the device exists, or [`false`] if it is a placeholder device
1161    /// that could be automatically created by NetworkManager if one of its
1162    /// #NMDevice:available-connections was activated.
1163    #[cfg(feature = "v1_2")]
1164    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1165    #[doc(alias = "nm_device_is_real")]
1166    #[doc(alias = "real")]
1167    fn is_real(&self) -> bool {
1168        unsafe {
1169            from_glib(ffi::nm_device_is_real(self.as_ref().to_glib_none().0))
1170        }
1171    }
1172
1173    /// Whether the device is a software device.
1174    ///
1175    /// # Returns
1176    ///
1177    /// [`true`] if @self is a software device, [`false`] if it is a hardware device.
1178    #[doc(alias = "nm_device_is_software")]
1179    fn is_software(&self) -> bool {
1180        unsafe {
1181            from_glib(ffi::nm_device_is_software(self.as_ref().to_glib_none().0))
1182        }
1183    }
1184
1185    /// Attempts to update device with changes to the currently active connection
1186    /// made since it was last applied.
1187    ///
1188    /// # Deprecated since 1.22
1189    ///
1190    /// Use nm_device_reapply_async() or GDBusConnection.
1191    /// ## `connection`
1192    /// the #NMConnection to replace the applied
1193    ///   settings with or [`None`] to reuse existing
1194    /// ## `version_id`
1195    /// zero or the expected version id of the applied connection.
1196    ///   If specified and the version id mismatches, the call fails without
1197    ///   modification. This allows one to catch concurrent accesses.
1198    /// ## `flags`
1199    /// always set this to zero
1200    /// ## `cancellable`
1201    /// a #GCancellable, or [`None`]
1202    ///
1203    /// # Returns
1204    ///
1205    /// [`true`] on success, [`false`] on error, in which case @error will be set.
1206    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
1207    #[cfg(feature = "v1_2")]
1208    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1209    #[allow(deprecated)]
1210    #[doc(alias = "nm_device_reapply")]
1211    fn reapply(&self, connection: Option<&impl IsA<Connection>>, version_id: u64, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
1212        unsafe {
1213            let mut error = std::ptr::null_mut();
1214            let is_ok = ffi::nm_device_reapply(self.as_ref().to_glib_none().0, connection.map(|p| p.as_ref()).to_glib_none().0, version_id, flags, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
1215            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
1216            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
1217        }
1218    }
1219
1220    /// Asynchronously begins an attempt to update device with changes to the
1221    /// currently active connection made since it was last applied.
1222    /// ## `connection`
1223    /// the #NMConnection to replace the applied
1224    ///   settings with or [`None`] to reuse existing
1225    /// ## `version_id`
1226    /// zero or the expected version id of the applied
1227    ///   connection. If specified and the version id mismatches, the call
1228    ///   fails without modification. This allows one to catch concurrent
1229    ///   accesses.
1230    /// ## `flags`
1231    /// always set this to zero
1232    /// ## `cancellable`
1233    /// a #GCancellable, or [`None`]
1234    /// ## `callback`
1235    /// callback to be called when the reapply operation completes
1236    #[cfg(feature = "v1_2")]
1237    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1238    #[doc(alias = "nm_device_reapply_async")]
1239    fn reapply_async<P: FnOnce(Result<(), glib::Error>) + 'static>(&self, connection: Option<&impl IsA<Connection>>, version_id: u64, flags: u32, cancellable: Option<&impl IsA<gio::Cancellable>>, callback: P) {
1240        
1241                let main_context = glib::MainContext::ref_thread_default();
1242                let is_main_context_owner = main_context.is_owner();
1243                let has_acquired_main_context = (!is_main_context_owner)
1244                    .then(|| main_context.acquire().ok())
1245                    .flatten();
1246                assert!(
1247                    is_main_context_owner || has_acquired_main_context.is_some(),
1248                    "Async operations only allowed if the thread is owning the MainContext"
1249                );
1250        
1251        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::new(glib::thread_guard::ThreadGuard::new(callback));
1252        unsafe extern "C" fn reapply_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) {
1253            let mut error = std::ptr::null_mut();
1254            ffi::nm_device_reapply_finish(_source_object as *mut _, res, &mut error);
1255            let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) };
1256            let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _);
1257            let callback: P = callback.into_inner();
1258            callback(result);
1259        }
1260        let callback = reapply_async_trampoline::<P>;
1261        unsafe {
1262            ffi::nm_device_reapply_async(self.as_ref().to_glib_none().0, connection.map(|p| p.as_ref()).to_glib_none().0, version_id, flags, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _);
1263        }
1264    }
1265
1266    
1267    #[cfg(feature = "v1_2")]
1268    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1269    fn reapply_future(&self, connection: Option<&(impl IsA<Connection> + Clone + 'static)>, version_id: u64, flags: u32) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
1270
1271        let connection = connection.map(ToOwned::to_owned);
1272        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
1273            obj.reapply_async(
1274                connection.as_ref().map(::std::borrow::Borrow::borrow),
1275                version_id,
1276                flags,
1277                Some(cancellable),
1278                move |res| {
1279                    send.resolve(res);
1280                },
1281            );
1282        }))
1283    }
1284
1285    /// Enables or disables automatic activation of the #NMDevice.
1286    ///
1287    /// # Deprecated since 1.22
1288    ///
1289    /// Use the async command nm_client_dbus_set_property() on
1290    /// nm_object_get_path(), `NM_DBUS_INTERFACE_DEVICE` to set "Autoconnect" property to a "(b)" value.
1291    /// This function is deprecated because it calls a synchronous D-Bus method
1292    /// and modifies the content of the NMClient cache client side.
1293    /// ## `autoconnect`
1294    /// [`true`] to enable autoconnecting
1295    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
1296    #[allow(deprecated)]
1297    #[doc(alias = "nm_device_set_autoconnect")]
1298    #[doc(alias = "autoconnect")]
1299    fn set_autoconnect(&self, autoconnect: bool) {
1300        unsafe {
1301            ffi::nm_device_set_autoconnect(self.as_ref().to_glib_none().0, autoconnect.into_glib());
1302        }
1303    }
1304
1305    /// Enables or disables management of  #NMDevice by NetworkManager.
1306    ///
1307    /// # Deprecated since 1.22
1308    ///
1309    /// Use the async command nm_client_dbus_set_property() on
1310    /// nm_object_get_path(), interface `NM_DBUS_INTERFACE_DEVICE` to set the
1311    /// "Managed" property to a "(b)" boolean value.
1312    /// This function is deprecated because it calls a synchronous D-Bus method
1313    /// and modifies the content of the NMClient cache client side. Also, it does
1314    /// not emit a property changed signal.
1315    /// ## `managed`
1316    /// [`true`] to make the device managed by NetworkManager.
1317    #[cfg_attr(feature = "v1_22", deprecated = "Since 1.22")]
1318    #[cfg(feature = "v1_2")]
1319    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1320    #[allow(deprecated)]
1321    #[doc(alias = "nm_device_set_managed")]
1322    fn set_managed(&self, managed: bool) {
1323        unsafe {
1324            ffi::nm_device_set_managed(self.as_ref().to_glib_none().0, managed.into_glib());
1325        }
1326    }
1327
1328    /// The interface of the device.
1329    fn interface(&self) -> Option<glib::GString> {
1330        ObjectExt::property(self.as_ref(), "interface")
1331    }
1332
1333    /// The IP interface of the device which should be used for all IP-related
1334    /// operations like addressing and routing.
1335    #[doc(alias = "ip-interface")]
1336    fn ip_interface(&self) -> Option<glib::GString> {
1337        ObjectExt::property(self.as_ref(), "ip-interface")
1338    }
1339
1340    /// The IPv4 connectivity state of the device.
1341    #[cfg(feature = "v1_16")]
1342    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1343    #[doc(alias = "ip4-connectivity")]
1344    fn ip4_connectivity(&self) -> ConnectivityState {
1345        ObjectExt::property(self.as_ref(), "ip4-connectivity")
1346    }
1347
1348    /// The IPv6 connectivity state of the device.
1349    #[cfg(feature = "v1_16")]
1350    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1351    #[doc(alias = "ip6-connectivity")]
1352    fn ip6_connectivity(&self) -> ConnectivityState {
1353        ObjectExt::property(self.as_ref(), "ip6-connectivity")
1354    }
1355
1356    //#[cfg(not(feature = "v1_2"))]
1357    //#[cfg_attr(docsrs, doc(cfg(not(feature = "v1_2"))))]
1358    //#[doc(alias = "lldp-neighbors")]
1359    //fn lldp_neighbors(&self) -> /*Unimplemented*/Vec<Basic: Pointer> {
1360    //    ObjectExt::property(self.as_ref(), "lldp-neighbors")
1361    //}
1362
1363    /// Notifies the state change of a #NMDevice.
1364    /// ## `new_state`
1365    /// the new state of the device
1366    /// ## `old_state`
1367    /// the previous state of the device
1368    /// ## `reason`
1369    /// the reason describing the state change
1370    #[doc(alias = "state-changed")]
1371    fn connect_state_changed<F: Fn(&Self, u32, u32, u32) + 'static>(&self, f: F) -> SignalHandlerId {
1372        unsafe extern "C" fn state_changed_trampoline<P: IsA<Device>, F: Fn(&P, u32, u32, u32) + 'static>(this: *mut ffi::NMDevice, new_state: std::ffi::c_uint, old_state: std::ffi::c_uint, reason: std::ffi::c_uint, f: glib::ffi::gpointer) {
1373            let f: &F = &*(f as *const F);
1374            f(Device::from_glib_borrow(this).unsafe_cast_ref(), new_state, old_state, reason)
1375        }
1376        unsafe {
1377            let f: Box_<F> = Box_::new(f);
1378            connect_raw(self.as_ptr() as *mut _, c"state-changed".as_ptr() as *const _,
1379                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(state_changed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1380        }
1381    }
1382
1383    #[doc(alias = "active-connection")]
1384    fn connect_active_connection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1385        unsafe extern "C" fn notify_active_connection_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1386            let f: &F = &*(f as *const F);
1387            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1388        }
1389        unsafe {
1390            let f: Box_<F> = Box_::new(f);
1391            connect_raw(self.as_ptr() as *mut _, c"notify::active-connection".as_ptr() as *const _,
1392                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_active_connection_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1393        }
1394    }
1395
1396    #[doc(alias = "autoconnect")]
1397    fn connect_autoconnect_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1398        unsafe extern "C" fn notify_autoconnect_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1399            let f: &F = &*(f as *const F);
1400            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1401        }
1402        unsafe {
1403            let f: Box_<F> = Box_::new(f);
1404            connect_raw(self.as_ptr() as *mut _, c"notify::autoconnect".as_ptr() as *const _,
1405                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_autoconnect_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1406        }
1407    }
1408
1409    #[doc(alias = "available-connections")]
1410    fn connect_available_connections_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1411        unsafe extern "C" fn notify_available_connections_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1412            let f: &F = &*(f as *const F);
1413            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1414        }
1415        unsafe {
1416            let f: Box_<F> = Box_::new(f);
1417            connect_raw(self.as_ptr() as *mut _, c"notify::available-connections".as_ptr() as *const _,
1418                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_available_connections_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1419        }
1420    }
1421
1422    #[doc(alias = "capabilities")]
1423    fn connect_capabilities_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1424        unsafe extern "C" fn notify_capabilities_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1425            let f: &F = &*(f as *const F);
1426            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1427        }
1428        unsafe {
1429            let f: Box_<F> = Box_::new(f);
1430            connect_raw(self.as_ptr() as *mut _, c"notify::capabilities".as_ptr() as *const _,
1431                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_capabilities_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1432        }
1433    }
1434
1435    #[doc(alias = "device-type")]
1436    fn connect_device_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1437        unsafe extern "C" fn notify_device_type_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1438            let f: &F = &*(f as *const F);
1439            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1440        }
1441        unsafe {
1442            let f: Box_<F> = Box_::new(f);
1443            connect_raw(self.as_ptr() as *mut _, c"notify::device-type".as_ptr() as *const _,
1444                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_device_type_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1445        }
1446    }
1447
1448    #[doc(alias = "dhcp4-config")]
1449    fn connect_dhcp4_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1450        unsafe extern "C" fn notify_dhcp4_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1451            let f: &F = &*(f as *const F);
1452            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1453        }
1454        unsafe {
1455            let f: Box_<F> = Box_::new(f);
1456            connect_raw(self.as_ptr() as *mut _, c"notify::dhcp4-config".as_ptr() as *const _,
1457                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp4_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1458        }
1459    }
1460
1461    #[doc(alias = "dhcp6-config")]
1462    fn connect_dhcp6_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1463        unsafe extern "C" fn notify_dhcp6_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1464            let f: &F = &*(f as *const F);
1465            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1466        }
1467        unsafe {
1468            let f: Box_<F> = Box_::new(f);
1469            connect_raw(self.as_ptr() as *mut _, c"notify::dhcp6-config".as_ptr() as *const _,
1470                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_dhcp6_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1471        }
1472    }
1473
1474    #[doc(alias = "driver")]
1475    fn connect_driver_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1476        unsafe extern "C" fn notify_driver_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1477            let f: &F = &*(f as *const F);
1478            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1479        }
1480        unsafe {
1481            let f: Box_<F> = Box_::new(f);
1482            connect_raw(self.as_ptr() as *mut _, c"notify::driver".as_ptr() as *const _,
1483                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_driver_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1484        }
1485    }
1486
1487    #[doc(alias = "driver-version")]
1488    fn connect_driver_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1489        unsafe extern "C" fn notify_driver_version_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1490            let f: &F = &*(f as *const F);
1491            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1492        }
1493        unsafe {
1494            let f: Box_<F> = Box_::new(f);
1495            connect_raw(self.as_ptr() as *mut _, c"notify::driver-version".as_ptr() as *const _,
1496                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_driver_version_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1497        }
1498    }
1499
1500    #[doc(alias = "firmware-missing")]
1501    fn connect_firmware_missing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1502        unsafe extern "C" fn notify_firmware_missing_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1503            let f: &F = &*(f as *const F);
1504            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1505        }
1506        unsafe {
1507            let f: Box_<F> = Box_::new(f);
1508            connect_raw(self.as_ptr() as *mut _, c"notify::firmware-missing".as_ptr() as *const _,
1509                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_firmware_missing_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1510        }
1511    }
1512
1513    #[doc(alias = "firmware-version")]
1514    fn connect_firmware_version_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1515        unsafe extern "C" fn notify_firmware_version_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1516            let f: &F = &*(f as *const F);
1517            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1518        }
1519        unsafe {
1520            let f: Box_<F> = Box_::new(f);
1521            connect_raw(self.as_ptr() as *mut _, c"notify::firmware-version".as_ptr() as *const _,
1522                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_firmware_version_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1523        }
1524    }
1525
1526    #[cfg(feature = "v1_24")]
1527    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
1528    #[doc(alias = "hw-address")]
1529    fn connect_hw_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1530        unsafe extern "C" fn notify_hw_address_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1531            let f: &F = &*(f as *const F);
1532            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1533        }
1534        unsafe {
1535            let f: Box_<F> = Box_::new(f);
1536            connect_raw(self.as_ptr() as *mut _, c"notify::hw-address".as_ptr() as *const _,
1537                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_hw_address_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1538        }
1539    }
1540
1541    #[doc(alias = "interface")]
1542    fn connect_interface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1543        unsafe extern "C" fn notify_interface_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1544            let f: &F = &*(f as *const F);
1545            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1546        }
1547        unsafe {
1548            let f: Box_<F> = Box_::new(f);
1549            connect_raw(self.as_ptr() as *mut _, c"notify::interface".as_ptr() as *const _,
1550                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_interface_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1551        }
1552    }
1553
1554    #[cfg(feature = "v1_22")]
1555    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
1556    #[doc(alias = "interface-flags")]
1557    fn connect_interface_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1558        unsafe extern "C" fn notify_interface_flags_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1559            let f: &F = &*(f as *const F);
1560            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1561        }
1562        unsafe {
1563            let f: Box_<F> = Box_::new(f);
1564            connect_raw(self.as_ptr() as *mut _, c"notify::interface-flags".as_ptr() as *const _,
1565                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_interface_flags_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1566        }
1567    }
1568
1569    #[doc(alias = "ip-interface")]
1570    fn connect_ip_interface_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1571        unsafe extern "C" fn notify_ip_interface_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1572            let f: &F = &*(f as *const F);
1573            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1574        }
1575        unsafe {
1576            let f: Box_<F> = Box_::new(f);
1577            connect_raw(self.as_ptr() as *mut _, c"notify::ip-interface".as_ptr() as *const _,
1578                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip_interface_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1579        }
1580    }
1581
1582    #[doc(alias = "ip4-config")]
1583    fn connect_ip4_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1584        unsafe extern "C" fn notify_ip4_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1585            let f: &F = &*(f as *const F);
1586            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1587        }
1588        unsafe {
1589            let f: Box_<F> = Box_::new(f);
1590            connect_raw(self.as_ptr() as *mut _, c"notify::ip4-config".as_ptr() as *const _,
1591                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip4_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1592        }
1593    }
1594
1595    #[cfg(feature = "v1_16")]
1596    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1597    #[doc(alias = "ip4-connectivity")]
1598    fn connect_ip4_connectivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1599        unsafe extern "C" fn notify_ip4_connectivity_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1600            let f: &F = &*(f as *const F);
1601            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1602        }
1603        unsafe {
1604            let f: Box_<F> = Box_::new(f);
1605            connect_raw(self.as_ptr() as *mut _, c"notify::ip4-connectivity".as_ptr() as *const _,
1606                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip4_connectivity_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1607        }
1608    }
1609
1610    #[doc(alias = "ip6-config")]
1611    fn connect_ip6_config_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1612        unsafe extern "C" fn notify_ip6_config_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1613            let f: &F = &*(f as *const F);
1614            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1615        }
1616        unsafe {
1617            let f: Box_<F> = Box_::new(f);
1618            connect_raw(self.as_ptr() as *mut _, c"notify::ip6-config".as_ptr() as *const _,
1619                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip6_config_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1620        }
1621    }
1622
1623    #[cfg(feature = "v1_16")]
1624    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1625    #[doc(alias = "ip6-connectivity")]
1626    fn connect_ip6_connectivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1627        unsafe extern "C" fn notify_ip6_connectivity_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1628            let f: &F = &*(f as *const F);
1629            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1630        }
1631        unsafe {
1632            let f: Box_<F> = Box_::new(f);
1633            connect_raw(self.as_ptr() as *mut _, c"notify::ip6-connectivity".as_ptr() as *const _,
1634                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ip6_connectivity_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1635        }
1636    }
1637
1638    #[doc(alias = "lldp-neighbors")]
1639    fn connect_lldp_neighbors_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1640        unsafe extern "C" fn notify_lldp_neighbors_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1641            let f: &F = &*(f as *const F);
1642            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1643        }
1644        unsafe {
1645            let f: Box_<F> = Box_::new(f);
1646            connect_raw(self.as_ptr() as *mut _, c"notify::lldp-neighbors".as_ptr() as *const _,
1647                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_lldp_neighbors_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1648        }
1649    }
1650
1651    #[doc(alias = "managed")]
1652    fn connect_managed_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1653        unsafe extern "C" fn notify_managed_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1654            let f: &F = &*(f as *const F);
1655            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1656        }
1657        unsafe {
1658            let f: Box_<F> = Box_::new(f);
1659            connect_raw(self.as_ptr() as *mut _, c"notify::managed".as_ptr() as *const _,
1660                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_managed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1661        }
1662    }
1663
1664    #[cfg(feature = "v1_2")]
1665    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1666    #[doc(alias = "metered")]
1667    fn connect_metered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1668        unsafe extern "C" fn notify_metered_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1669            let f: &F = &*(f as *const F);
1670            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1671        }
1672        unsafe {
1673            let f: Box_<F> = Box_::new(f);
1674            connect_raw(self.as_ptr() as *mut _, c"notify::metered".as_ptr() as *const _,
1675                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_metered_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1676        }
1677    }
1678
1679    #[doc(alias = "mtu")]
1680    fn connect_mtu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1681        unsafe extern "C" fn notify_mtu_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1682            let f: &F = &*(f as *const F);
1683            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1684        }
1685        unsafe {
1686            let f: Box_<F> = Box_::new(f);
1687            connect_raw(self.as_ptr() as *mut _, c"notify::mtu".as_ptr() as *const _,
1688                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_mtu_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1689        }
1690    }
1691
1692    #[cfg(feature = "v1_2")]
1693    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1694    #[doc(alias = "nm-plugin-missing")]
1695    fn connect_nm_plugin_missing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1696        unsafe extern "C" fn notify_nm_plugin_missing_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1697            let f: &F = &*(f as *const F);
1698            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1699        }
1700        unsafe {
1701            let f: Box_<F> = Box_::new(f);
1702            connect_raw(self.as_ptr() as *mut _, c"notify::nm-plugin-missing".as_ptr() as *const _,
1703                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_nm_plugin_missing_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1704        }
1705    }
1706
1707    #[doc(alias = "physical-port-id")]
1708    fn connect_physical_port_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1709        unsafe extern "C" fn notify_physical_port_id_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1710            let f: &F = &*(f as *const F);
1711            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1712        }
1713        unsafe {
1714            let f: Box_<F> = Box_::new(f);
1715            connect_raw(self.as_ptr() as *mut _, c"notify::physical-port-id".as_ptr() as *const _,
1716                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_physical_port_id_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1717        }
1718    }
1719
1720    #[cfg(feature = "v1_34")]
1721    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
1722    #[doc(alias = "ports")]
1723    fn connect_ports_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1724        unsafe extern "C" fn notify_ports_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1725            let f: &F = &*(f as *const F);
1726            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1727        }
1728        unsafe {
1729            let f: Box_<F> = Box_::new(f);
1730            connect_raw(self.as_ptr() as *mut _, c"notify::ports".as_ptr() as *const _,
1731                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_ports_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1732        }
1733    }
1734
1735    #[doc(alias = "product")]
1736    fn connect_product_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1737        unsafe extern "C" fn notify_product_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1738            let f: &F = &*(f as *const F);
1739            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1740        }
1741        unsafe {
1742            let f: Box_<F> = Box_::new(f);
1743            connect_raw(self.as_ptr() as *mut _, c"notify::product".as_ptr() as *const _,
1744                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_product_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1745        }
1746    }
1747
1748    #[cfg(feature = "v1_2")]
1749    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1750    #[doc(alias = "real")]
1751    fn connect_real_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1752        unsafe extern "C" fn notify_real_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1753            let f: &F = &*(f as *const F);
1754            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1755        }
1756        unsafe {
1757            let f: Box_<F> = Box_::new(f);
1758            connect_raw(self.as_ptr() as *mut _, c"notify::real".as_ptr() as *const _,
1759                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_real_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1760        }
1761    }
1762
1763    #[doc(alias = "state")]
1764    fn connect_state_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1765        unsafe extern "C" fn notify_state_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1766            let f: &F = &*(f as *const F);
1767            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1768        }
1769        unsafe {
1770            let f: Box_<F> = Box_::new(f);
1771            connect_raw(self.as_ptr() as *mut _, c"notify::state".as_ptr() as *const _,
1772                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_state_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1773        }
1774    }
1775
1776    #[doc(alias = "state-reason")]
1777    fn connect_state_reason_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1778        unsafe extern "C" fn notify_state_reason_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1779            let f: &F = &*(f as *const F);
1780            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1781        }
1782        unsafe {
1783            let f: Box_<F> = Box_::new(f);
1784            connect_raw(self.as_ptr() as *mut _, c"notify::state-reason".as_ptr() as *const _,
1785                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_state_reason_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1786        }
1787    }
1788
1789    #[doc(alias = "udi")]
1790    fn connect_udi_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1791        unsafe extern "C" fn notify_udi_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1792            let f: &F = &*(f as *const F);
1793            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1794        }
1795        unsafe {
1796            let f: Box_<F> = Box_::new(f);
1797            connect_raw(self.as_ptr() as *mut _, c"notify::udi".as_ptr() as *const _,
1798                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_udi_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1799        }
1800    }
1801
1802    #[doc(alias = "vendor")]
1803    fn connect_vendor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1804        unsafe extern "C" fn notify_vendor_trampoline<P: IsA<Device>, F: Fn(&P) + 'static>(this: *mut ffi::NMDevice, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1805            let f: &F = &*(f as *const F);
1806            f(Device::from_glib_borrow(this).unsafe_cast_ref())
1807        }
1808        unsafe {
1809            let f: Box_<F> = Box_::new(f);
1810            connect_raw(self.as_ptr() as *mut _, c"notify::vendor".as_ptr() as *const _,
1811                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_vendor_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
1812        }
1813    }
1814}
1815
1816impl<O: IsA<Device>> DeviceExt for O {}