Skip to content

Instantly share code, notes, and snippets.

@cramertj
Created July 29, 2018 21:39
Show Gist options
  • Save cramertj/4015892a0359e0604ba63613b4a3778c to your computer and use it in GitHub Desktop.
Save cramertj/4015892a0359e0604ba63613b4a3778c to your computer and use it in GitHub Desktop.
140 async fn connect_to_known_network<'a>(
141 sme: &'a fidl_sme::ClientSmeProxy, ssid: &'a [u8], known_ess: &'a KnownEss,
142 ) -> Result<bool, failure::Error> {
143 let ssid_str = String::from_utf8_lossy(ssid).into_owned();
144 println!("wlancfg: Auto-connecting to '{}'", ssid_str);
145 let connect_txn = start_connect_txn(sme, &ssid, &known_ess.password)?;
146 let r = await!(wait_until_connected(connect_txn))?;
147 match r {
148 fidl_sme::ConnectResultCode::Success => {
149 println!("wlancfg: Auto-connected to '{}'", ssid_str);
150 Ok(true)
151 },
152 other => {
153 println!("wlancfg: Failed to auto-connect to '{}': {:?}", ssid_str, other);
154 Ok(false)
155 },
156 }
157 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment