Chore(Docs): Improve Docs
This commit is contained in:
@@ -10,6 +10,7 @@ mod platforms;
|
|||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use connectivity::*;
|
pub use connectivity::*;
|
||||||
pub use hotspot::*;
|
pub use hotspot::*;
|
||||||
|
pub use platforms::Config;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use platforms::WiFi;
|
pub use platforms::WiFi;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ impl Osx {
|
|||||||
/// Wifi interface for osx operating system.
|
/// Wifi interface for osx operating system.
|
||||||
/// This provides basic functionalities for wifi interface.
|
/// This provides basic functionalities for wifi interface.
|
||||||
impl WifiInterface for Osx {
|
impl WifiInterface for Osx {
|
||||||
/// Check if wireless network adapter is enabled.
|
|
||||||
fn is_wifi_enabled() -> Result<bool, WifiError> {
|
fn is_wifi_enabled() -> Result<bool, WifiError> {
|
||||||
let output = Command::new("networksetup")
|
let output = Command::new("networksetup")
|
||||||
.args(&["radio", "wifi"])
|
.args(&["radio", "wifi"])
|
||||||
@@ -50,7 +49,7 @@ impl WifiInterface for Osx {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn off the wireless network adapter.
|
/// Turn off the wireless adapter.
|
||||||
fn turn_off() -> Result<(), WifiError> {
|
fn turn_off() -> Result<(), WifiError> {
|
||||||
let output = Command::new("networksetup")
|
let output = Command::new("networksetup")
|
||||||
.args(&["-setairportpower", "en0", "off"])
|
.args(&["-setairportpower", "en0", "off"])
|
||||||
|
|||||||
+7
-2
@@ -1,5 +1,5 @@
|
|||||||
extern crate wifi_rs;
|
extern crate wifi_rs;
|
||||||
use self::wifi_rs::{prelude::*, Config, WiFi};
|
use self::wifi_rs::{prelude::*, WiFi};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn connect_to_wifi_failed() {
|
fn connect_to_wifi_failed() {
|
||||||
@@ -14,7 +14,12 @@ fn connect_to_wifi_failed() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_hotspot() {
|
fn create_hotspot() {
|
||||||
let hotspot_created = WiFi::create_hotspot("hello", "hi").unwrap();
|
let config = Some(Config {
|
||||||
|
interface: Some("wlo1"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let mut wifi = WiFi::new(config);
|
||||||
|
let hotspot_created = wifi.create_hotspot("hello", "hi", None).unwrap();
|
||||||
|
|
||||||
assert_eq!(hotspot_created, true);
|
assert_eq!(hotspot_created, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user