refactor(network): proper signal strength type
This commit is contained in:
parent
1647e31b48
commit
800d2f388e
|
@ -52,8 +52,8 @@ class Network : public ALabel {
|
||||||
std::string ipaddr_;
|
std::string ipaddr_;
|
||||||
std::string netmask_;
|
std::string netmask_;
|
||||||
int cidr_;
|
int cidr_;
|
||||||
int signal_strength_dbm_;
|
int32_t signal_strength_dbm_;
|
||||||
uint16_t signal_strength_;
|
uint8_t signal_strength_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,8 +455,7 @@ void waybar::modules::Network::parseEssid(struct nlattr **bss)
|
||||||
void waybar::modules::Network::parseSignal(struct nlattr **bss) {
|
void waybar::modules::Network::parseSignal(struct nlattr **bss) {
|
||||||
if (bss[NL80211_BSS_SIGNAL_MBM] != nullptr) {
|
if (bss[NL80211_BSS_SIGNAL_MBM] != nullptr) {
|
||||||
// signalstrength in dBm from mBm
|
// signalstrength in dBm from mBm
|
||||||
signal_strength_dbm_ =
|
signal_strength_dbm_ = nla_get_s32(bss[NL80211_BSS_SIGNAL_MBM]) / 100;
|
||||||
static_cast<int>(nla_get_u32(bss[NL80211_BSS_SIGNAL_MBM])) / 100;
|
|
||||||
|
|
||||||
// WiFi-hardware usually operates in the range -90 to -20dBm.
|
// WiFi-hardware usually operates in the range -90 to -20dBm.
|
||||||
const int hardwareMax = -20;
|
const int hardwareMax = -20;
|
||||||
|
|
Loading…
Reference in New Issue