Skip to content

Commit

Permalink
auto implement from on the network security enum
Browse files Browse the repository at this point in the history
i don't know how this didn't work before, but it now does, i guess
  • Loading branch information
adryzz committed Oct 30, 2023
1 parent ce04670 commit aa611c4
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions ctru-rs/src/services/ac.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//! The Automatic Connection (AC) service handles Wi-Fi and network settings.
//! It can:
//! - Connect to a network or slot
//! - Get information about a network, such as its SSID or security settings
use crate::error::ResultCode;

/// Handle to the AC service, that handles Wi-Fi and network settings.
/// Handle to the Automatic Connection (AC) service, that handles Wi-Fi and network settings.
pub struct Ac(());

impl Ac {
Expand Down Expand Up @@ -128,7 +132,7 @@ impl Ac {
///
/// let ac = Ac::new()?;
///
/// println!("The console is connected to the network \"{}\"", ac.get_wifi_ssid().unwrap())
/// println!("The console is connected to the network \"{}\"", ac.get_wifi_ssid().unwrap());
/// #
/// # Ok(())
/// # }
Expand Down Expand Up @@ -267,34 +271,34 @@ impl Ac {
Ok(String::from_utf8(vec)?)
}
}

/*
/// Load the selected network slot, if present.
///
/// Note: this method requires `ac:i` access
/// # Example
///
/// ```
/// # let _runner = test_runner::GdbRunner::default();
/// # use std::error::Error;
/// # fn main() -> Result<(), Box<dyn Error>> {
/// #
/// use ctru::services::ac::Ac;
///
/// let ac = Ac::new()?;
///
/// ac.load_network_slot(NetworkSlot::Second)?;
/// #
/// # Ok(())
/// # }
/// ```
#[doc(alias = "ACI_LoadNetworkSetting")]
pub fn load_network_slot(&self, slot: NetworkSlot) -> crate::Result<()> {
unsafe {
ResultCode(ctru_sys::ACI_LoadNetworkSetting(slot as u32))?;
Ok(())
/// Load the selected network slot, if present.
///
/// Note: this method requires `ac:i` access
/// # Example
///
/// ```
/// # let _runner = test_runner::GdbRunner::default();
/// # use std::error::Error;
/// # fn main() -> Result<(), Box<dyn Error>> {
/// #
/// use ctru::services::ac::Ac;
///
/// let ac = Ac::new()?;
///
/// ac.load_network_slot(NetworkSlot::Second)?;
/// #
/// # Ok(())
/// # }
/// ```
#[doc(alias = "ACI_LoadNetworkSetting")]
pub fn load_network_slot(&self, slot: NetworkSlot) -> crate::Result<()> {
unsafe {
ResultCode(ctru_sys::ACI_LoadNetworkSetting(slot as u32))?;
Ok(())
}
}
}*/
*/
}

impl Drop for Ac {
Expand Down Expand Up @@ -327,13 +331,14 @@ pub enum SecurityMode {
/// WPA2-AES authentication
WPA2_AES = ctru_sys::AC_WPA2_AES,

Check warning on line 332 in ctru-rs/src/services/ac.rs

View workflow job for this annotation

GitHub Actions / lint (nightly-2023-06-01)

variant `WPA2_AES` should have an upper camel case name
}

/*
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u32)]
pub enum NetworkSlot {
First = 0,
Second = 1,
Third = 2
Third = 2,
}
*/

from_impl!(SecurityMode, ctru_sys::acSecurityMode);

0 comments on commit aa611c4

Please sign in to comment.