in packages/@fbcmobile-signalscan/android/src/main/java/com/fbc/signalscan/WiFiScanResultsModule.java [172:192]
private static int getChannelFromFrequency(int frequency) {
// Hardcode channel 14 to 2482 which is designated for Japan
if (frequency == HIGH_2_DOT_4GHZ) {
return 14;
}
// Frequencies between 2412MHz and 2484MHz are in the 2.4GHz range. The
// starting freqency in that range is 2412 so we use that to calculate
// the channel which has 5MHz width.
if (frequency < HIGH_2_DOT_4GHZ) {
return (frequency - LOW_2_DOT_4GHZ) / 5 + 1;
}
// Frequencies in the 5GHz range
if (frequency > LOW_5GHZ && frequency < HIGH_5GHZ) {
return frequency / 5 - 1000;
}
// Outside the 2.4GHz and 5GHz range we'll just return zero for the channel
return 0;
}