Struct Ac

Source
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

Source

pub fn new() -> Result<Ac>

Initialize a new service handle.

§Example
use ctru::services::ac::Ac;

let ac = Ac::new()?;
Source

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.");
Source

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()?);
Source

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()?);
}
Source

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()?)?);
Source

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()?);
Source

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()?);
Source

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()?)?);
Source

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()?)?);
Source

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)?;

Auto Trait Implementations§

§

impl Freeze for Ac

§

impl !RefUnwindSafe for Ac

§

impl !Send for Ac

§

impl Sync for Ac

§

impl Unpin for Ac

§

impl !UnwindSafe for Ac

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.