pub async fn list_access_points(
        &self,
        mut timeout: std::time::Duration,
    ) -> Result<Vec<WifiConnection>, CaptivePortalError> {
        let p = nonblock::Proxy::new(NM_BUSNAME, self.wifi_device_path.clone(), self.conn.clone());

        let connections = {
            use device::DeviceWireless;
            if timeout.as_secs() > 0 {
                self.scan_networks().await?;
            }
            let interval = Duration::from_millis(500);
            loop {
                // Get access point list
                let stream = futures_util::stream::iter(p.get_access_points().await?.into_iter());
                let access_point_paths: Vec<WifiConnection> = stream
                    .filter_map(|ap_path| {
                        async {
                            self.access_point(ap_path).await.ok().and_then(|ap| match ap.is_own {
                                true => None,
                                false => Some(ap),
                            })
                        }
                    })
                    .collect()
                    .await;
                if access_point_paths.len() > 0 {
                    break access_point_paths;
                }
                if timeout.as_millis() <= 0 {
                    break access_point_paths;
                }
                delay_for(interval).await;
                timeout -= interval;
            }
        };

        Ok(connections)
    }
/// Return all known access points of the associated wifi device.
/// The list might not be up to date and can be refreshed with a call to [`scan_networks`].
///
/// ## Arguments
/// * timeout: If timeout is != 0, performs a full scan. Waits up to timeout for at least one result.
Return all known access points of the associated wifi device.
The list might not be up to date and can be refreshed with a call to [`scan_networks`].
Return all known access points of the associated wifi device . The list might not be up to date and can be refreshed with a call to [ ` scan_networks ` ] .
pub async fn list_access_points(
        &self,
        mut timeout: std::time::Duration,
    ) -> Result<Vec<WifiConnection>, CaptivePortalError> {
        let p = nonblock::Proxy::new(NM_BUSNAME, self.wifi_device_path.clone(), self.conn.clone());
        let connections = {
            use device::DeviceWireless;
            if timeout.as_secs() > 0 {
                self.scan_networks().await?;
            }
            let interval = Duration::from_millis(500);
            loop {
                // Get access point list
                let stream = futures_util::stream::iter(p.get_access_points().await?.into_iter());
                let access_point_paths: Vec<WifiConnection> = stream
                    .filter_map(|ap_path| {
                        async {
                            self.access_point(ap_path).await.ok().and_then(|ap| match ap.is_own {
                                true => None,
                                false => Some(ap),
                            })
                        }
                    })
                    .collect()
                    .await;
                if access_point_paths.len() > 0 {
                    break access_point_paths;
                }
                if timeout.as_millis() <= 0 {
                    break access_point_paths;
                }
                delay_for(interval).await;
                timeout -= interval;
            }
        };
        Ok(connections)
    }
pub async fn list_access_points ( & self , mut timeout : std :: time :: Duration , ) -> Result < Vec < WifiConnection > , CaptivePortalError > { let p = nonblock :: Proxy :: new ( NM_BUSNAME , self . wifi_device_path . clone ( ) , self . conn . clone ( ) ) ; let connections = { use device :: DeviceWireless ; if timeout . as_secs ( ) > 0 { self . scan_networks ( ) . await ? ; } let interval = Duration :: from_millis ( 500 ) ; loop { // Get access point list let stream = futures_util :: stream :: iter ( p . get_access_points ( ) . await ? . into_iter ( ) ) ; let access_point_paths : Vec < WifiConnection > = stream . filter_map ( | ap_path | { async { self . access_point ( ap_path ) . await . ok ( ) . and_then ( | ap | match ap . is_own { true => None , false => Some ( ap ) , } ) } } ) . collect ( ) . await ; if access_point_paths . len ( ) > 0 { break access_point_paths ; } if timeout . as_millis ( ) <= 0 { break access_point_paths ; } delay_for ( interval ) . await ; timeout -= interval ; } } ; Ok ( connections ) }
Return all known access points of the associated wifi device.
Return all known access points of the associated wifi device .
&self
timeout
std::time::Duration
&self
timeout
std::time::Duration