Skip to content

Instantly share code, notes, and snippets.

@petersaints
Created March 31, 2016 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petersaints/68b17bbee89b657641a5e09d813dec07 to your computer and use it in GitHub Desktop.
Save petersaints/68b17bbee89b657641a5e09d813dec07 to your computer and use it in GitHub Desktop.
Convert a Wi-Fi's network center frequency to the corresponding channel number. Based on: http://stackoverflow.com/a/33276767/356977
public int getChannel() {
if (frequency == 2484) {
return 14;
} else if (frequency < 2484) {
return (frequency - 2407) / 5;
} else {
return frequency/5 - 1000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment