Comment 9 for bug 1329945

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

I don't see how fixing this on ofono layer requires any changes; we only have to modify the mapping.

Android code itself defines 5 discrete strengths:
 - SIGNAL_STRENGTH_GREAT
 - SIGNAL_STRENGTH_GOOD
 - SIGNAL_STRENGTH_MODERATE
 - SIGNAL_STRENGTH_POOR
 - SIGNAL_STRENGTH_NONE_OR_UNKNOWN

We can map those (how ever they are calculated) to the linear and evenly distributed range of [0..100].

As an example:

   int asu = getGsmSignalStrength();

  // 0-20% - SIGNAL_STRENGTH_NONE_OR_UNKNOWN
  if (asu == 99)
    level = 0;
  else if (asu == 0)
    level = 6;
  else if (asu == 1)
    level = 12;
  else if (asu == 2)
    level = 18;

  // 20-40% - SIGNAL_STRENGTH_POOR
  else if (asu == 3)
    level = 25;
  else if (asu = 4)
    level = 35;

  // 40-60% - SIGNAL_STRENGTH_MODERATE
  else if (asu = 5)
    level = 46;
  else if (asu = 6)
    level = 52;
  else if (asu = 7)
    level = 58;

  // 60-80% SIGNAL_STRENGTH_GOOD
  else if (asu = 8)
    level = 60;
  else if (asu = 9)
    level = 65;
  else if (asu = 10)
    level = 70;
  else if (asu = 11)
    level = 75;

  // 80-100% - SIGNAL_STRENGTH_GREAT
  else if (asu >= 12)
    level = 80 + 20*(1 - (31-asu)/19.0);