该评分器与BubbleFunScorer
基本类似
打分算法的代码如下
private ScoredCandidate scoreCandidate(Candidate candidate) {
int rssiSaturationThreshold = mScoringParams.getGoodRssi(candidate.getFrequency());
int rssi = Math.min(candidate.getScanRssi(), rssiSaturationThreshold);
int score = (rssi + RSSI_SCORE_OFFSET) * RSSI_SCORE_SLOPE_IS_4;
if (ScanResult.is6GHz(candidate.getFrequency())) {
score += BAND_6GHZ_AWARD_IS_40;
} else if (ScanResult.is5GHz(candidate.getFrequency())) {
score += BAND_5GHZ_AWARD_IS_40;
}
score += (int) (candidate.getLastSelectionWeight() * LAST_SELECTION_AWARD_IS_480);
if (candidate.isCurrentNetwork()) {
// Add both traditional awards, as would be be case with firmware roaming
score += CURRENT_NETWORK_BOOST_IS_16 + SAME_BSSID_AWARD_IS_24;
}
if (!candidate.isOpenNetwork()) {
score += SECURITY_AWARD_IS_80;
}
// To simulate the old strict priority rule, subtract a penalty based on
// which nominator added the candidate.
score -= 1000 * candidate.getNominatorId();
// The old method breaks ties on the basis of RSSI, which we can
// emulate easily since our score does not need to be an integer.
double tieBreaker = candidate.getScanRssi() / 1000.0;
return new ScoredCandidate(score + tieBreaker, 10,
USE_USER_CONNECT_CHOICE, candidate);
}
处理步骤如下:
rssi处理: 以GoodRssi作为基准,如果>=GoodRssi,那么分数是确定值,以防止过大的信号强度对得分产生不合理的影响;如果<GoodRssi,那么分数为(rssi+85)*4
频段奖励: 根据候选网络的频段(6GHz、5GHz等),分别添加了 BAND_6GHZ_AWARD_IS_40
和 BAND_5GHZ_AWARD_IS_40
奖励。这是因为通常情况下,较高频段的网络(如5GHz和6GHz)具有更高的容量和性能,因此需要对它们进行奖励。5G/6G统一加40分。
最近连接奖励: 跟BubbleFunScorer的处理是一样的,只是这里的基础分LAST_SELECTION_AWARD_IS_480
更大一点,是480分。
当前网络奖励: 如果是当前已连接网络,加40分(CURRENT_NETWORK_BOOST_IS_16 + SAME_BSSID_AWARD_IS_24)
安全性奖励: 如果是非开放网络,加80分(SECURITY_AWARD_IS_80)
Nominator惩罚: 跟提名器相关,暂时没有深究其原因。
tieBreaker: 为了在得分相同的情况下通过信号强度的微小差异来解决优先级,以模拟旧的严格优先级规则。不知道这个old strict priority rule
是指什么,可能是以前的实现把,暂时没研究。
这个评分器的代码更为简单,计算方法几乎是线性的。