async fn on_iface_added_legacy(listener: &Listener, iface_id: u16) -> Result<(), anyhow::Error> {
    let (status, response) = listener.proxy.query_iface(iface_id).await?;
    match status {
        fuchsia_zircon::sys::ZX_OK => {}
        fuchsia_zircon::sys::ZX_ERR_NOT_FOUND => {
            return Err(format_err!("Could not find iface: {}", iface_id));
        }
        ref status => return Err(format_err!("Could not query iface information: {}", status)),
    }

    let response =
        response.ok_or_else(|| format_err!("Iface information is missing: {}", iface_id))?;

    let service = listener.proxy.clone();

    match response.role {
        wlan_common::WlanMacRole::Client => {
            let legacy_shim = listener.legacy_shim.clone();
            let (sme, remote) = create_proxy()
                .map_err(|e| format_err!("Failed to create a FIDL channel: {}", e))?;

            let status = service
                .get_client_sme(iface_id, remote)
                .await
                .map_err(|e| format_err!("Failed to get client SME: {}", e))?;

            zx::Status::ok(status)
                .map_err(|e| format_err!("GetClientSme returned an error: {}", e))?;

            let lc = Iface { sme: sme.clone(), iface_id };
            legacy_shim.set_if_empty(lc);
        }
        // The AP service make direct use of the PhyManager to get interfaces.
        wlan_common::WlanMacRole::Ap => {}
        wlan_common::WlanMacRole::Mesh => {
            return Err(format_err!("Unexpectedly observed a mesh iface: {}", iface_id))
        }
    }

    info!("new iface {} added successfully", iface_id);
    Ok(())
}
/// Configured the interface that is used to service the legacy WLAN API.
Configured the interface that is used to service the legacy WLAN API.
Configured the interface that is used to service the legacy WLAN API .
async fn on_iface_added_legacy(listener: &Listener, iface_id: u16) -> Result<(), anyhow::Error> {
    let (status, response) = listener.proxy.query_iface(iface_id).await?;
    match status {
        fuchsia_zircon::sys::ZX_OK => {}
        fuchsia_zircon::sys::ZX_ERR_NOT_FOUND => {
            return Err(format_err!("Could not find iface: {}", iface_id));
        }
        ref status => return Err(format_err!("Could not query iface information: {}", status)),
    }
    let response =
        response.ok_or_else(|| format_err!("Iface information is missing: {}", iface_id))?;
    let service = listener.proxy.clone();
    match response.role {
        wlan_common::WlanMacRole::Client => {
            let legacy_shim = listener.legacy_shim.clone();
            let (sme, remote) = create_proxy()
                .map_err(|e| format_err!("Failed to create a FIDL channel: {}", e))?;
            let status = service
                .get_client_sme(iface_id, remote)
                .await
                .map_err(|e| format_err!("Failed to get client SME: {}", e))?;
            zx::Status::ok(status)
                .map_err(|e| format_err!("GetClientSme returned an error: {}", e))?;
            let lc = Iface { sme: sme.clone(), iface_id };
            legacy_shim.set_if_empty(lc);
        }
        // The AP service make direct use of the PhyManager to get interfaces.
        wlan_common::WlanMacRole::Ap => {}
        wlan_common::WlanMacRole::Mesh => {
            return Err(format_err!("Unexpectedly observed a mesh iface: {}", iface_id))
        }
    }
    info!("new iface {} added successfully", iface_id);
    Ok(())
}
async fn on_iface_added_legacy ( listener : & Listener , iface_id : u16 ) -> Result < ( ) , anyhow :: Error > { let ( status , response ) = listener . proxy . query_iface ( iface_id ) . await ? ; match status { fuchsia_zircon :: sys :: ZX_OK => { } fuchsia_zircon :: sys :: ZX_ERR_NOT_FOUND => { return Err ( format_err ! ( " " iface_id ) ) ; } ref status => return Err ( format_err ! ( " " status ) ) , } let response = response . ok_or_else ( | | format_err ! ( " " iface_id ) ) ? ; let service = listener . proxy . clone ( ) ; match response . role { wlan_common :: WlanMacRole :: Client => { let legacy_shim = listener . legacy_shim . clone ( ) ; let ( sme , remote ) = create_proxy ( ) . map_err ( | e | format_err ! ( " " e ) ) ? ; let status = service . get_client_sme ( iface_id , remote ) . await . map_err ( | e | format_err ! ( " " e ) ) ? ; zx :: Status :: ok ( status ) . map_err ( | e | format_err ! ( " " e ) ) ? ; let lc = Iface { sme : sme . clone ( ) , iface_id } ; legacy_shim . set_if_empty ( lc ) ; } // The AP service make direct use of the PhyManager to get interfaces. wlan_common :: WlanMacRole :: Ap => { } wlan_common :: WlanMacRole :: Mesh => { return Err ( format_err ! ( " " iface_id ) ) } } info ! ( " " iface_id ) ; Ok ( ( ) ) }
Configured the interface that is used to service the legacy WLAN API.
Configured the interface that is used to service the legacy WLAN API .
listener
&Listener
iface_id
u16
listener
&Listener
iface_id
u16