android 修改wifi信号强度

基于MTK 6.0系统

源码文件 frameworks/base/wifi/java/android/net/wifi/WifiManager.java;

 /**
      * Calculates the level of the signal. This should be used any time a signal
      * is being shown.
      * @param rssi The power of the signal measured in RSSI.
      * @param numLevels The number of levels to consider in the calculated
      *            level.
      * @return A level of the signal, given in the range of 0 to numLevels-1
      *         (both inclusive).
      */
     public static int calculateSignalLevel(int rssi, int numLevels) {
         rssi = rssi + 8; // add by wxd
         if (rssi <= MIN_RSSI) {
             return 0;
         } else if (rssi >= MAX_RSSI) {
             return numLevels - 1;
         } else {
             float inputRange = (MAX_RSSI - MIN_RSSI);
             float outputRange = (numLevels - 1);
             return (int)((float)(rssi - MIN_RSSI) * outputRange / inputRange);
         }
     }

上述方法就是计算wifi信号强度等级的函数,MAX_RSSI和MIN_RSSI分别为最强和最弱信号强度等级的信号强度阀值,分别为-55和-100,至于信号强度等级系统默认是这样的

     /**
      * Number of RSSI levels used in the framework to initiate
      * {@link #RSSI_CHANGED_ACTION} broadcast
      * @hide
      */
     public static final int RSSI_LEVELS = 5;
 
如果想修改wifi的信号强度的显示,把rssi数值加大就好了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值