4

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.

Community
  • 1
  • 1
PC.
  • 6,870
  • 5
  • 36
  • 71
  • 2
    I think whatever you come up with here will be arbitrary as there's no standard conversion of a dBm range to a percentage. Even the example you provided only covers about a third of the reportable range and just calls everything above that "4 bars". – goto10 Oct 16 '11 at 03:07

2 Answers2

5

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.

brianestey
  • 8,202
  • 5
  • 33
  • 48
  • 2
    Actually, it's even simpler than that. Just take the value and divide by 31. 0/31 = 0. 1/31 ~ 3%. 30/31~97%. 99 is still a special case. – brianestey Oct 16 '11 at 13:04
  • i agree with brianestey, and thats what i was doing in my code. But recently i've realized that my values do not match with other android apps that display signal strength information in percentage. (dBm values matches though). – PC. Oct 16 '11 at 18:39
  • 1
    One thing to be aware of - I did some dev with Samsung Galaxy and found that the returned values aren't as discrete as the docs say. I actually only got 1 of 4 actual values returned, and they mapped to the number of bars. Occasionally, I got 99. – brianestey Oct 17 '11 at 09:50
1

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

m-szalik
  • 3,546
  • 1
  • 21
  • 28