Feat(OSX): Add OSX Support
This commit is contained in:
+11
-7
@@ -1,15 +1,20 @@
|
||||
mod handlers;
|
||||
pub mod profile_network;
|
||||
mod providers;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
mod handlers;
|
||||
#[cfg(target_os = "windows")]
|
||||
mod stubs;
|
||||
|
||||
use std::{fmt, io};
|
||||
|
||||
pub trait Network: fmt::Debug {
|
||||
/// Makes an attempt to connect to a selected wireless network with password specified.
|
||||
fn connect(&self, password: &str) -> Result<bool, NetworkError>;
|
||||
fn disconnect(&self) -> Result<bool, NetworkError>;
|
||||
fn connect(&self, password: &str) -> Result<bool, WifiConnectionError>;
|
||||
fn disconnect(&self) -> Result<bool, WifiConnectionError>;
|
||||
fn is_wifi_enabled(&self) -> bool;
|
||||
fn connnection_up(&self) -> bool;
|
||||
fn connnection_down(&self) -> bool;
|
||||
}
|
||||
|
||||
// #[derive(Debug)]
|
||||
@@ -25,8 +30,7 @@ pub struct Config<'a> {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum NetworkError {
|
||||
// FromUtf8Error(FromUtf8Error),
|
||||
pub enum WifiConnectionError {
|
||||
SsidNotFound,
|
||||
OsNotSupported,
|
||||
IpAssignFailed,
|
||||
@@ -37,8 +41,8 @@ pub enum NetworkError {
|
||||
WiFiInterfaceDisabled,
|
||||
}
|
||||
|
||||
impl From<io::Error> for NetworkError {
|
||||
impl From<io::Error> for WifiConnectionError {
|
||||
fn from(error: io::Error) -> Self {
|
||||
NetworkError::IoError(error)
|
||||
WifiConnectionError::IoError(error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user