Some fixes for the examples and the crate
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "wifi-cli"
|
||||
version = "0.1.0"
|
||||
authors = ["Tochukwu Nkemdilim <[email protected]>"]
|
||||
|
||||
[dependencies]
|
||||
wifi-rs = { path = "../../../wifi-rs" }
|
||||
@@ -0,0 +1,24 @@
|
||||
extern crate wifi_rs;
|
||||
|
||||
use std::io;
|
||||
use wifi_rs::WiFi;
|
||||
use wifi_rs::prelude::*;
|
||||
|
||||
fn main() -> Result<(), io::Error> {
|
||||
let config = Some(Config {
|
||||
interface: Some("wlo1"),
|
||||
});
|
||||
|
||||
let mut wifi = WiFi::new(config);
|
||||
let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
|
||||
|
||||
wifi.create_hotspot(
|
||||
"test-hotspot",
|
||||
"password",
|
||||
Some(
|
||||
&config
|
||||
)
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -4,6 +4,7 @@ extern crate wifi_rs;
|
||||
use clap::{App, Arg};
|
||||
use std::io;
|
||||
use wifi_rs::WiFi;
|
||||
use wifi_rs::prelude::*;
|
||||
|
||||
fn main() -> Result<(), io::Error> {
|
||||
let matches = App::new("Wi-Fi")
|
||||
@@ -48,8 +49,13 @@ fn main() -> Result<(), io::Error> {
|
||||
// Get Wireless Interface
|
||||
let interface = matches.value_of("interface").unwrap();
|
||||
|
||||
let wifi = WiFi::new(ssid)?;
|
||||
println!("Connection Status: {}", wifi.connect(password));
|
||||
let config = Some(Config {
|
||||
interface: Some(interface),
|
||||
});
|
||||
|
||||
// let wifi = WiFi::new(ssid)?;
|
||||
let mut wifi = WiFi::new(config);
|
||||
println!("Connection Status: {:?}", wifi.connect(ssid, password));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user