android+信号强度,Android信号强度计算方式

时间:2024-10-08 12:16:14

GSM的计算方式:A:这个是GSM的,LTE的是否应该有所不同。ASU转换成dBm:dBm=-113+(2*ASU)All*GettheGSMSignalStrength,validvaluesare(0-31,99)asdefinedinTS.

GSM的计算方式:

A: 这个是GSM的,,LTE的是否应该有所不同。

ASU转换成dBm:dBm=-113+(2*ASU)

All

* Get the GSM Signal Strength, valid values are (0-31, 99) as defined in TS

* 27.007 8.5

if (asu <= 2 || asu == 99) level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN(0);

else if (asu >= 12) level = SIGNAL_STRENGTH_GREAT(4);

else if (asu >= 8)  level = SIGNAL_STRENGTH_GOOD(3);

else if (asu >= 5)  level = SIGNAL_STRENGTH_MODERATE(2);

else level = SIGNAL_STRENGTH_POOR(1);

LTE:

LTE的计算方式好像与信噪比和信号接收质量有关系,详情如下,()

还有CDMA 的也在这个文件中。

/*

* TS 36.214 Physical Layer Section 5.1.3 TS 36.331 RRC RSSI = received

* signal + noise RSRP = reference signal dBm RSRQ = quality of signal

* dB= Number of Resource blocksxRSRP/RSSI SNR = gain=signal/noise ratio

* = -10log P1/P2 dB

*/

int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1;

if (mLteRsrp > -44) rsrpIconLevel = -1;

else if (mLteRsrp >= -85) rsrpIconLevel = SIGNAL_STRENGTH_GREAT;

else if (mLteRsrp >= -95) rsrpIconLevel = SIGNAL_STRENGTH_GOOD;

else if (mLteRsrp >= -105) rsrpIconLevel = SIGNAL_STRENGTH_MODERATE;

else if (mLteRsrp >= -115) rsrpIconLevel = SIGNAL_STRENGTH_POOR;

else if (mLteRsrp >= -140) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;

/*

* Values are -200 dB to +300 (SNR*10dB) RS_SNR >= 13.0 dB =>4 bars 4.5

* dB <= RS_SNR < 13.0 dB => 3 bars 1.0 dB <= RS_SNR < 4.5 dB => 2 bars

* -3.0 dB <= RS_SNR < 1.0 dB 1 bar RS_SNR < -3.0 dB/No Service Antenna

* Icon Only

*/

if (mLteRssnr > 300) snrIconLevel = -1;

else if (mLteRssnr >= 130) snrIconLevel = SIGNAL_STRENGTH_GREAT;

else if (mLteRssnr >= 45) snrIconLevel = SIGNAL_STRENGTH_GOOD;

else if (mLteRssnr >= 10) snrIconLevel = SIGNAL_STRENGTH_MODERATE;

else if (mLteRssnr >= -30) snrIconLevel = SIGNAL_STRENGTH_POOR;

else if (mLteRssnr >= -200)

snrIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;

if (DBG) log("getLTELevel - rsrp:" + mLteRsrp + " snr:" + mLteRssnr + " rsrpIconLevel:"

+ rsrpIconLevel + " snrIconLevel:" + snrIconLevel);

/* Choose a measurement type to use for notification */

if (snrIconLevel != -1 && rsrpIconLevel != -1) {

/*

* The number of bars displayed shall be the smaller of the bars

* associated with LTE RSRP and the bars associated with the LTE

* RS_SNR

*/

return (rsrpIconLevel < snrIconLevel ? rsrpIconLevel : snrIconLevel);

}

if (snrIconLevel != -1) return snrIconLevel;

if (rsrpIconLevel != -1) return rsrpIconLevel;

/* Valid values are (0-63, 99) as defined in TS 36.331 */

if (mLteSignalStrength > 63) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;

else if (mLteSignalStrength >= 12) rssiIconLevel = SIGNAL_STRENGTH_GREAT;

else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;

else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;

else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;

if (DBG) log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"

+ rssiIconLevel);

return rssiIconLevel;

TD-SCDMA的计算方式:

framework/base/

public int getTdScdmaLevel() {

final int tdScdmaDbm = getTdScdmaDbm();

int level;

if ((tdScdmaDbm > -25) || (tdScdmaDbm == ))

level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;

else if (tdScdmaDbm >= -49) level = SIGNAL_STRENGTH_GREAT;

else if (tdScdmaDbm >= -73) level = SIGNAL_STRENGTH_GOOD;

else if (tdScdmaDbm >= -97) level = SIGNAL_STRENGTH_MODERATE;

else if (tdScdmaDbm >= -120) level = SIGNAL_STRENGTH_POOR;

else level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;

if (DBG) log("getTdScdmaLevel = " + level);

return level;

}