How should I convert Wifi signal strength from a Quality in percentage, usually 0% to 100% into an RSSI value, usually a negative dBm number (i.e. -96db
)?
相关问题
- Get SSID/ other network information in golang
- How to get the wifi name(SSID) of the currently co
- Getting WIFI signal strength- seeking the best way
- Get nearby BSSID and signal strength in Java
- Listening to WiFi packets
相关文章
- [iPhone]: How send output stream via wireless netw
- iphone problem receiving UDP packets
- is it possible to turn off wifi or switch iPhone t
- Checking if there is internet connection
- Google maps Android API getting wifi location
- iPhone VOIP in background
- ways for a client to identify the specific access
- Checking miracast compatible devices using android
Mentioned pseudocode will not work all the ranges, the ranges example (-80dBm to 0, and -40dBm to 100).
Generic simple logic to map any range to 0 to 100. Usage example, for below code ConvertRangeToPercentage(-80,-40,-50)
In JS I prefer doing something like:
Math.min(Math.max(2 * (x + 100), 0), 100)
My personal opinion is that it's more elegant way to write it, instead of using
if
's.From experience:
Windows laptops can work fine on -80dB however with slower speeds
Wifi Signal Strength Percentage to RSSI dBm
Microsoft defines Wifi signal quality in their WLAN_ASSOCIATION_ATTRIBUTES structure as follows:
wlanSignalQuality:
RSSI (or "Radio (Received) Signal Strength Indicator") are in units of 'dB' (decibel) or the similar 'dBm' (dB per milliwatt) (See dB vs. dBm) in which the smaller magnitude negative numbers have the highest signal strength, or quality.
Therefore, the conversion between
quality
(percentage) anddBm
is as follows:Pseudo Code (with example clamping):
Note:
Check the definition of
Quality
that you are using for your calculations carefully. Also check the range ofdB
(ordBm
). The limits may vary.Examples:
Ok.. I agree...but why is then:
this does not agree with the formula percentage=quality/2 - 100.
Also, you can try inverse this Bash function which converts dBm to percentage:
Usage: