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