Skip to main content

Status

Struct Status 

Source
pub struct Status {
Show 30 fields pub state: String, pub phy: String, pub freq: u32, pub num_sta_non_erp: Option<u64>, pub num_sta_no_short_slot_time: Option<u64>, pub num_sta_no_short_preamble: Option<u64>, pub olbc: Option<u64>, pub num_sta_ht_no_gf: Option<u64>, pub num_sta_no_ht: Option<u64>, pub num_sta_ht_20_mhz: Option<u64>, pub num_sta_ht40_intolerant: Option<u64>, pub olbc_ht: Option<u64>, pub ht_op_mode: Option<String>, pub cac_time_seconds: Option<u64>, pub cac_time_left_seconds: Option<u64>, pub channel: Option<u64>, pub secondary_channel: Option<u64>, pub ieee80211n: Option<u64>, pub ieee80211ac: Option<u64>, pub ieee80211ax: Option<u64>, pub beacon_int: Option<u64>, pub dtim_period: Option<u64>, pub ht_caps_info: Option<String>, pub ht_mcs_bitmask: Option<String>, pub supported_rates: String, pub max_txpower: Option<u64>, pub bss: Vec<String>, pub bssid: Vec<String>, pub ssid: Vec<String>, pub num_sta: Vec<u32>,
}
Expand description

Status of the WiFi Access Point

Fields§

§state: String§phy: String§freq: u32§num_sta_non_erp: Option<u64>§num_sta_no_short_slot_time: Option<u64>§num_sta_no_short_preamble: Option<u64>§olbc: Option<u64>§num_sta_ht_no_gf: Option<u64>§num_sta_no_ht: Option<u64>§num_sta_ht_20_mhz: Option<u64>§num_sta_ht40_intolerant: Option<u64>§olbc_ht: Option<u64>§ht_op_mode: Option<String>§cac_time_seconds: Option<u64>§cac_time_left_seconds: Option<u64>§channel: Option<u64>§secondary_channel: Option<u64>§ieee80211n: Option<u64>§ieee80211ac: Option<u64>§ieee80211ax: Option<u64>§beacon_int: Option<u64>§dtim_period: Option<u64>§ht_caps_info: Option<String>§ht_mcs_bitmask: Option<String>§supported_rates: String§max_txpower: Option<u64>§bss: Vec<String>§bssid: Vec<String>§ssid: Vec<String>§num_sta: Vec<u32>

Implementations§

Source§

impl Status

Source

pub fn from_response(response: &str) -> Result<Self, ConfigError>

Decode from the response sent from the hostapd

let resp = r#"
state=ENABLED
phy=phy0
freq=2437
num_sta_non_erp=0
num_sta_no_short_slot_time=0
num_sta_no_short_preamble=0
olbc=0
num_sta_ht_no_gf=0
num_sta_no_ht=0
num_sta_ht_20_mhz=0
num_sta_ht40_intolerant=0
olbc_ht=0
ht_op_mode=0x0
cac_time_seconds=0
cac_time_left_seconds=N/A
channel=6
edmg_enable=0
edmg_channel=0
secondary_channel=0
ieee80211n=0
ieee80211ac=0
ieee80211ax=0
beacon_int=100
dtim_period=2
supported_rates=02 04 0b 16 0c 12 18 24 30 48 60 6c
max_txpower=20
bss[0]=wlan0
bssid[0]=cc:7b:5c:1a:d2:21
ssid[0]=WiFi-SSID
num_sta[0]=0
bss[1]=wlan1
bssid[1]=cc:7b:5c:4d:ff:5c
ssid[1]=¯\\_(\xe3\x83\x84)_/¯
num_sta[1]=1
"#;
let status = Status::from_response(resp).unwrap();
assert_eq!(status.state, "ENABLED");
assert_eq!(status.freq, 2437);
assert_eq!(status.ssid, vec![r"WiFi-SSID", r#"¯\_(ツ)_/¯"#]);
assert_eq!(status.num_sta, vec![0, 1]);

Trait Implementations§

Source§

impl Debug for Status

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Status

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Status

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.