pub struct Ac { /* private fields */ }Expand description
Handle to the Automatic Connection (AC) service, that handles Wi-Fi and network settings.
Implementations§
Source§impl Ac
impl Ac
Sourcepub fn wait_internet_connection(&self) -> Result<()>
pub fn wait_internet_connection(&self) -> Result<()>
Waits for an internet connection.
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("Waiting for an internet connection...");
ac.wait_internet_connection()?;
println!("Connected.");Sourcepub fn wifi_status(&self) -> Result<NetworkStatus>
pub fn wifi_status(&self) -> Result<NetworkStatus>
Returns the current Wi-Fi connection status.
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("Wi-Fi status: {:?}", ac.wifi_status()?);Sourcepub fn wifi_security(&self) -> Result<SecurityMode>
pub fn wifi_security(&self) -> Result<SecurityMode>
Returns the SecurityMode of the currently connected network, or error if the console isn’t connected to any network.
You can check if the console is connected to a network using Ac::wifi_status().
§Example
use ctru::services::ac::{Ac, NetworkStatus};
let ac = Ac::new()?;
if ac.wifi_status()? == NetworkStatus::WANConnected {
println!("Network security: {:?}", ac.wifi_security()?);
}
Sourcepub fn wifi_ssid(&self) -> Result<Vec<u8>>
pub fn wifi_ssid(&self) -> Result<Vec<u8>>
Returns the SSID of the Wi-Fi network the console is connected to, or error if the console isn’t connected to any network.
You can check if the console is connected to a network using Ac::wifi_status().
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("The console is connected to the network \"{}\"", String::from_utf8(ac.wifi_ssid()?)?);Sourcepub fn proxy_enabled(&self) -> Result<bool>
pub fn proxy_enabled(&self) -> Result<bool>
Returns whether the console is connected to a proxy.
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("Proxy enabled: {}", ac.proxy_enabled()?);
Sourcepub fn proxy_port(&self) -> Result<u16>
pub fn proxy_port(&self) -> Result<u16>
Returns the connected network’s proxy port, if present.
You can check if the console is using a proxy with Ac::proxy_enabled()
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("Proxy port: {}", ac.proxy_port()?);Sourcepub fn proxy_username(&self) -> Result<Vec<u8>>
pub fn proxy_username(&self) -> Result<Vec<u8>>
Returns the connected network’s proxy username, if present.
You can check if the console is using a proxy with Ac::proxy_enabled()
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("Proxy username: {}", String::from_utf8(ac.proxy_username()?)?);
Sourcepub fn proxy_password(&self) -> Result<Vec<u8>>
pub fn proxy_password(&self) -> Result<Vec<u8>>
Returns the connected network’s proxy password, if present.
You can check if the console is using a proxy with Ac::proxy_enabled()
§Example
use ctru::services::ac::Ac;
let ac = Ac::new()?;
println!("Proxy password: {}", String::from_utf8(ac.proxy_password()?)?);Sourcepub fn load_network_slot(&mut self, slot: NetworkSlot) -> Result<()>
pub fn load_network_slot(&mut self, slot: NetworkSlot) -> Result<()>
Load the selected network slot, if present.
Note: this method requires ac:i access
§Example
use ctru::services::ac::{Ac, NetworkSlot};
let mut ac = Ac::new()?;
ac.load_network_slot(NetworkSlot::Second)?;