Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Dantali0n/601702efe04665a3a59d to your computer and use it in GitHub Desktop.
Save Dantali0n/601702efe04665a3a59d to your computer and use it in GitHub Desktop.
Converts android wireless frequency numbers to their appriopiate wifi channel number, works for 2.4ghz and 5ghz channels
String frequencyToChannel(String frequency) {
switch(frequency) {
case "2412" :
return "ch 1 - 2.4ghz";
case "2417" :
return "ch 2 - 2.4ghz";
case "2422" :
return "ch 3 - 2.4ghz";
case "2427" :
return "ch 4 - 2.4ghz";
case "2432" :
return "ch 5 - 2.4ghz";
case "2437" :
return "ch 6 - 2.4ghz";
case "2442" :
return "ch 7 - 2.4ghz";
case "2447" :
return "ch 8 - 2.4ghz";
case "2452" :
return "ch 9 - 2.4ghz";
case "2457" :
return "ch 10 - 2.4ghz";
case "2462" :
return "ch 11 - 2.4ghz";
case "2467" :
return "ch 12 - 2.4ghz";
case "2472" :
return "ch 13 - 2.4ghz";
case "2484" :
return "ch 14 - 2.4ghz";
case "5035" :
return "ch 7 - 5.0ghz";
case "5040" :
return "ch 8 - 5.0ghz";
case "5045" :
return "ch 9 - 5.0ghz";
case "5055" :
return "ch 11 - 5.0ghz";
case "5060" :
return "ch 12 - 5.0ghz";
case "5080" :
return "ch 16 - 5.0ghz";
case "5170" :
return "ch 34 - 5.0ghz";
case "5180" :
return "ch 36 - 5.0ghz";
case "5190" :
return "ch 38 - 5.0ghz";
case "5200" :
return "ch 40 - 5.0ghz";
case "5210" :
return "ch 42 - 5.0ghz";
case "5220" :
return "ch 44 - 5.0ghz";
case "5230" :
return "ch 46 - 5.0ghz";
case "5240" :
return "ch 48 - 5.0ghz";
case "5260" :
return "ch 52 - 5.0ghz";
case "5280" :
return "ch 56 - 5.0ghz";
case "5300" :
return "ch 60 - 5.0ghz";
case "5320" :
return "ch 64 - 5.0ghz";
case "5500" :
return "ch 100 - 5.0ghz";
case "5520" :
return "ch 104 - 5.0ghz";
case "5540" :
return "ch 108 - 5.0ghz";
case "5560" :
return "ch 112 - 5.0ghz";
case "5580" :
return "ch 116 - 5.0ghz";
case "5600" :
return "ch 120 - 5.0ghz";
case "5620" :
return "ch 124 - 5.0ghz";
case "5640" :
return "ch 128 - 5.0ghz";
case "5660" :
return "ch 132 - 5.0ghz";
case "5680" :
return "ch 136 - 5.0ghz";
case "5700" :
return "ch 140 - 5.0ghz";
case "5720" :
return "ch 144 - 5.0ghz";
case "5745" :
return "ch 149 - 5.0ghz";
case "5765" :
return "ch 153 - 5.0ghz";
case "5785" :
return "ch 157 - 5.0ghz";
case "5805" :
return "ch 161 - 5.0ghz";
case "5825" :
return "ch 165 - 5.0ghz";
case "4915" :
return "ch 183 - 5.0ghz";
case "4920" :
return "ch 184 - 5.0ghz";
case "4925" :
return "ch 185 - 5.0ghz";
case "4935" :
return "ch 187 - 5.0ghz";
case "4940" :
return "ch 188 - 5.0ghz";
case "4945" :
return "ch 189 - 5.0ghz";
case "4960" :
return "ch 192 - 5.0ghz";
case "4980" :
return "ch 196 - 5.0ghz";
default:
return "No channel";
}
}
@prashantwosti
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment