|
|
@ -3,9 +3,14 @@ |
|
|
|
//! - Connect to a network or slot
|
|
|
|
//! - Connect to a network or slot
|
|
|
|
//! - Get information about a network, such as its SSID or security settings
|
|
|
|
//! - Get information about a network, such as its SSID or security settings
|
|
|
|
use crate::error::ResultCode; |
|
|
|
use crate::error::ResultCode; |
|
|
|
|
|
|
|
use crate::services::ServiceReference; |
|
|
|
|
|
|
|
use std::sync::Mutex; |
|
|
|
/// Handle to the Automatic Connection (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(()); |
|
|
|
pub struct Ac { |
|
|
|
|
|
|
|
_service_handler: ServiceReference, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static AC_ACTIVE: Mutex<()> = Mutex::new(()); |
|
|
|
|
|
|
|
|
|
|
|
impl Ac { |
|
|
|
impl Ac { |
|
|
|
/// Initialize a new service handle.
|
|
|
|
/// Initialize a new service handle.
|
|
|
@ -26,10 +31,17 @@ impl Ac { |
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
#[doc(alias = "acInit")] |
|
|
|
#[doc(alias = "acInit")] |
|
|
|
pub fn new() -> crate::Result<Ac> { |
|
|
|
pub fn new() -> crate::Result<Ac> { |
|
|
|
unsafe { |
|
|
|
Ok(Ac { |
|
|
|
ResultCode(ctru_sys::acInit())?; |
|
|
|
_service_handler: ServiceReference::new(&AC_ACTIVE,
|
|
|
|
Ok(Ac(())) |
|
|
|
|| { |
|
|
|
} |
|
|
|
ResultCode(unsafe { ctru_sys::acInit() })?; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(()) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|| unsafe { |
|
|
|
|
|
|
|
ctru_sys::acExit(); |
|
|
|
|
|
|
|
},)? |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Waits for an internet connection.
|
|
|
|
/// Waits for an internet connection.
|
|
|
|