android 修改wifi信号强度
16lz
2021-01-23
基于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数值加大就好了。
更多相关文章
- [Android Pro] Android的5个进程等级
- android获取bluetooth的信号强度(RSSI)
- Android Telephony —— 手机信号实时变化源码分析过程记录
- 开发者大会传递信号:Android开发者将越来越赚钱?
- Android wifi信号强弱检测
- Android智能手机搜索不到路由器无线信号怎么办?
- 代码实现android手机信号监听
- Android版本及API等级关系
- android 获取wifi 信号质量