Skip to content

Commit

Permalink
add band if non none
Browse files Browse the repository at this point in the history
  • Loading branch information
takotori committed Dec 11, 2023
1 parent fb2fee3 commit 9472de8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/network/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ pub enum Band {
_5GHZ,
_24GHZ,
#[default]
DYN,
NONE,
}

impl FromStr for Band {
Expand All @@ -222,7 +222,7 @@ impl FromStr for Band {
match s {
"a" => Ok(Band::_5GHZ),
"bg" => Ok(Band::_24GHZ),
_ => Ok(Band::DYN),
_ => Ok(Band::NONE),
}
}
}
Expand All @@ -232,7 +232,7 @@ impl ToString for Band {
match self {
Band::_5GHZ => String::from("bg"),
Band::_24GHZ => String::from("a"),
Band::DYN => String::from(""),
Band::NONE => String::from(""),
}
}
}
Expand All @@ -242,15 +242,15 @@ impl Enum for Band {
match num {
0 => Band::_5GHZ,
1 => Band::_24GHZ,
_ => Band::DYN,
_ => Band::NONE,
}
}

fn to_i32(&self) -> i32 {
match self {
Band::_5GHZ => 0,
Band::_24GHZ => 1,
Band::DYN => 2,
Band::NONE => 2,
}
}
}
Expand Down Expand Up @@ -511,7 +511,9 @@ impl PropMapConvert for WifiSettings {

fn to_propmap(&self) -> PropMap {
let mut map = PropMap::new();
map.insert("band".into(), Variant(Box::new(self.band.to_string())));
if self.band != Band::NONE {
map.insert("band".into(), Variant(Box::new(self.band.to_string())));
}
map.insert("channel".into(), Variant(Box::new(self.channel)));
map.insert("mode".into(), Variant(Box::new(self.mode.to_string())));
map.insert("mtu".into(), Variant(Box::new(self.mtu)));
Expand Down

0 comments on commit 9472de8

Please sign in to comment.