Question

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.

Était-ce utile?

La solution

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:

    final double pMax = Math.pow(10d, 31/10d);
    if (gsmSignalStrength == 99) {
        return -1;
    }
    double r = Math.pow(10d, gsmSignalStrength/10d) / pMax; // value <0,1>
    return (float) r;

Reference doc: https://www.etsi.org/deliver/etsi_ts/127000_127099/127007/08.05.00_60/ts_127007v080500p.pdf page 82

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top