以百分比显示 Android 的 getGsmSignalStrength() 值
根据 getGsmSignalStrength() 对应的 dBm 值,比例看起来是线性的。 (请参阅此处的 dBm 值)。 但我观察到,在几乎所有应用中,该比例尺都不用作线性比例尺。
例如,考虑Android的src StatusBarPolicy::updateSignalStrength
signal strength = 0 or 99 -> no signal
signal strength >= 12 -> very good signal
signal strength >= 8 -> good signal
signal strength >= 5 -> poor signal
signal strength <5 -> very poor signal
任何人都可以帮助我找出可以用百分比显示信号强度的比例。
According to the corresponding dBm values of getGsmSignalStrength(), the scale appears to be linear. (See dBm values here).
But I've observed that in almost all applications, this scale is not used as linear scale.
For example consider Android's src StatusBarPolicy::updateSignalStrength
signal strength = 0 or 99 -> no signal
signal strength >= 12 -> very good signal
signal strength >= 8 -> good signal
signal strength >= 5 -> poor signal
signal strength <5 -> very poor signal
can anyone help me find out the scale using which i can display the signal strength in percentage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从您提供的链接:
0 -113 dBm 或更低
1 -111 dBm
2...30 -109... -53 dBm
31 -51 dBm 或更高
99 未知或不可检测
这意味着您的范围为 -113 至 -51,或 -62dBm。要将其转换为百分比,您可以获取收到的值 (0-31,99),计算出相应的 dBm 是多少,然后找到与 -113 的差值并除以 62。
例如,
0=-113dBm。与 -113 的差值 = 0。0/62 = 0%。
1=-111dBm。与-113之差=2. 2/62 ~ 3%。
30=-53dBm。与-113 的差异= 60。60/62 ~97%。
您需要的唯一特殊情况是 99,它应该像 0 一样处理。
From the link you provided:
0 -113 dBm or less
1 -111 dBm
2...30 -109... -53 dBm
31 -51 dBm or greater
99 not known or not detectable
This would mean you have a range or -113 to -51, or -62dBm. To convert that to a percentage, you can take the value you receive (0-31,99), figure out what the corresponding dBm is, and then find the difference with -113 and divide by 62.
For example,
0=-113dBm. Difference with -113 = 0. 0/62 = 0%.
1=-111dBm. Difference with -113 = 2. 2/62 ~ 3%.
30=-53dBm. Difference with -113 = 60. 60/62 ~97%.
The only special case you need is for 99, which should be handled like 0.
信号强度值以 dBm 表示。这意味着它是对数尺度的。
它是对数的,允许表示非常大和非常小的值。
对数标度意味着:
功率增加 100W 即可获得 20dBm;
但增加 1000W 功率不会给你带来 200dBm 而是 30dBm。
如果将对数刻度转换为线性刻度,您将失去表示大范围值的能力。但如果你想这样做,这里有一个算法:
参考文档: https://www.etsi.org/deliver/etsi_ts/127000_127099/127007/08.05.00_60/ts_127007v080500p.pdf第82页
A value of signal strength is represented in dBm. That means it's in logarithmic scale.
It is logarithmic to allow representation of very big and also very small values.
A logarithmic scale means that:
Increase power by 100W will give you 20dBm;
but increase power by 1000W will not give you 200dBm but 30dBm.
If you convert logarithmic scale to linear scale you will loose ability to represent wide range of values. But if you want to do it here is an algorithm:
Reference doc: https://www.etsi.org/deliver/etsi_ts/127000_127099/127007/08.05.00_60/ts_127007v080500p.pdf page 82