开发者

How to map getGsmSignalStrength to a image

开发者 https://www.devze.com 2023-02-18 02:56 出处:网络
getGsmSignalStrength return values in range (0-31, 99). I\'d like to map these values into an image showing signal strength. The image is 5 filled (or unfilled) bars like

getGsmSignalStrength return values in range (0-31, 99). I'd like to map these values into an image showing signal strength. The image is 5 filled (or unfilled) bars like

' ' '|' '||' '|||' '||||' '|||||'

Is it correct to just test in a linear way like

开发者_JS百科
    int x = m_nSignalStrength;

    if (x >= 0 && x <= 31){
        x = 5;
        if (x <= 25) x = 4;
        if (x <= 20) x = 3;
        if (x <= 15) x = 2;
        if (x <= 10) x = 1;
        if (x <= 5) x = 0;
    }

Cheers


You can make 5 different drawables, each one is representing one singnal strength state. When just display it on the screen.

Aboud a value interpretion. getGsmSignalStrength is refering to some document TS 27.007, section 8.5. I think the document is http://www.quintillion.co.jp/3GPP/Specs/27007-950.pdf (just Google on TS 27.007)

0

精彩评论

暂无评论...
验证码 换一张
取 消