pub async fn try_auto_connect(&self, timeout: std::time::Duration) -> Result<bool, CaptivePortalError> {
        let p = nonblock::Proxy::new(NM_BUSNAME, "/", self.conn.clone());
        use generated::iwd::OrgFreedesktopDBusObjectManager;

        // Get all devices (if possible: by interface)
        let objects = p.get_managed_objects().await?;
        for (device_path, entry) in objects {
            if let Some(entry) = entry.get("net.connman.iwd.KnownNetwork") {
                let auto_connect = entry
                    .get("Autoconnect")
                    .ok_or(CaptivePortalError::IwdError(
                        "net.connman.iwd.KnownNetwork: Autoconnect expected'",
                    ))?
                    .0
                    .as_any()
                    .downcast_ref::<bool>()
                    .ok_or(CaptivePortalError::IwdError(
                        "net.connman.iwd.KnownNetwork/Autoconnect: Expects a bool!",
                    ))?;

                if !auto_connect {
                    use generated::known_network::NetConnmanIwdKnownNetwork;
                    p.set_autoconnect(true);
                }
            }
        }

        match self.wait_for_connectivity(false, timeout).await {
            Ok(state) => Ok(state == NetworkManagerState::Connected || state == NetworkManagerState::ConnectedLimited),
            Err(CaptivePortalError::NotRequiredConnectivity(_)) => Ok(false),
            Err(e) => Err(e),
            _ => Ok(false),
        }
    }
/// Enables auto connect. This enumerates all known connections and sets auto connect to true.
Enables auto connect. This enumerates all known connections and sets auto connect to true.
Enables auto connect . This enumerates all known connections and sets auto connect to true .
pub async fn try_auto_connect(&self, timeout: std::time::Duration) -> Result<bool, CaptivePortalError> {
        let p = nonblock::Proxy::new(NM_BUSNAME, "/", self.conn.clone());
        use generated::iwd::OrgFreedesktopDBusObjectManager;
        // Get all devices (if possible: by interface)
        let objects = p.get_managed_objects().await?;
        for (device_path, entry) in objects {
            if let Some(entry) = entry.get("net.connman.iwd.KnownNetwork") {
                let auto_connect = entry
                    .get("Autoconnect")
                    .ok_or(CaptivePortalError::IwdError(
                        "net.connman.iwd.KnownNetwork: Autoconnect expected'",
                    ))?
                    .0
                    .as_any()
                    .downcast_ref::<bool>()
                    .ok_or(CaptivePortalError::IwdError(
                        "net.connman.iwd.KnownNetwork/Autoconnect: Expects a bool!",
                    ))?;
                if !auto_connect {
                    use generated::known_network::NetConnmanIwdKnownNetwork;
                    p.set_autoconnect(true);
                }
            }
        }
        match self.wait_for_connectivity(false, timeout).await {
            Ok(state) => Ok(state == NetworkManagerState::Connected || state == NetworkManagerState::ConnectedLimited),
            Err(CaptivePortalError::NotRequiredConnectivity(_)) => Ok(false),
            Err(e) => Err(e),
            _ => Ok(false),
        }
    }
pub async fn try_auto_connect ( & self , timeout : std :: time :: Duration ) -> Result < bool , CaptivePortalError > { let p = nonblock :: Proxy :: new ( NM_BUSNAME , " " , self . conn . clone ( ) ) ; use generated :: iwd :: OrgFreedesktopDBusObjectManager ; // Get all devices (if possible: by interface) let objects = p . get_managed_objects ( ) . await ? ; for ( device_path , entry ) in objects { if let Some ( entry ) = entry . get ( " " ) { let auto_connect = entry . get ( " " ) . ok_or ( CaptivePortalError :: IwdError ( " " , ) ) ? . 0 . as_any ( ) . downcast_ref :: < bool > ( ) . ok_or ( CaptivePortalError :: IwdError ( " " , ) ) ? ; if ! auto_connect { use generated :: known_network :: NetConnmanIwdKnownNetwork ; p . set_autoconnect ( true ) ; } } } match self . wait_for_connectivity ( false , timeout ) . await { Ok ( state ) => Ok ( state == NetworkManagerState :: Connected || state == NetworkManagerState :: ConnectedLimited ) , Err ( CaptivePortalError :: NotRequiredConnectivity ( _ ) ) => Ok ( false ) , Err ( e ) => Err ( e ) , _ => Ok ( false ) , } }
Enables auto connect.
Enables auto connect .
&self
timeout
std::time::Duration
&self
timeout
std::time::Duration