Feat(Windows/Adapter): Add Wrapper Around Wifi Adapter

This commit is contained in:
Tochukwu Nkemdilim
2018-08-21 19:46:35 +01:00
parent 03325c939a
commit 37cfe1e729
4 changed files with 63 additions and 5 deletions
+3
View File
@@ -27,6 +27,7 @@ impl Linux {
/// Wifi interface for linux operating system.
/// This provides basic functionalities for wifi interface.
impl WifiInterface for Linux {
/// Check if wireless network adapter is enabled.
fn is_wifi_enabled() -> Result<bool, WifiError> {
let output = Command::new("nmcli")
.args(&["radio", "wifi"])
@@ -39,6 +40,7 @@ impl WifiInterface for Linux {
.contains("enabled"))
}
/// Turn on the wireless network adapter.
fn turn_on() -> Result<(), WifiError> {
let _output = Command::new("nmcli")
.args(&["radio", "wifi", "on"])
@@ -48,6 +50,7 @@ impl WifiInterface for Linux {
Ok(())
}
/// Turn off the wireless network adapter.
fn turn_off() -> Result<(), WifiError> {
let _output = Command::new("nmcli")
.args(&["radio", "wifi", "off"])