nm-rs 0.1.3

Rust bindings for the libnm library.
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir
// from gtk-girs (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]

use crate::{ffi,Device,DeviceWifi,Object};
use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `active-channel`
    ///  The device's active channel.
    ///
    /// Readable
    ///
    ///
    /// #### `companion`
    ///  The companion device.
    ///
    /// Readable
    /// <details><summary><h4>Device</h4></summary>
    ///
    ///
    /// #### `active-connection`
    ///  The #NMActiveConnection object that "owns" this device during activation.
    ///
    /// Readable
    ///
    ///
    /// #### `autoconnect`
    ///  Whether the device can auto-activate a connection.
    ///
    /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `available-connections`
    ///  The available connections of the device
    ///
    /// Readable
    ///
    ///
    /// #### `capabilities`
    ///  The capabilities of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `device-type`
    ///  The numeric type of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `dhcp4-config`
    ///  The IPv4 #NMDhcpConfig of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `dhcp6-config`
    ///  The IPv6 #NMDhcpConfig of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `driver`
    ///  The driver of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `driver-version`
    ///  The version of the device driver.
    ///
    /// Readable
    ///
    ///
    /// #### `firmware-missing`
    ///  When [`true`] indicates the device is likely missing firmware required
    /// for its operation.
    ///
    /// Readable
    ///
    ///
    /// #### `firmware-version`
    ///  The firmware version of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `hw-address`
    ///  The hardware address of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `interface`
    ///  The interface of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `interface-flags`
    ///  The interface flags.
    ///
    /// Readable
    ///
    ///
    /// #### `ip-interface`
    ///  The IP interface of the device which should be used for all IP-related
    /// operations like addressing and routing.
    ///
    /// Readable
    ///
    ///
    /// #### `ip4-config`
    ///  The #NMIP4Config of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `ip4-connectivity`
    ///  The IPv4 connectivity state of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `ip6-config`
    ///  The IPv6 #NMIPConfig of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `ip6-connectivity`
    ///  The IPv6 connectivity state of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `lldp-neighbors`
    ///  The LLDP neighbors.
    ///
    /// Readable
    ///
    ///
    /// #### `managed`
    ///  Whether the device is managed by NetworkManager.
    ///
    /// Readable
    ///
    ///
    /// #### `metered`
    ///  Whether the device is metered.
    ///
    /// Readable
    ///
    ///
    /// #### `mtu`
    ///  The MTU of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `nm-plugin-missing`
    ///  When [`true`] indicates that the NetworkManager plugin for the device
    /// is not installed.
    ///
    /// Readable
    ///
    ///
    /// #### `path`
    ///  The device path as exposed by the udev property ID_PATH.
    ///
    /// The string is backslash escaped (C escaping) for invalid
    /// characters. The escaping can be reverted with g_strcompress(),
    /// however the result may not be valid UTF-8.
    ///
    /// Readable
    ///
    ///
    /// #### `physical-port-id`
    ///  The physical port ID of the device. (See
    /// nm_device_get_physical_port_id().)
    ///
    /// Readable
    ///
    ///
    /// #### `ports`
    ///  The port devices of the controller device. For devices that cannot be
    /// controllers this is likely to be always empty.
    ///
    /// Readable
    ///
    ///
    /// #### `product`
    ///  The product string of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `real`
    ///  Whether the device is real or is a placeholder device that could
    /// be created automatically by NetworkManager if one of its
    /// #NMDevice:available-connections was activated.
    ///
    /// Readable
    ///
    ///
    /// #### `state`
    ///  The state of the device.
    ///
    /// Readable
    ///
    ///
    /// #### `state-reason`
    ///  The reason for the device state.
    ///
    /// Readable
    ///
    ///
    /// #### `udi`
    ///  An operating-system specific device hardware identifier; this is not
    /// unique to a specific hardware device across reboots or hotplugs.  It
    /// is an opaque string which for some device types (Bluetooth, Modem)
    /// contains an identifier provided by the underlying hardware service daemon
    /// such as Bluez or ModemManager, and clients can use this property to
    /// request more information about the device from those services.
    ///
    /// Readable
    ///
    ///
    /// #### `vendor`
    ///  The vendor string of the device.
    ///
    /// Readable
    /// </details>
    /// <details><summary><h4>Object</h4></summary>
    ///
    ///
    /// #### `client`
    ///  The NMClient instance as returned by nm_object_get_client().
    ///
    /// When an NMObject gets removed from the NMClient cache,
    /// the NMObject:path property stays unchanged, but this client
    /// instance gets reset to [`None`]. You can use this property to
    /// track removal of the object from the cache.
    ///
    /// Readable
    ///
    ///
    /// #### `path`
    ///  The D-Bus object path.
    ///
    /// The D-Bus path of an object instance never changes, even if the object
    /// gets removed from the cache. To see whether the object is still in the
    /// cache, check NMObject:client.
    ///
    /// Readable
    /// </details>
    ///
    /// # Implements
    ///
    /// [`DeviceExt`][trait@crate::prelude::DeviceExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
    #[doc(alias = "NMDeviceOlpcMesh")]
    pub struct DeviceOlpcMesh(Object<ffi::NMDeviceOlpcMesh, ffi::NMDeviceOlpcMeshClass>) @extends Device, Object;

    match fn {
        type_ => || ffi::nm_device_olpc_mesh_get_type(),
    }
}

impl DeviceOlpcMesh {
            // rustdoc-stripper-ignore-next
            /// Creates a new builder-pattern struct instance to construct [`DeviceOlpcMesh`] objects.
            ///
            /// This method returns an instance of [`DeviceOlpcMeshBuilder`](crate::builders::DeviceOlpcMeshBuilder) which can be used to create [`DeviceOlpcMesh`] objects.
            pub fn builder() -> DeviceOlpcMeshBuilder {
                DeviceOlpcMeshBuilder::new()
            }
        

    /// Returns the active channel of the #NMDeviceOlpcMesh device.
    ///
    /// # Returns
    ///
    /// active channel of the device
    #[doc(alias = "nm_device_olpc_mesh_get_active_channel")]
    #[doc(alias = "get_active_channel")]
    #[doc(alias = "active-channel")]
    pub fn active_channel(&self) -> u32 {
        unsafe {
            ffi::nm_device_olpc_mesh_get_active_channel(self.to_glib_none().0)
        }
    }

    /// Gets the companion device of the #NMDeviceOlpcMesh.
    ///
    /// # Returns
    ///
    /// the companion of the device of [`None`]
    #[doc(alias = "nm_device_olpc_mesh_get_companion")]
    #[doc(alias = "get_companion")]
    pub fn companion(&self) -> DeviceWifi {
        unsafe {
            from_glib_none(ffi::nm_device_olpc_mesh_get_companion(self.to_glib_none().0))
        }
    }

    /// Gets the hardware (MAC) address of the #NMDeviceOlpcMesh
    ///
    /// # Deprecated since 1.24
    ///
    /// Use nm_device_get_hw_address() instead.
    ///
    /// # Returns
    ///
    /// the hardware address. This is the internal string used by the
    /// device, and must not be modified.
    #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
    #[allow(deprecated)]
    #[doc(alias = "nm_device_olpc_mesh_get_hw_address")]
    #[doc(alias = "get_hw_address")]
    pub fn hw_address(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::nm_device_olpc_mesh_get_hw_address(self.to_glib_none().0))
        }
    }

    #[doc(alias = "active-channel")]
    pub fn connect_active_channel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_active_channel_trampoline<F: Fn(&DeviceOlpcMesh) + 'static>(this: *mut ffi::NMDeviceOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::active-channel".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_active_channel_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "companion")]
    pub fn connect_companion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_companion_trampoline<F: Fn(&DeviceOlpcMesh) + 'static>(this: *mut ffi::NMDeviceOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::companion".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_companion_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }
}

// rustdoc-stripper-ignore-next
        /// A [builder-pattern] type to construct [`DeviceOlpcMesh`] objects.
        ///
        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct DeviceOlpcMeshBuilder {
            builder: glib::object::ObjectBuilder<'static, DeviceOlpcMesh>,
        }

        impl DeviceOlpcMeshBuilder {
        fn new() -> Self {
            Self { builder: glib::object::Object::builder() }
        }

                            /// Whether the device can auto-activate a connection.
                            ///
                            /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
                            pub fn autoconnect(self, autoconnect: bool) -> Self {
                            Self { builder: self.builder.property("autoconnect", autoconnect), }
                        }

    // rustdoc-stripper-ignore-next
    /// Build the [`DeviceOlpcMesh`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> DeviceOlpcMesh {
assert_initialized_main_thread!();
    self.builder.build() }
}