owlps/owlps-positioning/posutil.cc

59 lines
1.1 KiB
C++

#include "posutil.hh"
/*
* Returns the frequency in Hz corresponding to the 802.11 channel "channel"
* or 0 if the channel is wrong.
*/
unsigned int PosUtil::channel_to_frequency(const int &channel)
{
switch (channel)
{
case 1:
case CHANNEL_1:
return CHANNEL_1 ;
case 2:
case CHANNEL_2:
return CHANNEL_2 ;
case 3:
case CHANNEL_3:
return CHANNEL_3 ;
case 4:
case CHANNEL_4:
return CHANNEL_4 ;
case 5:
case CHANNEL_5:
return CHANNEL_5 ;
case 6:
case CHANNEL_6:
return CHANNEL_6 ;
case 7:
case CHANNEL_7:
return CHANNEL_7 ;
case 8:
case CHANNEL_8:
return CHANNEL_8 ;
case 9:
case CHANNEL_9:
return CHANNEL_9 ;
case 10:
case CHANNEL_10:
return CHANNEL_10 ;
case 11:
case CHANNEL_11:
return CHANNEL_11 ;
case 12:
case CHANNEL_12:
return CHANNEL_12 ;
case 13:
case CHANNEL_13:
return CHANNEL_13 ;
case 14:
case CHANNEL_14:
return CHANNEL_14 ;
}
return 0 ; // Error: wrong channel value
}