WIFI-2007 Cloud: Sometime the Noise value reported in SurveySample for OnChannel is 0

This commit is contained in:
Lynn Shi
2021-04-14 12:10:23 -04:00
parent 1e74c777fd
commit d644fa5e37

View File

@@ -1109,7 +1109,9 @@ public class MqttStatsPublisher {
busy += surveySample.getBusy() * surveySample.getDurationMs(); busy += surveySample.getBusy() * surveySample.getDurationMs();
busySelf += surveySample.getBusySelf() * surveySample.getDurationMs(); busySelf += surveySample.getBusySelf() * surveySample.getDurationMs();
totalDurationMs += surveySample.getDurationMs(); totalDurationMs += surveySample.getDurationMs();
noiseList.add(getNegativeSignedIntFrom8BitUnsigned(surveySample.getNoise())); if (surveySample.hasNoise()) {
noiseList.add(getNegativeSignedIntFrom8BitUnsigned(surveySample.getNoise()));
}
} }
if (totalDurationMs > 0) { if (totalDurationMs > 0) {
@@ -1761,15 +1763,16 @@ public class MqttStatsPublisher {
long totalDurationMs = 0; long totalDurationMs = 0;
ChannelInfo channelInfo = new ChannelInfo(); ChannelInfo channelInfo = new ChannelInfo();
int[] noiseArray = new int[surveySampleList.size()]; List<Integer> noiseList = new ArrayList<>();
int index = 0;
for (SurveySample sample : surveySampleList) { for (SurveySample sample : surveySampleList) {
busyTx += sample.getBusyTx() * sample.getDurationMs(); busyTx += sample.getBusyTx() * sample.getDurationMs();
busySelf += sample.getBusySelf() * sample.getDurationMs(); // successful busySelf += sample.getBusySelf() * sample.getDurationMs(); // successful
// Rx // Rx
busy += sample.getBusy() * sample.getDurationMs(); busy += sample.getBusy() * sample.getDurationMs();
channelInfo.setChanNumber(sample.getChannel()); channelInfo.setChanNumber(sample.getChannel());
noiseArray[index++] = getNegativeSignedIntFrom8BitUnsigned(sample.getNoise()); if (sample.hasNoise()) {
noiseList.add(getNegativeSignedIntFrom8BitUnsigned(sample.getNoise()));
}
totalDurationMs += sample.getDurationMs(); totalDurationMs += sample.getDurationMs();
} }
@@ -1781,8 +1784,8 @@ public class MqttStatsPublisher {
channelInfo.setTotalUtilization(totalUtilization.intValue()); channelInfo.setTotalUtilization(totalUtilization.intValue());
channelInfo.setWifiUtilization(totalUtilization.intValue() - totalNonWifi.intValue()); channelInfo.setWifiUtilization(totalUtilization.intValue() - totalNonWifi.intValue());
channelInfo.setBandwidth(channelBandwidth); channelInfo.setBandwidth(channelBandwidth);
if (surveySampleList.size() > 0) { if (noiseList.size() > 0) {
channelInfo.setNoiseFloor((int) Math.round(DecibelUtils.getAverageDecibel(noiseArray))); channelInfo.setNoiseFloor((int) Math.round(DecibelUtils.getAverageDecibel(toIntArray(noiseList))));
} }
return channelInfo; return channelInfo;
} }