/// Asks the policy layer to start an AP with the user's specified network configuration.
Asks the policy layer to start an AP with the user's specified network configuration.
Asks the policy layer to start an AP with the user ' s specified network configuration .
pub async fn handle_start_ap(
    ap_controller: wlan_policy::AccessPointControllerProxy,
    mut server_stream: wlan_policy::AccessPointStateUpdatesRequestStream,
    config: wlan_policy::NetworkConfig,
) -> Result<(), Error> {
    let connectivity_mode = wlan_policy::ConnectivityMode::Unrestricted;
    let operating_band = wlan_policy::OperatingBand::Any;
    let result = run_proxy_command(Box::pin(ap_controller.start_access_point(
        config,
        connectivity_mode,
        operating_band,
    )))
    .await?;
    handle_request_status(result)?;
    // Listen for state updates until the service indicates that there is an active AP.
    while let Some(update_request) = server_stream.try_next().await? {
        let update = update_request.into_on_access_point_state_update();
        let (updates, responder) = match update {
            Some((update, responder)) => (update, responder),
            None => return Err(format_err!("AP provider produced invalid update.")),
        };
        let _ = responder.send();
        for update in updates {
            match update.state {
                Some(state) => match state {
                    wlan_policy::OperatingState::Failed => {
                        return Err(format_err!("Failed to start AP."));
                    }
                    wlan_policy::OperatingState::Starting => {
                        println!("AP is starting.");
                        continue;
                    }
                    wlan_policy::OperatingState::Active => return Ok(()),
                },
                None => continue,
            }
        }
    }
    Err(format_err!("Status stream terminated before AP start could be verified."))
}
pub async fn handle_start_ap ( ap_controller : wlan_policy :: AccessPointControllerProxy , mut server_stream : wlan_policy :: AccessPointStateUpdatesRequestStream , config : wlan_policy :: NetworkConfig , ) -> Result < ( ) , Error > { let connectivity_mode = wlan_policy :: ConnectivityMode :: Unrestricted ; let operating_band = wlan_policy :: OperatingBand :: Any ; let result = run_proxy_command ( Box :: pin ( ap_controller . start_access_point ( config , connectivity_mode , operating_band , ) ) ) . await ? ; handle_request_status ( result ) ? ; // Listen for state updates until the service indicates that there is an active AP. while let Some ( update_request ) = server_stream . try_next ( ) . await ? { let update = update_request . into_on_access_point_state_update ( ) ; let ( updates , responder ) = match update { Some ( ( update , responder ) ) => ( update , responder ) , None => return Err ( format_err ! ( " " ) ) , } ; let _ = responder . send ( ) ; for update in updates { match update . state { Some ( state ) => match state { wlan_policy :: OperatingState :: Failed => { return Err ( format_err ! ( " " ) ) ; } wlan_policy :: OperatingState :: Starting => { println ! ( " " ) ; continue ; } wlan_policy :: OperatingState :: Active => return Ok ( ( ) ) , } , None => continue , } } } Err ( format_err ! ( " " ) ) }
Asks the policy layer to start an AP with the user's specified network configuration.
Asks the policy layer to start an AP with the user ' s specified network configuration .
ap_controller
wlan_policy::AccessPointControllerProxy
server_stream
wlan_policy::AccessPointStateUpdatesRequestStream
config
wlan_policy::NetworkConfig